thread_local.cc 18.3 KB
Newer Older
1
//  Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
L
Lei Jin 已提交
2 3 4 5 6 7 8 9 10 11
//  This source code is licensed under the BSD-style license found in the
//  LICENSE file in the root directory of this source tree. An additional grant
//  of patent rights can be found in the PATENTS file in the same directory.
//
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.

#include "util/thread_local.h"
#include "util/mutexlock.h"
12
#include "port/likely.h"
A
Anders Bakken 已提交
13
#include <stdlib.h>
14

L
Lei Jin 已提交
15 16
namespace rocksdb {

17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
struct Entry {
  Entry() : ptr(nullptr) {}
  Entry(const Entry& e) : ptr(e.ptr.load(std::memory_order_relaxed)) {}
  std::atomic<void*> ptr;
};

class StaticMeta;

// This is the structure that is declared as "thread_local" storage.
// The vector keep list of atomic pointer for all instances for "current"
// thread. The vector is indexed by an Id that is unique in process and
// associated with one ThreadLocalPtr instance. The Id is assigned by a
// global StaticMeta singleton. So if we instantiated 3 ThreadLocalPtr
// instances, each thread will have a ThreadData with a vector of size 3:
//     ---------------------------------------------------
//     |          | instance 1 | instance 2 | instnace 3 |
//     ---------------------------------------------------
//     | thread 1 |    void*   |    void*   |    void*   | <- ThreadData
//     ---------------------------------------------------
//     | thread 2 |    void*   |    void*   |    void*   | <- ThreadData
//     ---------------------------------------------------
//     | thread 3 |    void*   |    void*   |    void*   | <- ThreadData
//     ---------------------------------------------------
struct ThreadData {
  explicit ThreadData(ThreadLocalPtr::StaticMeta* _inst) : entries(), inst(_inst) {}
  std::vector<Entry> entries;
  ThreadData* next;
  ThreadData* prev;
  ThreadLocalPtr::StaticMeta* inst;
};

class ThreadLocalPtr::StaticMeta {
public:
  StaticMeta();

  // Return the next available Id
  uint32_t GetId();
  // Return the next available Id without claiming it
  uint32_t PeekId() const;
  // Return the given Id back to the free pool. This also triggers
  // UnrefHandler for associated pointer value (if not NULL) for all threads.
  void ReclaimId(uint32_t id);

  // Return the pointer value for the given id for the current thread.
  void* Get(uint32_t id) const;
  // Reset the pointer value for the given id for the current thread.
  void Reset(uint32_t id, void* ptr);
  // Atomically swap the supplied ptr and return the previous value
  void* Swap(uint32_t id, void* ptr);
  // Atomically compare and swap the provided value only if it equals
  // to expected value.
  bool CompareAndSwap(uint32_t id, void* ptr, void*& expected);
  // Reset all thread local data to replacement, and return non-nullptr
  // data for all existing threads
  void Scrape(uint32_t id, autovector<void*>* ptrs, void* const replacement);
  // Update res by applying func on each thread-local value. Holds a lock that
  // prevents unref handler from running during this call, but clients must
  // still provide external synchronization since the owning thread can
  // access the values without internal locking, e.g., via Get() and Reset().
  void Fold(uint32_t id, FoldFunc func, void* res);

  // Register the UnrefHandler for id
  void SetHandler(uint32_t id, UnrefHandler handler);

  // protect inst, next_instance_id_, free_instance_ids_, head_,
  // ThreadData.entries
  //
  // Note that here we prefer function static variable instead of the usual
  // global static variable.  The reason is that c++ destruction order of
  // static variables in the reverse order of their construction order.
  // However, C++ does not guarantee any construction order when global
  // static variables are defined in different files, while the function
  // static variables are initialized when their function are first called.
  // As a result, the construction order of the function static variables
  // can be controlled by properly invoke their first function calls in
  // the right order.
  //
  // For instance, the following function contains a function static
  // variable.  We place a dummy function call of this inside
  // Env::Default() to ensure the construction order of the construction
  // order.
  static port::Mutex* Mutex();

  // Returns the member mutex of the current StaticMeta.  In general,
  // Mutex() should be used instead of this one.  However, in case where
  // the static variable inside Instance() goes out of scope, MemberMutex()
  // should be used.  One example is OnThreadExit() function.
  port::Mutex* MemberMutex() { return &mutex_; }

private:
  // Get UnrefHandler for id with acquiring mutex
  // REQUIRES: mutex locked
  UnrefHandler GetHandler(uint32_t id);

  // Triggered before a thread terminates
  static void OnThreadExit(void* ptr);

  // Add current thread's ThreadData to the global chain
  // REQUIRES: mutex locked
  void AddThreadData(ThreadData* d);

  // Remove current thread's ThreadData from the global chain
  // REQUIRES: mutex locked
  void RemoveThreadData(ThreadData* d);

  static ThreadData* GetThreadLocal();

  uint32_t next_instance_id_;
  // Used to recycle Ids in case ThreadLocalPtr is instantiated and destroyed
  // frequently. This also prevents it from blowing up the vector space.
  autovector<uint32_t> free_instance_ids_;
  // Chain all thread local structure together. This is necessary since
  // when one ThreadLocalPtr gets destroyed, we need to loop over each
  // thread's version of pointer corresponding to that instance and
  // call UnrefHandler for it.
  ThreadData head_;

  std::unordered_map<uint32_t, UnrefHandler> handler_map_;

  // The private mutex.  Developers should always use Mutex() instead of
  // using this variable directly.
  port::Mutex mutex_;
D
Daniel Black 已提交
139
#ifdef ROCKSDB_SUPPORT_THREAD_LOCAL
140 141 142 143 144 145 146 147 148 149 150 151
  // Thread local storage
  static __thread ThreadData* tls_;
#endif

  // Used to make thread exit trigger possible if !defined(OS_MACOSX).
  // Otherwise, used to retrieve thread data.
  pthread_key_t pthread_key_;
};


#ifdef ROCKSDB_SUPPORT_THREAD_LOCAL
__thread ThreadData* ThreadLocalPtr::StaticMeta::tls_ = nullptr;
L
Lei Jin 已提交
152 153
#endif

D
Dmitri Smirnov 已提交
154 155 156 157 158 159
// Windows doesn't support a per-thread destructor with its
// TLS primitives.  So, we build it manually by inserting a
// function to be called on each thread's exit.
// See http://www.codeproject.com/Articles/8113/Thread-Local-Storage-The-C-Way
// and http://www.nynaeve.net/?p=183
//
S
sdong 已提交
160 161 162 163
// really we do this to have clear conscience since using TLS with thread-pools
// is iffy
// although OK within a request. But otherwise, threads have no identity in its
// modern use.
D
Dmitri Smirnov 已提交
164 165 166 167 168

// This runs on windows only called from the System Loader
#ifdef OS_WIN

// Windows cleanup routine is invoked from a System Loader with a different
S
sdong 已提交
169 170 171 172
// signature so we can not directly hookup the original OnThreadExit which is
// private member
// so we make StaticMeta class share with the us the address of the function so
// we can invoke it.
D
Dmitri Smirnov 已提交
173 174 175
namespace wintlscleanup {

// This is set to OnThreadExit in StaticMeta singleton constructor
S
sdong 已提交
176
UnrefHandler thread_local_inclass_routine = nullptr;
D
Dmitri Smirnov 已提交
177 178 179 180
pthread_key_t thread_local_key = -1;

// Static callback function to call with each thread termination.
void NTAPI WinOnThreadExit(PVOID module, DWORD reason, PVOID reserved) {
181 182 183 184
  // We decided to punt on PROCESS_EXIT
  if (DLL_THREAD_DETACH == reason) {
    if (thread_local_key != -1 && thread_local_inclass_routine != nullptr) {
      void* tls = pthread_getspecific(thread_local_key);
S
sdong 已提交
185
      if (tls != nullptr) {
186 187 188 189
        thread_local_inclass_routine(tls);
      }
    }
  }
D
Dmitri Smirnov 已提交
190 191
}

S
sdong 已提交
192
}  // wintlscleanup
D
Dmitri Smirnov 已提交
193

S
sdong 已提交
194
#ifdef _WIN64
D
Dmitri Smirnov 已提交
195

S
sdong 已提交
196 197
#pragma comment(linker, "/include:_tls_used")
#pragma comment(linker, "/include:p_thread_callback_on_exit")
D
Dmitri Smirnov 已提交
198 199 200

#else  // _WIN64

S
sdong 已提交
201 202
#pragma comment(linker, "/INCLUDE:__tls_used")
#pragma comment(linker, "/INCLUDE:_p_thread_callback_on_exit")
D
Dmitri Smirnov 已提交
203

S
sdong 已提交
204
#endif  // _WIN64
D
Dmitri Smirnov 已提交
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219

// extern "C" suppresses C++ name mangling so we know the symbol name for the
// linker /INCLUDE:symbol pragma above.
extern "C" {

// The linker must not discard thread_callback_on_exit.  (We force a reference
// to this variable with a linker /include:symbol pragma to ensure that.) If
// this variable is discarded, the OnThreadExit function will never be called.
#ifdef _WIN64

// .CRT section is merged with .rdata on x64 so it must be constant data.
#pragma const_seg(".CRT$XLB")
// When defining a const variable, it must have external linkage to be sure the
// linker doesn't discard it.
extern const PIMAGE_TLS_CALLBACK p_thread_callback_on_exit;
S
sdong 已提交
220 221
const PIMAGE_TLS_CALLBACK p_thread_callback_on_exit =
    wintlscleanup::WinOnThreadExit;
D
Dmitri Smirnov 已提交
222 223 224 225 226 227 228 229 230 231 232 233 234 235
// Reset the default section.
#pragma const_seg()

#else  // _WIN64

#pragma data_seg(".CRT$XLB")
PIMAGE_TLS_CALLBACK p_thread_callback_on_exit = wintlscleanup::WinOnThreadExit;
// Reset the default section.
#pragma data_seg()

#endif  // _WIN64

}  // extern "C"

S
sdong 已提交
236
#endif  // OS_WIN
D
Dmitri Smirnov 已提交
237

238
void ThreadLocalPtr::InitSingletons() { ThreadLocalPtr::Instance(); }
239

L
Lei Jin 已提交
240
ThreadLocalPtr::StaticMeta* ThreadLocalPtr::Instance() {
241 242 243 244 245
  // Here we prefer function static variable instead of global
  // static variable as function static variable is initialized
  // when the function is first call.  As a result, we can properly
  // control their construction order by properly preparing their
  // first function call.
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
  //
  // Note that here we decide to make "inst" a static pointer w/o deleting
  // it at the end instead of a static variable.  This is to avoid the following
  // destruction order desester happens when a child thread using ThreadLocalPtr
  // dies AFTER the main thread dies:  When a child thread happens to use
  // ThreadLocalPtr, it will try to delete its thread-local data on its
  // OnThreadExit when the child thread dies.  However, OnThreadExit depends
  // on the following variable.  As a result, if the main thread dies before any
  // child thread happen to use ThreadLocalPtr dies, then the destruction of
  // the following variable will go first, then OnThreadExit, therefore causing
  // invalid access.
  //
  // The above problem can be solved by using thread_local to store tls_ instead
  // of using __thread.  The major difference between thread_local and __thread
  // is that thread_local supports dynamic construction and destruction of
  // non-primitive typed variables.  As a result, we can guarantee the
262 263 264
  // destruction order even when the main thread dies before any child threads.
  // However, thread_local is not supported in all compilers that accept -std=c++11
  // (e.g., eg Mac with XCode < 8. XCode 8+ supports thread_local).
265 266
  static ThreadLocalPtr::StaticMeta* inst = new ThreadLocalPtr::StaticMeta();
  return inst;
L
Lei Jin 已提交
267 268
}

269
port::Mutex* ThreadLocalPtr::StaticMeta::Mutex() { return &Instance()->mutex_; }
270

L
Lei Jin 已提交
271 272 273 274
void ThreadLocalPtr::StaticMeta::OnThreadExit(void* ptr) {
  auto* tls = static_cast<ThreadData*>(ptr);
  assert(tls != nullptr);

275 276 277 278 279
  // Use the cached StaticMeta::Instance() instead of directly calling
  // the variable inside StaticMeta::Instance() might already go out of
  // scope here in case this OnThreadExit is called after the main thread
  // dies.
  auto* inst = tls->inst;
L
Lei Jin 已提交
280 281
  pthread_setspecific(inst->pthread_key_, nullptr);

282
  MutexLock l(inst->MemberMutex());
L
Lei Jin 已提交
283 284 285 286
  inst->RemoveThreadData(tls);
  // Unref stored pointers of current thread from all instances
  uint32_t id = 0;
  for (auto& e : tls->entries) {
287
    void* raw = e.ptr.load();
L
Lei Jin 已提交
288 289 290 291 292 293 294 295 296 297 298 299
    if (raw != nullptr) {
      auto unref = inst->GetHandler(id);
      if (unref != nullptr) {
        unref(raw);
      }
    }
    ++id;
  }
  // Delete thread local structure no matter if it is Mac platform
  delete tls;
}

300
ThreadLocalPtr::StaticMeta::StaticMeta() : next_instance_id_(0), head_(this) {
L
Lei Jin 已提交
301
  if (pthread_key_create(&pthread_key_, &OnThreadExit) != 0) {
302
    abort();
L
Lei Jin 已提交
303
  }
A
Alexey Maykov 已提交
304 305 306

  // OnThreadExit is not getting called on the main thread.
  // Call through the static destructor mechanism to avoid memory leak.
N
Nate Rosenblum 已提交
307 308 309 310 311 312 313 314 315
  //
  // Caveats: ~A() will be invoked _after_ ~StaticMeta for the global
  // singleton (destructors are invoked in reverse order of constructor
  // _completion_); the latter must not mutate internal members. This
  // cleanup mechanism inherently relies on use-after-release of the
  // StaticMeta, and is brittle with respect to compiler-specific handling
  // of memory backing destructed statically-scoped objects. Perhaps
  // registering with atexit(3) would be more robust.
  //
316 317
// This is not required on Windows.
#if !defined(OS_WIN)
A
Alexey Maykov 已提交
318 319
  static struct A {
    ~A() {
D
Daniel Black 已提交
320
#ifndef ROCKSDB_SUPPORT_THREAD_LOCAL
N
Nate Rosenblum 已提交
321 322
      ThreadData* tls_ =
        static_cast<ThreadData*>(pthread_getspecific(Instance()->pthread_key_));
323
#endif
A
Alexey Maykov 已提交
324 325 326 327 328
      if (tls_) {
        OnThreadExit(tls_);
      }
    }
  } a;
329
#endif  // !defined(OS_WIN)
A
Alexey Maykov 已提交
330

L
Lei Jin 已提交
331 332
  head_.next = &head_;
  head_.prev = &head_;
D
Dmitri Smirnov 已提交
333 334

#ifdef OS_WIN
S
sdong 已提交
335
  // Share with Windows its cleanup routine and the key
D
Dmitri Smirnov 已提交
336 337 338
  wintlscleanup::thread_local_inclass_routine = OnThreadExit;
  wintlscleanup::thread_local_key = pthread_key_;
#endif
L
Lei Jin 已提交
339 340
}

341
void ThreadLocalPtr::StaticMeta::AddThreadData(ThreadData* d) {
342
  Mutex()->AssertHeld();
L
Lei Jin 已提交
343 344 345 346 347 348 349
  d->next = &head_;
  d->prev = head_.prev;
  head_.prev->next = d;
  head_.prev = d;
}

void ThreadLocalPtr::StaticMeta::RemoveThreadData(
350
    ThreadData* d) {
351
  Mutex()->AssertHeld();
L
Lei Jin 已提交
352 353 354 355 356
  d->next->prev = d->prev;
  d->prev->next = d->next;
  d->next = d->prev = d;
}

357
ThreadData* ThreadLocalPtr::StaticMeta::GetThreadLocal() {
D
Daniel Black 已提交
358
#ifndef ROCKSDB_SUPPORT_THREAD_LOCAL
S
sdong 已提交
359 360
  // Make this local variable name look like a member variable so that we
  // can share all the code below
L
Lei Jin 已提交
361 362 363 364 365 366
  ThreadData* tls_ =
      static_cast<ThreadData*>(pthread_getspecific(Instance()->pthread_key_));
#endif

  if (UNLIKELY(tls_ == nullptr)) {
    auto* inst = Instance();
367
    tls_ = new ThreadData(inst);
L
Lei Jin 已提交
368 369 370
    {
      // Register it in the global chain, needs to be done before thread exit
      // handler registration
371
      MutexLock l(Mutex());
L
Lei Jin 已提交
372 373 374 375 376 377
      inst->AddThreadData(tls_);
    }
    // Even it is not OS_MACOSX, need to register value for pthread_key_ so that
    // its exit handler will be triggered.
    if (pthread_setspecific(inst->pthread_key_, tls_) != 0) {
      {
378
        MutexLock l(Mutex());
L
Lei Jin 已提交
379 380 381
        inst->RemoveThreadData(tls_);
      }
      delete tls_;
382
      abort();
L
Lei Jin 已提交
383 384 385 386 387 388 389 390 391 392
    }
  }
  return tls_;
}

void* ThreadLocalPtr::StaticMeta::Get(uint32_t id) const {
  auto* tls = GetThreadLocal();
  if (UNLIKELY(id >= tls->entries.size())) {
    return nullptr;
  }
393
  return tls->entries[id].ptr.load(std::memory_order_acquire);
L
Lei Jin 已提交
394 395 396 397 398 399
}

void ThreadLocalPtr::StaticMeta::Reset(uint32_t id, void* ptr) {
  auto* tls = GetThreadLocal();
  if (UNLIKELY(id >= tls->entries.size())) {
    // Need mutex to protect entries access within ReclaimId
400
    MutexLock l(Mutex());
L
Lei Jin 已提交
401 402
    tls->entries.resize(id + 1);
  }
403
  tls->entries[id].ptr.store(ptr, std::memory_order_release);
L
Lei Jin 已提交
404 405 406 407 408 409
}

void* ThreadLocalPtr::StaticMeta::Swap(uint32_t id, void* ptr) {
  auto* tls = GetThreadLocal();
  if (UNLIKELY(id >= tls->entries.size())) {
    // Need mutex to protect entries access within ReclaimId
410
    MutexLock l(Mutex());
L
Lei Jin 已提交
411 412
    tls->entries.resize(id + 1);
  }
413
  return tls->entries[id].ptr.exchange(ptr, std::memory_order_acquire);
L
Lei Jin 已提交
414 415
}

416 417 418 419 420
bool ThreadLocalPtr::StaticMeta::CompareAndSwap(uint32_t id, void* ptr,
    void*& expected) {
  auto* tls = GetThreadLocal();
  if (UNLIKELY(id >= tls->entries.size())) {
    // Need mutex to protect entries access within ReclaimId
421
    MutexLock l(Mutex());
422 423
    tls->entries.resize(id + 1);
  }
424 425
  return tls->entries[id].ptr.compare_exchange_strong(
      expected, ptr, std::memory_order_release, std::memory_order_relaxed);
426 427 428 429
}

void ThreadLocalPtr::StaticMeta::Scrape(uint32_t id, autovector<void*>* ptrs,
    void* const replacement) {
430
  MutexLock l(Mutex());
L
Lei Jin 已提交
431 432 433
  for (ThreadData* t = head_.next; t != &head_; t = t->next) {
    if (id < t->entries.size()) {
      void* ptr =
434
          t->entries[id].ptr.exchange(replacement, std::memory_order_acquire);
L
Lei Jin 已提交
435 436 437 438 439 440 441
      if (ptr != nullptr) {
        ptrs->push_back(ptr);
      }
    }
  }
}

442 443 444 445 446 447 448 449 450 451 452 453
void ThreadLocalPtr::StaticMeta::Fold(uint32_t id, FoldFunc func, void* res) {
  MutexLock l(Mutex());
  for (ThreadData* t = head_.next; t != &head_; t = t->next) {
    if (id < t->entries.size()) {
      void* ptr = t->entries[id].ptr.load();
      if (ptr != nullptr) {
        func(ptr, res);
      }
    }
  }
}

454 455 456 457
uint32_t ThreadLocalPtr::TEST_PeekId() {
  return Instance()->PeekId();
}

L
Lei Jin 已提交
458
void ThreadLocalPtr::StaticMeta::SetHandler(uint32_t id, UnrefHandler handler) {
459
  MutexLock l(Mutex());
L
Lei Jin 已提交
460 461 462 463
  handler_map_[id] = handler;
}

UnrefHandler ThreadLocalPtr::StaticMeta::GetHandler(uint32_t id) {
464
  Mutex()->AssertHeld();
L
Lei Jin 已提交
465 466 467 468 469 470 471 472
  auto iter = handler_map_.find(id);
  if (iter == handler_map_.end()) {
    return nullptr;
  }
  return iter->second;
}

uint32_t ThreadLocalPtr::StaticMeta::GetId() {
473
  MutexLock l(Mutex());
L
Lei Jin 已提交
474 475 476 477 478 479 480 481 482 483
  if (free_instance_ids_.empty()) {
    return next_instance_id_++;
  }

  uint32_t id = free_instance_ids_.back();
  free_instance_ids_.pop_back();
  return id;
}

uint32_t ThreadLocalPtr::StaticMeta::PeekId() const {
484
  MutexLock l(Mutex());
L
Lei Jin 已提交
485 486 487 488 489 490 491 492 493
  if (!free_instance_ids_.empty()) {
    return free_instance_ids_.back();
  }
  return next_instance_id_;
}

void ThreadLocalPtr::StaticMeta::ReclaimId(uint32_t id) {
  // This id is not used, go through all thread local data and release
  // corresponding value
494
  MutexLock l(Mutex());
L
Lei Jin 已提交
495 496 497
  auto unref = GetHandler(id);
  for (ThreadData* t = head_.next; t != &head_; t = t->next) {
    if (id < t->entries.size()) {
498
      void* ptr = t->entries[id].ptr.exchange(nullptr);
L
Lei Jin 已提交
499 500 501 502 503 504 505 506 507 508
      if (ptr != nullptr && unref != nullptr) {
        unref(ptr);
      }
    }
  }
  handler_map_[id] = nullptr;
  free_instance_ids_.push_back(id);
}

ThreadLocalPtr::ThreadLocalPtr(UnrefHandler handler)
L
Lei Jin 已提交
509
    : id_(Instance()->GetId()) {
L
Lei Jin 已提交
510
  if (handler != nullptr) {
L
Lei Jin 已提交
511
    Instance()->SetHandler(id_, handler);
L
Lei Jin 已提交
512 513 514 515
  }
}

ThreadLocalPtr::~ThreadLocalPtr() {
L
Lei Jin 已提交
516
  Instance()->ReclaimId(id_);
L
Lei Jin 已提交
517 518 519
}

void* ThreadLocalPtr::Get() const {
L
Lei Jin 已提交
520
  return Instance()->Get(id_);
L
Lei Jin 已提交
521 522 523
}

void ThreadLocalPtr::Reset(void* ptr) {
L
Lei Jin 已提交
524
  Instance()->Reset(id_, ptr);
L
Lei Jin 已提交
525 526 527
}

void* ThreadLocalPtr::Swap(void* ptr) {
L
Lei Jin 已提交
528
  return Instance()->Swap(id_, ptr);
L
Lei Jin 已提交
529 530
}

531
bool ThreadLocalPtr::CompareAndSwap(void* ptr, void*& expected) {
L
Lei Jin 已提交
532
  return Instance()->CompareAndSwap(id_, ptr, expected);
533 534 535
}

void ThreadLocalPtr::Scrape(autovector<void*>* ptrs, void* const replacement) {
L
Lei Jin 已提交
536
  Instance()->Scrape(id_, ptrs, replacement);
L
Lei Jin 已提交
537 538
}

539 540 541 542
void ThreadLocalPtr::Fold(FoldFunc func, void* res) {
  Instance()->Fold(id_, func, res);
}

L
Lei Jin 已提交
543
}  // namespace rocksdb