[SERVER-23306] Check collection attributes during (js) testing Created: 23/Mar/16  Updated: 18/Nov/16  Resolved: 05/Jul/16

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 3.2.9, 3.3.10

Type: Bug Priority: Major - P3
Reporter: Scott Hernandez (Inactive) Assignee: Jonathan Abrahams
Resolution: Done Votes: 0
Labels: test-only
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-23226 Port resmoke.py's CheckReplDBHash hoo... Closed
Related
related to SERVER-25146 JS replset dbhash hook fails when che... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Sprint: TIG 15 (06/03/16), TIG 17 (07/15/16)
Participants:

 Description   

When running test suites which verify replication we should not only compare the collection list, but also attributes like "capped" and "temp", which are part of the output of the commands collStats and listCollections

More Attributes:

  • "capped" (handled in SERVER-23226)
  • "temp" (handled in SERVER-23226)
  • "size" (not handled)
  • "max" (not handled)
  • "$nExtents" (not handled)
  • "autoIndexId" (not handled)
  • "flags" (not handled)
  • "storageEngine" (not handled)
  • "indexOptionDefaults" (not handled)
  • "validator" (not handled)
  • "validationAction" (not handled)
  • "validationLevel" (not handled)
  • "collation" (not handled)


 Comments   
Comment by Githook User [ 18/Jul/16 ]

Author:

{u'username': u'hptabster', u'name': u'Jonathan Abrahams', u'email': u'jonathan@mongodb.com'}

Message: SERVER-23306 Enhance checkDBHashes hook - add more comparisons from collStats & getCollectionInfos

(cherry picked from commit 71424c1c4b87c5819b1fc5cf114078a6f33c6078)
Branch: v3.2
https://github.com/mongodb/mongo/commit/bafb456383705193ac9aa35233df1a2b0c49a761

Comment by Githook User [ 05/Jul/16 ]

Author:

{u'username': u'hptabster', u'name': u'Jonathan Abrahams', u'email': u'jonathan@mongodb.com'}

Message: SERVER-23306 Enhance checkDBHashes hook - add more comparisons from collStats & getCollectionInfos
Branch: master
https://github.com/mongodb/mongo/commit/71424c1c4b87c5819b1fc5cf114078a6f33c6078

Comment by Robert Guo (Inactive) [ 22/Jun/16 ]

I re-purposed this ticket to check for more attributes. The original description of checking for the "capped" and "temp' attributes are done as part of SERVER-23326

Comment by Max Hirschhorn [ 23/Mar/16 ]

The CheckReplDBHash hook in resmoke.py already verifies that if the collection is capped on the primary, then it should be capped on the secondary (and vice-versa).

if primary_coll_hash == secondary_coll_hash:
    continue
 
# Ignore capped collections because they are not expected to match on all nodes.
if primary_db.command({"collStats": coll_name})["capped"]:
    # Still fail if the collection is not capped on the secondary.
    if not secondary_db.command({"collStats": coll_name})["capped"]:
        success = False
        sb.append("%s.%s collection is capped on primary but not on secondary."
                  % (primary_db.name, coll_name))
    sb.append("%s.%s collection is capped, ignoring." % (primary_db.name, coll_name))
    continue
# Still fail if the collection is capped on the secondary, but not on the primary.
elif secondary_db.command({"collStats": coll_name})["capped"]:
    success = False
    sb.append("%s.%s collection is capped on secondary but not on primary."
              % (primary_db.name, coll_name))
    continue

The primary_coll_hash == secondary_coll_hash check should probably be moved after calling the "collStats" command to avoid the situation where a collection is capped on the primary and non-capped on the secondary, but has a maxSize such that the collection has yet to be truncated. We may want to consider addressing this issue when porting the hook to JS in SERVER-23226.

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