[SERVER-29334] Cannot write shard chunks documents with _id fields containing values with dotted field names, e.g. { _id: { a.b: 10 } } Created: 23/May/17  Updated: 30/Oct/23  Resolved: 02/Jun/17

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 3.5.9

Type: Bug Priority: Major - P3
Reporter: Dianna Hohensee (Inactive) Assignee: Dianna Hohensee (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-29349 Delete shell/upgrade_check.js Closed
depends on SERVER-29351 remove redundant use of BSONObj::stor... Closed
Gantt Dependency
has to be done before SERVER-29333 Replace incorrect use of getStatusFro... Closed
Related
related to DOCS-10896 Updating naming restrictions on field... Closed
is related to SERVER-24174 Inconsistent rule for storing dotted ... Closed
is related to SERVER-6999 Embedded "dot-notation" fields broken... Closed
is related to SERVER-10454 Do not store field names with "." in ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2017-05-29, Sharding 2017-06-19
Participants:
Linked BF Score: 0

 Description   

_id fields are not allowed to have values containing dotted field names, like we're currently doing for chunk metadata collections on the shard, e.g.

{ _id: { "a.b": 10 } }

Can see the problem if you follow this code here, here and here. This check doesn't appear to be done on non _id fields, so it's fine when we do it on the config server like this

{ min: { "a.b": 10 } }

_id checks on insert seem to have been introduced in v3.0 in this commit (SERVER-12209). This is a server check. There are also more checks in the shell that prevent dotted field names, probably more generically. SERVER-12209 seems to have been in response to errors involving "$" rather than any intention to check for dotted field names.

The dotted field check originated in 1.7 via this commit


Dotted field names must be allowed on insert for shard keys. It is an inconsistency that we check for dotted field names on _id, but no other fields.



 Comments   
Comment by Githook User [ 02/Jun/17 ]

Author:

{u'username': u'DiannaHohensee', u'name': u'Dianna Hohensee', u'email': u'dianna.hohensee@10gen.com'}

Message: SERVER-29334 remove dotted field name check from BSONObj::okForStorage
Branch: master
https://github.com/mongodb/mongo/commit/7ae19ef3ae9a4555ff71acf8e44f34775b130d3e

Comment by Dianna Hohensee (Inactive) [ 24/May/17 ]

The proposed solution is to remove this code that does the dotted field checks in BSONObj::_okForStorage. After SERVER-29349 and SERVER-29351, insert.cpp and shard_key_pattern.cpp will be the only users of BSONObj::_okForStorage, and neither of those uses were intended to catch dotted field names, but rather incorrect '$' and ref uses.


Added to ops/insert.cpp to check for '$'' fields, https://github.com/mongodb/mongo/commit/34d899304d971942e6ce4743489495d11a4d48c1 Not intended to check for dotted field names. Unsure whether we want to keep a.$.b checks somehow – removing dotted field name checks lets this format of field name with '$' slip by.

Introduced to shard_key_pattern.cpp in this commit https://github.com/mongodb/mongo/commit/a67ea3ac0c570cc738d43494079e2bc284aa5071#diff-de3717d584ea2ec74a8014339593ce2fR54 to fix '$' problems. Doesn't seem to need the dotted field check, explicitly, so seems incidental.

Generated at Thu Feb 08 04:20:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.