Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-10203

Improve the number of test vectors for the hashed indexes.

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • 2.4.5
    • None
    • Testing.
    • Fully Compatible

    Description

      I am working on a capability to target requests to a mongos based on the mongod server hosting the data within a sharded cluster.

      For "normal" indexes (ascending and descending) this is easy enough and shows promise in improving performance.

      For hashed indexes I ran into the issue that there was exactly 1 test case that I could find to ensure my hashing of the index is consistent with MongoDB's.

      struct HasherUnitTest : public StartupTest {
          void run() {
              // Hard-coded check to ensure the hash function is consistent across platforms
              BSONObj o = BSON( "check" << 42 );
              verify( BSONElementHasher::hash64( o.firstElement(), 0 ) == -944302157085130861LL );
          }
      } hasherUnitTest;

      This seems a little "under specified" to me. I created a more complete test suite of "test vectors" and figured it is probably a useful thing to have in the baseline to ensure future changes that modify the hashing indexes will be more likely to be caught.

      Pull Request coming soon...

      Attachments

        Activity

          People

            sverch Shaun Verch
            robert.j.moore@allanbank.com Robert Moore
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: