| 393 | } |
| 394 | |
| 395 | void |
| 396 | hs_longrun_thread_hs::run() |
| 397 | { |
| 398 | config c = arg.sh.conf; |
| 399 | if (arg.op == 'R' || arg.op == 'N') { |
| 400 | c["port"] = to_stdstring(arg.sh.conf.get_int("hsport", 9998)); |
| 401 | } else { |
| 402 | c["port"] = to_stdstring(arg.sh.conf.get_int("hsport_wr", 9999)); |
| 403 | } |
| 404 | sockargs.set(c); |
| 405 | |
| 406 | while (arg.sh.running) { |
| 407 | if (cli.get() == 0 || !cli->stable_point()) { |
| 408 | cli = hstcpcli_i::create(sockargs); |
| 409 | if (check_hs_error("connect", 0) != 0) { |
| 410 | cli.reset(); |
| 411 | continue; |
| 412 | } |
| 413 | cli->request_buf_open_index(0, "hstestdb", "hstesttbl", "PRIMARY", |
| 414 | "k,v1,v2,v3", "k,v1,v2,v3"); |
| 415 | cli->request_send(); |
| 416 | if (check_hs_error("openindex_send", 0) != 0) { |
| 417 | cli.reset(); |
| 418 | continue; |
| 419 | } |
| 420 | size_t num_flds = 0; |
| 421 | cli->response_recv(num_flds); |
| 422 | if (check_hs_error("openindex_recv", 0) != 0) { |
| 423 | cli.reset(); |
| 424 | continue; |
| 425 | } |
| 426 | cli->response_buf_remove(); |
| 427 | } |
| 428 | const size_t rec_id = rand_record(); |
| 429 | if (arg.lock_flag) { |
| 430 | record_value& rec = *arg.sh.records[rec_id]; |
| 431 | lock_guard g(rec.lock); |
| 432 | int e = 0; |
| 433 | switch (arg.op) { |
| 434 | case 'I': |
| 435 | e = op_insert(rec); |
| 436 | break; |
| 437 | case 'D': |
| 438 | e = op_delete(rec); |
| 439 | break; |
| 440 | case 'U': |
| 441 | e = op_update(rec); |
| 442 | break; |
| 443 | case 'R': |
| 444 | e = op_read(rec); |
| 445 | break; |
| 446 | default: |
| 447 | break; |
| 448 | } |
| 449 | } else { |
| 450 | int e = 0; |
| 451 | switch (arg.op) { |
| 452 | case 'N': |
no test coverage detected