int Slave::proc_copy(const Binlog &log, const std::vector<Bytes> &req){ switch(log.cmd()){ case BinlogCommand::BEGIN: log_info("copy begin"); break; case BinlogCommand::END: log_info("copy end, copy_count: %" PRIu64 ", last_seq: %" PRIu64 ", seq: %" PRIu64, copy_count, this->last_seq, log.seq()); if (!this->is_mirror && this->last_seq > 0) { // no master ssdb->get_binlogs()->update(this->last_seq, BinlogType::NOOP, BinlogCommand::NONE, "", ""); ssdb->get_binlogs()->set_last_seq(this->last_seq); } this->last_key = ""; this->save_status(); status = SYNC; break; default: if (this->is_mirror) { // if master, don't set no_log return proc_sync(log, req); } else { // unable to support multi replications bool enabled = ssdb->get_binlogs()->is_enabled(); ssdb->get_binlogs()->set_enabled(false); // disabled binlog int result = proc_sync(log, req); ssdb->get_binlogs()->set_enabled(enabled); return result; } } return 0; }
int Slave::proc_copy(const Binlog &log, const std::vector<Bytes> &req){ switch(log.cmd()){ case BinlogCommand::BEGIN: log_info("copy begin"); log_info("start flushdb..."); this->last_seq = 0; this->last_key = ""; this->save_status(); ssdb->flushdb(); log_info("end flushdb."); break; case BinlogCommand::END: log_info("copy end, copy_count: %" PRIu64 ", last_seq: %" PRIu64 ", seq: %" PRIu64, copy_count, this->last_seq, log.seq()); this->status = SYNC; this->last_key = ""; this->save_status(); break; default: if(++copy_count % 1000 == 1){ log_info("copy_count: %" PRIu64 ", last_seq: %" PRIu64 ", seq: %" PRIu64 "", copy_count, this->last_seq, log.seq()); } return proc_sync(log, req); break; } return 0; }
int Slave::proc_copy(const Binlog &log, const std::vector<Bytes> &req){ switch(log.cmd()){ case BinlogCommand::BEGIN: log_info("copy begin"); break; case BinlogCommand::END: log_info("copy end, step in sync"); this->last_key = ""; this->save_status(); break; default: return proc_sync(log, req); break; } return 0; }
int Slave::proc_copy(const Binlog &log, const std::vector<Bytes> &req){ switch(log.cmd()){ case BinlogCommand::BEGIN: log_info("copy begin"); break; case BinlogCommand::END: log_info("copy end, copy_count: %" PRIu64 ", last_seq: %" PRIu64 ", seq: %" PRIu64, copy_count, this->last_seq, log.seq()); this->last_key = ""; this->save_status(); break; default: return proc_sync(log, req); break; } return 0; }