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
main
Burton Li 5 years ago committed by Facebook GitHub Bot
parent e91d1a21a6
commit 8abd41a544
  1. 4
      utilities/transactions/write_unprepared_transaction_test.cc

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

Loading…
Cancel
Save