MCPcopy Create free account
hub / github.com/couchbase/forestdb / e2e_async_compact_pattern

Function e2e_async_compact_pattern

tests/e2e/e2etest.cc:510–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508
509
510void 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);

Callers 1

Calls 11

memleak_startFunction · 0.85
rm_storage_fsFunction · 0.85
gen_index_paramsFunction · 0.85
init_storageFunction · 0.85
load_personsFunction · 0.85
delete_personsFunction · 0.85
e2e_fdb_commitFunction · 0.85
update_indexFunction · 0.85
verify_dbFunction · 0.85
e2e_fdb_shutdownFunction · 0.85
memleak_endFunction · 0.85

Tested by

no test coverage detected