Details
-
Improvement
-
Resolution: Done
-
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...