| 508 | |
| 509 | |
| 510 | void e2e_async_compact_pattern(int n_checkpoints, fdb_config fconfig, bool deletes, bool walflush) |
| 511 | { |
| 512 | TEST_INIT(); |
| 513 | int n, i; |
| 514 | storage_t *st; |
| 515 | checkpoint_t verification_checkpoint; |
| 516 | idx_prams_t index_params; |
| 517 | fdb_kvs_config kvs_config = fdb_get_default_kvs_config(); |
| 518 | fdb_kvs_info info; |
| 519 | fdb_kvs_handle *snap_db; |
| 520 | fdb_status status; |
| 521 | thread_t tid; |
| 522 | void *thread_ret; |
| 523 | n_checkpoints = n_checkpoints * LOAD_FACTOR; |
| 524 | |
| 525 | memleak_start(); |
| 526 | |
| 527 | // init |
| 528 | rm_storage_fs(); |
| 529 | gen_index_params(&index_params); |
| 530 | memset(&verification_checkpoint, 0, sizeof(checkpoint_t)); |
| 531 | |
| 532 | // setup |
| 533 | st = init_storage(&fconfig, &fconfig, &kvs_config, |
| 534 | &index_params, &verification_checkpoint, walflush); |
| 535 | |
| 536 | // create compaction thread |
| 537 | thread_create(&tid, compact_thread, (void*)&fconfig); |
| 538 | |
| 539 | // test |
| 540 | for (n=0;n<n_checkpoints;++n){ |
| 541 | |
| 542 | #ifdef __DEBUG_E2E |
| 543 | printf("checkpoint: %d\n", n); |
| 544 | #endif |
| 545 | load_persons(st); |
| 546 | for (i=0;i<100;++i){ |
| 547 | #ifdef __DEBUG_E2E |
| 548 | printf("\n\n----%d----\n", i); |
| 549 | #endif |
| 550 | load_persons(st); |
| 551 | if (deletes){ |
| 552 | delete_persons(st); |
| 553 | } |
| 554 | e2e_fdb_commit(st->main, walflush); |
| 555 | status = fdb_get_kvs_info(st->all_docs, &info); |
| 556 | TEST_CHK(status == FDB_RESULT_SUCCESS); |
| 557 | status = fdb_snapshot_open(st->all_docs, &snap_db, info.last_seqnum); |
| 558 | TEST_CHK(status == FDB_RESULT_SUCCESS); |
| 559 | update_index(st, true); |
| 560 | verify_db(st); |
| 561 | fdb_kvs_close(snap_db); |
| 562 | } |
| 563 | } |
| 564 | |
| 565 | thread_join(tid, &thread_ret); |
| 566 | // teardown |
| 567 | e2e_fdb_shutdown(st); |
no test coverage detected