[SERVER-47748] The update stage will not treat as "sharded" for the purposes of validatation and immutable fields config.system.sessions Created: 24/Apr/20  Updated: 29/Oct/23  Resolved: 06/May/20

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 4.2.6, 4.4.0-rc3
Fix Version/s: 4.7.0

Type: Bug Priority: Major - P3
Reporter: Tommaso Tocci Assignee: Pierlauro Sciarelli
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File backtrace.pretty.txt    
Issue Links:
Gantt Dependency
has to be done before SERVER-47830 Consolidate validation flags for upda... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2020-05-18
Participants:

 Description   

This two flags:



 Comments   
Comment by Githook User [ 06/May/20 ]

Author:

{'name': 'Pierlauro Sciarelli', 'email': 'pierlauro.sciarelli@mongodb.com', 'username': 'pierlauro'}

Message: SERVER-47748 The update stage will not treat as "sharded" for the purposes of validatation and immutable fields config.system.sessions
Branch: master
https://github.com/mongodb/mongo/commit/32e1e0dfc4274443dd395df686e33db6abe75599

Comment by Pierlauro Sciarelli [ 30/Apr/20 ]

Since the _id field is immutable, I am going to opt for the document validation solution.

As I should provide the proper jsonSchema to the validator, is there any official reference about it? Or am I supposed to reverse engineer the schema by manually inspecting config.system.sessions documents?

Comment by Kaloian Manassiev [ 30/Apr/20 ]

Assigning to pierlauro.sciarelli.

I think as part of fixing this bug we should also write a test, which modifies the shard key of a document from this collection, but I am not sure if this is possible in general because the shard key is _id and I don't know whether you can modify a document's _id. Give it a try?

Alternatively, as part of the test, you can add a document validation schema to the config.system.sessions collection and try to insert something, which violates that schema. Because of this bug, the document with the bad schema should be accepted.

You can probably just add it to this test.

Comment by Tommaso Tocci [ 30/Apr/20 ]

In the probing patch unittests are failing with:

{
  "suite": {
    "name": "AssignKeyRangeToZoneTestFixture",
    "tests": 1,
    "fails": 1,
    "asserts": 0,
    "time": {
      "durationMillis": 156
    },
    "failures": [
      {
        "test": "RemoveZoneWithDollarPrefixedShardKeysShouldFail",
        "type": "TestAssertionFailureException",
        "error": "Expected ::mongo::Status::OK() == (Grid::get(operationContext()) ->catalogClient() ->updateConfigDocument( operationContext(), TagsType::ConfigNS, updateQuery, updateBuilder.obj(), true, WriteConcernOptions(1, WriteConcernOptions::SyncMode::UNSET, Seconds(0)))) (OK  == DollarPrefixedFieldName The dollar ($) prefixed field '$A' in '_id.min.x.$A' is not valid for storage.) @src/mongo/db/s/config/sharding_catalog_manager_assign_key_range_to_zone_test.cpp:263"
      }
    ]
  }
}

and here you have the backtrace.pretty.txt

Comment by Tommaso Tocci [ 29/Apr/20 ]

Here there is the first probing patch

Generated at Thu Feb 08 05:15:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.