Skip to content

Commit c8643ed

Browse files
zhichao-caofacebook-github-bot
authored andcommitted
Fix multiple CF replay failure in db_bench replay (facebook#6787)
Summary: The multiple CF hash map is not passed to the multi-thread worker. When using multi-thread replay for multiple CFs, it will cause segment fault. Pass the cf_map to the argument. Pull Request resolved: facebook#6787 Test Plan: pass trace replay test. Reviewed By: yhchiang Differential Revision: D21339941 Pulled By: zhichao-cao fbshipit-source-id: 434482b492287e6722c7cd5a706f057c5ec170ce
1 parent 6acbbbf commit c8643ed

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

trace_replay/trace_replay.cc

+5
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ Status Replayer::MultiThreadReplay(uint32_t threads_num) {
321321
if (!s.ok()) {
322322
break;
323323
}
324+
ra->cf_map = &cf_map_;
324325
ra->woptions = woptions;
325326
ra->roptions = roptions;
326327

@@ -407,6 +408,7 @@ Status Replayer::ReadTrace(Trace* trace) {
407408
void Replayer::BGWorkGet(void* arg) {
408409
std::unique_ptr<ReplayerWorkerArg> ra(
409410
reinterpret_cast<ReplayerWorkerArg*>(arg));
411+
assert(ra != nullptr);
410412
auto cf_map = static_cast<std::unordered_map<uint32_t, ColumnFamilyHandle*>*>(
411413
ra->cf_map);
412414
uint32_t cf_id = 0;
@@ -429,6 +431,7 @@ void Replayer::BGWorkGet(void* arg) {
429431
void Replayer::BGWorkWriteBatch(void* arg) {
430432
std::unique_ptr<ReplayerWorkerArg> ra(
431433
reinterpret_cast<ReplayerWorkerArg*>(arg));
434+
assert(ra != nullptr);
432435
WriteBatch batch(ra->trace_entry.payload);
433436
ra->db->Write(ra->woptions, &batch);
434437
return;
@@ -437,6 +440,7 @@ void Replayer::BGWorkWriteBatch(void* arg) {
437440
void Replayer::BGWorkIterSeek(void* arg) {
438441
std::unique_ptr<ReplayerWorkerArg> ra(
439442
reinterpret_cast<ReplayerWorkerArg*>(arg));
443+
assert(ra != nullptr);
440444
auto cf_map = static_cast<std::unordered_map<uint32_t, ColumnFamilyHandle*>*>(
441445
ra->cf_map);
442446
uint32_t cf_id = 0;
@@ -461,6 +465,7 @@ void Replayer::BGWorkIterSeek(void* arg) {
461465
void Replayer::BGWorkIterSeekForPrev(void* arg) {
462466
std::unique_ptr<ReplayerWorkerArg> ra(
463467
reinterpret_cast<ReplayerWorkerArg*>(arg));
468+
assert(ra != nullptr);
464469
auto cf_map = static_cast<std::unordered_map<uint32_t, ColumnFamilyHandle*>*>(
465470
ra->cf_map);
466471
uint32_t cf_id = 0;

0 commit comments

Comments
 (0)