Fix write_unprepared_transaction_test crash on debug version. (#6574)

Summary:
The last key may hit index of out bound exception when id = 9.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6574

Reviewed By: riversand963

Differential Revision: D20699791

Pulled By: cheng-chang

fbshipit-source-id: 8e2c5be5ff0e53e9857cfd59cea97cff21446819
This commit is contained in:
Burton Li 2020-03-27 11:10:12 -07:00 committed by Facebook GitHub Bot
parent e91d1a21a6
commit 8abd41a544

View File

@ -182,8 +182,8 @@ TEST_P(WriteUnpreparedStressTest, ReadYourOwnWriteStress) {
ReadOptions read_options;
for (uint32_t i = 0; i < kNumIter; i++) {
std::set<std::string> owned_keys(&keys[id * kNumKeys],
&keys[(id + 1) * kNumKeys]);
std::set<std::string> owned_keys(keys.begin() + id * kNumKeys,
keys.begin() + (id + 1) * kNumKeys);
// Add unowned keys to make the workload more interesting, but this
// increases row lock contention, so just do it sometimes.
if (rnd.OneIn(2)) {