• N
    Phase 2 of iterator stress test · 7edb92b8
    Natalie Hildebrandt 提交于
    Summary: Using an iterator instead of the Get method, each thread goes through a portion of the database and verifies values by comparing to the shared state.
    
    Test Plan:
    ./db_stress --db=/tmp/tmppp --max_key=10000 --ops_per_thread=10000
    
    To test some basic cases, the following lines can be added (each set in turn) to the verifyDb method with the following expected results:
    
        // Should abort with "Unexpected value found"
        shared.Delete(start);
    
        // Should abort with "Value not found"
        WriteOptions write_opts;
        db_->Delete(write_opts, Key(start));
    
        // Should succeed
        WriteOptions write_opts;
        shared.Delete(start);
         db_->Delete(write_opts, Key(start));
    
        // Should abort with "Value not found"
        WriteOptions write_opts;
        db_->Delete(write_opts, Key(start + (end-start)/2));
    
        // Should abort with "Value not found"
        db_->Delete(write_opts, Key(end-1));
    
        // Should abort with "Unexpected value"
        shared.Delete(end-1);
    
        // Should abort with "Unexpected value"
        shared.Delete(start + (end-start)/2);
    
        // Should abort with "Value not found"
        db_->Delete(write_opts, Key(start));
        shared.Delete(start);
        db_->Delete(write_opts, Key(end-1));
        db_->Delete(write_opts, Key(end-2));
    
    To test the out of range abort, change the key in the for loop to Key(i+1), so that the key defined by the index i is now outside of the supposed range of the database.
    
    Reviewers: emayanke
    
    Reviewed By: emayanke
    
    CC: dhruba, xjin
    
    Differential Revision: https://reviews.facebook.net/D13071
    7edb92b8
db_stress.cc 52.5 KB