| 460 | } |
| 461 | |
| 462 | int |
| 463 | hs_longrun_thread_hs::op_insert(record_value& rec) |
| 464 | { |
| 465 | const std::string k = rec.key; |
| 466 | const std::string v1 = "iv1_" + k + "_" + to_stdstring(arg.id); |
| 467 | const std::string v2 = "iv2_" + k + "_" + to_stdstring(arg.id); |
| 468 | const std::string v3 = "iv3_" + k + "_" + to_stdstring(arg.id); |
| 469 | const string_ref op_ref("+", 1); |
| 470 | const string_ref op_args[4] = { |
| 471 | to_string_ref(k), |
| 472 | to_string_ref(v1), |
| 473 | to_string_ref(v2), |
| 474 | to_string_ref(v3) |
| 475 | }; |
| 476 | cli->request_buf_exec_generic(0, op_ref, op_args, 4, 1, 0, |
| 477 | string_ref(), 0, 0, 0, 0); |
| 478 | cli->request_send(); |
| 479 | if (check_hs_error("op_insert_send", &rec) != 0) { return 1; } |
| 480 | size_t numflds = 0; |
| 481 | cli->response_recv(numflds); |
| 482 | if (arg.sh.verbose > 10) { |
| 483 | const string_ref *row = cli->get_next_row(); |
| 484 | fprintf(stderr, "HS op=+ errrcode=%d errmess=[%s]\n", cli->get_error_code(), |
| 485 | row ? to_string(row[0]).c_str() : ""); |
| 486 | } |
| 487 | const bool op_success = cli->get_error_code() == 0; |
| 488 | int ret = 0; |
| 489 | if (!rec.unknown_state) { |
| 490 | if (rec.deleted && !op_success) { |
| 491 | ++stat.verify_error_count; |
| 492 | if (arg.sh.verbose > 0) { |
| 493 | fprintf(stderr, "VERIFY_ERROR: %s wid=%d k=%s " |
| 494 | "unexpected_insert_failure\n", |
| 495 | arg.worker_type.c_str(), arg.id, k.c_str()); |
| 496 | } |
| 497 | ret = 1; |
| 498 | } else if (!rec.deleted && op_success) { |
| 499 | ++stat.verify_error_count; |
| 500 | if (arg.sh.verbose > 0) { |
| 501 | fprintf(stderr, "VERIFY_ERROR: %s wid=%d k=%s " |
| 502 | "unexpected_insert_success\n", |
| 503 | arg.worker_type.c_str(), arg.id, k.c_str()); |
| 504 | } |
| 505 | ret = 1; |
| 506 | } |
| 507 | } else { |
| 508 | ++stat.unknown_count; |
| 509 | } |
| 510 | if (op_success) { |
| 511 | rec.values.resize(4); |
| 512 | rec.values[0] = k; |
| 513 | rec.values[1] = v1; |
| 514 | rec.values[2] = v2; |
| 515 | rec.values[3] = v3; |
| 516 | rec.deleted = false; |
| 517 | if (arg.sh.verbose >= 100 && ret == 0) { |
| 518 | fprintf(stderr, "HS_INSERT %s %s %s %s\n", k.c_str(), v1.c_str(), |
| 519 | v2.c_str(), v3.c_str()); |
nothing calls this directly
no test coverage detected