[SERVER-21647] $rename changes field ordering Created: 24/Nov/15 Updated: 17/Nov/16 Resolved: 30/Dec/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | 2.6.11, 3.0.7, 3.2.0-rc3 |
| Fix Version/s: | 2.6.12, 3.0.9, 3.2.3, 3.3.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Robert Guo (Inactive) | Assignee: | David Storch |
| Resolution: | Done | Votes: | 2 |
| Labels: | code-and-test, fuzzer-blocker | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Operating System: | ALL | ||||||||||||
| Backport Completed: | |||||||||||||
| Sprint: | QuInt E (01/11/16) | ||||||||||||
| Participants: | |||||||||||||
| Linked BF Score: | 0 | ||||||||||||
| Description |
|
A $rename is replicated as a $set and a $unset, which results in the same document but with the fields in a different order. This causes dbHash to be different on the secondary and primary. |
| Comments |
| Comment by Githook User [ 11/Jan/16 ] | |||||
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: (cherry picked from commit b45dba8425b49714c5ca1394aba0bb97029c2560) | |||||
| Comment by Githook User [ 11/Jan/16 ] | |||||
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: (cherry picked from commit 994060e622c22783c29ff3d1c243c298fcd3442c) | |||||
| Comment by Githook User [ 07/Jan/16 ] | |||||
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: (cherry picked from commit b45dba8425b49714c5ca1394aba0bb97029c2560) Conflicts: | |||||
| Comment by Githook User [ 07/Jan/16 ] | |||||
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: (cherry picked from commit 994060e622c22783c29ff3d1c243c298fcd3442c) Conflicts: | |||||
| Comment by Githook User [ 06/Jan/16 ] | |||||
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: (cherry picked from commit b45dba8425b49714c5ca1394aba0bb97029c2560) | |||||
| Comment by Githook User [ 06/Jan/16 ] | |||||
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: (cherry picked from commit 994060e622c22783c29ff3d1c243c298fcd3442c) | |||||
| Comment by Githook User [ 30/Dec/15 ] | |||||
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: | |||||
| Comment by Githook User [ 30/Dec/15 ] | |||||
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: | |||||
| Comment by Eric Milkie [ 11/Dec/15 ] | |||||
|
From the examples, I was confused by the original title of this ticket. $rename isn't changing the field order on secondaries – in fact, the field order is properly preserved on secondaries. On primaries and standalone nodes, however, the $rename-d field is moved to the end of the object, regardless of the prior name or the new name of the renamed field. If we want $rename to work like $set and other $ modifiers, it ought to preserve the field order. This can be fixed by rebuilding the object on the primary to insert the renamed field in the proper place. | |||||
| Comment by Robert Guo (Inactive) [ 24/Nov/15 ] | |||||
|
primary log:
primary oplog:
secondary oplog:
document on primary
document on secondary:
| |||||
| Comment by Scott Hernandez (Inactive) [ 24/Nov/15 ] | |||||
|
Is the oplog for the first update a $unset + $set? Can you supply the oplog entries and the document on the replica please? |