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

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

Loading…
Cancel
Save