* perform many fdb features against concurrent handlers * to verify robustness of db. this pattern is qualified by * completion without faults data corrections and has relaxed error handling. */
| 664 | * completion without faults data corrections and has relaxed error handling. |
| 665 | */ |
| 666 | void e2e_robust_pattern(fdb_config fconfig) |
| 667 | { |
| 668 | |
| 669 | int n, i; |
| 670 | int n_writers = 10; |
| 671 | int n_scanners = 10; |
| 672 | storage_t **st = alca(storage_t *, n_writers); |
| 673 | storage_t **st2 = alca(storage_t *, n_writers); |
| 674 | checkpoint_t *verification_checkpoint = alca(checkpoint_t, n_writers); |
| 675 | idx_prams_t *index_params = alca(idx_prams_t, n_writers); |
| 676 | fdb_kvs_config kvs_config = fdb_get_default_kvs_config(); |
| 677 | thread_t *tid_sc = alca(thread_t, n_scanners); |
| 678 | void **thread_ret_sc = alca(void *, n_scanners); |
| 679 | thread_t *tid_wr = alca(thread_t, n_writers); |
| 680 | void **thread_ret_wr = alca(void *, n_writers); |
| 681 | fdb_kvs_handle **scan_kv = alca(fdb_kvs_handle *, n_scanners); |
| 682 | thread_t c_tid, i_tid; |
| 683 | void *c_ret, *i_ret; |
| 684 | |
| 685 | memleak_start(); |
| 686 | |
| 687 | // init |
| 688 | rm_storage_fs(); |
| 689 | |
| 690 | // init storage handles |
| 691 | // the nth writer is commit handler |
| 692 | for (i=0;i<n_writers;++i) { |
| 693 | gen_index_params(&index_params[i]); |
| 694 | memset(&verification_checkpoint[i], 0, sizeof(checkpoint_t)); |
| 695 | st[i] = init_storage(&fconfig, &fconfig, &kvs_config, |
| 696 | &index_params[i], &verification_checkpoint[i], true); |
| 697 | st2[i] = init_storage(&fconfig, &fconfig, &kvs_config, |
| 698 | &index_params[i], &verification_checkpoint[i], true); |
| 699 | memcpy(st2[i]->keyspace, st[i]->keyspace, KEYSPACE_LEN); |
| 700 | } |
| 701 | |
| 702 | // load init data |
| 703 | for (i=0;i<100;++i) { |
| 704 | load_persons(st[0]); |
| 705 | } |
| 706 | |
| 707 | thread_create(&c_tid, compact_thread, (void*)&fconfig); |
| 708 | thread_create(&i_tid, iterate_thread, (void*)&fconfig); |
| 709 | for (n=0;n<10;++n) { |
| 710 | // start writer threads |
| 711 | for (i=0;i<n_writers-1;++i) { |
| 712 | st[i]->verify_set = false; |
| 713 | thread_create(&tid_wr[i], writer_thread, (void*)st[i]); |
| 714 | } |
| 715 | |
| 716 | |
| 717 | // start scanner threads |
| 718 | for (i=0;i<n_scanners;++i) { |
| 719 | scan_kv[i] = scan(st2[i], NULL); |
| 720 | thread_create(&tid_sc[i], scan_thread, (void*)scan_kv[i]); |
| 721 | } |
| 722 | |
| 723 | e2e_fdb_commit(st[n_writers-1]->main, true); |
no test coverage detected