[SERVER-10203] Improve the number of test vectors for the hashed indexes. Created: 15/Jul/13  Updated: 11/Jul/16  Resolved: 08/Aug/13

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

Type: Improvement Priority: Minor - P4
Reporter: Robert Moore Assignee: Shaun Verch
Resolution: Done Votes: 0
Labels: pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Testing.


Backwards Compatibility: Fully Compatible
Participants:

 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...



 Comments   
Comment by auto [ 08/Aug/13 ]

Author:

{u'username': u'allanbank', u'name': u'Robert J. Moore', u'email': u'Robert.J.Moore@allanbank.com'}

Message: SERVER-10203: Add new hasher unit tests and consolidate with old hasher dbtests

Signed-off-by: Shaun Verch <shaun.verch@10gen.com>
Branch: master
https://github.com/mongodb/mongo/commit/a97f74585b958bd9c4a3f28d91a8049aa5286504

Comment by Robert Moore [ 21/Jul/13 ]

Just a quick note that I fixed one of the tests, clarified a second and added a third to the pull request.

Comment by Robert Moore [ 15/Jul/13 ]

https://github.com/mongodb/mongo/pull/452

Generated at Thu Feb 08 03:22:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.