Skip to content

Commit

Permalink
binlog dispath by name when no key servered commadn
Browse files Browse the repository at this point in the history
  • Loading branch information
CatKang committed May 6, 2016
1 parent 457fe99 commit 069689e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/pika_binlog_bgworker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void BinlogBGWorker::DoBinlogBG(void* arg) {
// No need lock on readonly mode
// Since the binlog task is dispatched by hash code of key
// That is to say binlog with same key will be dispatched to same thread and execute sequencly
if (!is_readonly) {
if (!is_readonly && argv.size() >= 2) {
g_pika_server->mutex_record_.Lock(argv[1]);
}

Expand Down Expand Up @@ -68,7 +68,7 @@ void BinlogBGWorker::DoBinlogBG(void* arg) {
pthread_rwlock_unlock(g_pika_server->rwlock());
}

if (!is_readonly) {
if (!is_readonly && argv.size() >= 2) {
g_pika_server->mutex_record_.Unlock(argv[1]);
}
if (g_pika_conf->slowlog_slower_than() >= 0) {
Expand Down
3 changes: 2 additions & 1 deletion src/pika_master_conn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ int PikaMasterConn::DealMessage() {
}

PikaCmdArgsType *argv = new PikaCmdArgsType(argv_);
g_pika_server->DispatchBinlogBG(argv_[1], argv, raw_args_,
std::string dispatch_key = argv_.size() >= 2 ? argv_[1] : argv_[0];
g_pika_server->DispatchBinlogBG(dispatch_key, argv, raw_args_,
serial, is_readonly);
// memcpy(wbuf_ + wbuf_len_, res.data(), res.size());
// wbuf_len_ += res.size();
Expand Down

0 comments on commit 069689e

Please sign in to comment.