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

Improve the number of test vectors for the hashed indexes.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.4.5
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
      Testing.
    • Backwards Compatibility:
      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

            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: