[SERVER-29487] IdempotencyTest::validate() should also verify consistency of collection/index options Created: 07/Jun/17  Updated: 30/Oct/23  Resolved: 20/Jun/17

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

Type: Improvement Priority: Major - P3
Reporter: Max Hirschhorn Assignee: May Hoque
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: TIG 2017-06-19, TIG 2017-07-10
Participants:

 Description   

The IdempotencyTest::validate() function currently performs collection validation and computes a hash of the collection's contents for later verification. We should additional check that re-applying the operations via runOps() results in a collection with the same options as before and that any indexes on the collection have the same options as before. This can be viewed as the C++ analogue to some of the additional consistency checks for collection metadata performed in ReplSetTest.prototype.checkReplicatedDataHashes().

The IdempotencyTest::validate() function should probably return a struct that contains a std::string for the collection's hash as well as a CollectionOptions struct and a std::vector<BSONObj> for the index specifications. See CollectionCatalogEntry::getCollectionOptions() and CollectionCatalogEntry::getIndexSpec() for how to retrieve this information from collection->getCatalogEntry().



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

Author:

{u'username': u'Utagai', u'name': u'may', u'email': u'may.hoque@mongodb.com'}

Message: SERVER-29487 IdempotencyTest::validate() should also verify consistency of collection/index options

Remove some excess end-of-line spaces.

Clang format touched source file.

Change hash variable names to state to reflect new validate().

Add constructors to struct and utilize them in later code.

Remove unnecessary struct declaration to CollectionOptions.

Utilize constant instance of CollectionState struct.

Reorder methods to come before members.

Rename l and r iterators to thisIt and otherIt for clarity.

Conform to style by changing multiline comments to use //

Move iterator into for-loop scope instead of outside.

Change Equals suffix to Equal to better reflect variable meaning.

Add special case handling for nonexistence of collection in ==

Add assertion to check that index spec set size is equal to the vector of all indices.

Move dataHash string assignment nearer to md5 hash generation for conceptual locality.

Add changes from clang-format.py.

Convert toString() string generation from raw concat. to StringBuilder.

Add spacing for readability in cmpIndexSpecs() and fix typo.

Change colon to period in comment.

Change newline printing to semicolon printing in toString() except for indexSpecs.

Change constructor method to use more efficient one in validate() return.

Add early check for exists field; if false return message about collection not existing.

Change toStringBuilder naming of mongo::StringBuilder to sb.

Move up lhs.exists == rhs.exists check up to beginning of operator== overload.

Remove std::endl; from << overload.

Change for loop to use range-based for loop in toString().

Change index options list to index specs array.

Remove excess empty array printing for index specs in toString().

Update documentaiton of toString() to reflect changes.

Fix typo of Prints -> Returns in toString() docs.

Add visual separation between beginning if statement in toString().

Fix format issues in C++ file.

Add visual separation between beginning if statement in operator==
Branch: master
https://github.com/mongodb/mongo/commit/9022c80626cc1316f83e657591f1f19f3db7237b

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