MCPcopy Create free account
hub / github.com/DeNA/HandlerSocket-Plugin-for-MySQL / op_delete

Method op_delete

client/hslongrun.cpp:530–581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

528}
529
530int
531hs_longrun_thread_hs::op_delete(record_value& rec)
532{
533 const std::string k = rec.key;
534 const string_ref op_ref("=", 1);
535 const string_ref op_args[1] = {
536 to_string_ref(k),
537 };
538 const string_ref modop_ref("D", 1);
539 cli->request_buf_exec_generic(0, op_ref, op_args, 1, 1, 0,
540 modop_ref, 0, 0, 0, 0);
541 cli->request_send();
542 if (check_hs_error("op_delete_send", &rec) != 0) { return 1; }
543 size_t numflds = 0;
544 cli->response_recv(numflds);
545 if (check_hs_error("op_delete_recv", &rec) != 0) { return 1; }
546 const string_ref *row = cli->get_next_row();
547 const bool op_success = (numflds > 0 && row != 0 &&
548 to_string(row[0]) == "1");
549 int ret = 0;
550 if (!rec.unknown_state) {
551 if (!rec.deleted && !op_success) {
552 ++stat.verify_error_count;
553 if (arg.sh.verbose > 0) {
554 fprintf(stderr, "VERIFY_ERROR: %s wid=%d k=%s "
555 "unexpected_delete_failure\n",
556 arg.worker_type.c_str(), arg.id, k.c_str());
557 }
558 ret = 1;
559 } else if (rec.deleted && op_success) {
560 ++stat.verify_error_count;
561 if (arg.sh.verbose > 0) {
562 fprintf(stderr, "VERIFY_ERROR: %s wid=%d k=%s "
563 "unexpected_delete_success\n",
564 arg.worker_type.c_str(), arg.id, k.c_str());
565 }
566 ret = 1;
567 }
568 }
569 cli->response_buf_remove();
570 if (op_success) {
571 rec.deleted = true;
572 if (ret == 0 && !rec.unknown_state) {
573 ++stat.success_count;
574 }
575 rec.unknown_state = false;
576 }
577 if (arg.sh.verbose >= 100 && ret == 0) {
578 fprintf(stderr, "HS_DELETE %s\n", k.c_str());
579 }
580 return ret;
581}
582
583int
584hs_longrun_thread_hs::op_update(record_value& rec)

Callers

nothing calls this directly

Calls 7

to_string_refFunction · 0.85
to_stringFunction · 0.85
request_sendMethod · 0.80
response_recvMethod · 0.80
get_next_rowMethod · 0.80
response_buf_removeMethod · 0.80

Tested by

no test coverage detected