make MockTimeEnv::current_time_ atomic to fix data race

Summary:
fix a new TSAN failure
https://gist.github.com/miasantreble/7599c33f4e17da1024c67d4540dbe397
Closes https://github.com/facebook/rocksdb/pull/3694

Differential Revision: D7565310

Pulled By: miasantreble

fbshipit-source-id: f672c96e925797b34dec6e20b59527e8eebaa825
main
Zhongyi Xie 7 years ago committed by Facebook Github Bot
parent 5ec382b918
commit 2770a94c42
  1. 2
      db/db_test_util.h
  2. 1
      util/status.cc

@ -606,7 +606,7 @@ class MockTimeEnv : public EnvWrapper {
}
private:
uint64_t current_time_ = 0;
std::atomic<uint64_t> current_time_{0};
};
#ifndef ROCKSDB_LITE

@ -19,6 +19,7 @@ const char* Status::CopyState(const char* state) {
std::strlen(state) + 1; // +1 for the null terminator
char* const result =
new char[cch];
result[cch - 1] = '\0';
#ifdef OS_WIN
errno_t ret;
ret = strncpy_s(result, cch, state, cch - 1);

Loading…
Cancel
Save