mirror of
https://github.com/MariaDB/server.git
synced 2025-01-23 15:24:16 +01:00
closes[t:2588] fix the loader create close test
git-svn-id: file:///svn/toku/tokudb@20298 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
f0b095543d
commit
11897a5141
2 changed files with 45 additions and 23 deletions
|
@ -2205,6 +2205,9 @@ static int toku_brt_loader_close_internal (BRTLOADER bl)
|
||||||
{
|
{
|
||||||
BL_TRACE(blt_do_put);
|
BL_TRACE(blt_do_put);
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
if (bl->N == 0)
|
||||||
|
result = update_progress(PROGRESS_MAX, bl, "done");
|
||||||
|
else {
|
||||||
int remaining_progress = PROGRESS_MAX;
|
int remaining_progress = PROGRESS_MAX;
|
||||||
for (int i=0; i<bl->N; i++) {
|
for (int i=0; i<bl->N; i++) {
|
||||||
char * fname_in_cwd = toku_cachetable_get_fname_in_cwd(bl->cachetable, bl->new_fnames_in_env[i]);
|
char * fname_in_cwd = toku_cachetable_get_fname_in_cwd(bl->cachetable, bl->new_fnames_in_env[i]);
|
||||||
|
@ -2225,6 +2228,7 @@ static int toku_brt_loader_close_internal (BRTLOADER bl)
|
||||||
result = update_progress(0, bl, "did index");
|
result = update_progress(0, bl, "did index");
|
||||||
if (result) goto error;
|
if (result) goto error;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
invariant(bl->file_infos.n_files_open == 0);
|
invariant(bl->file_infos.n_files_open == 0);
|
||||||
invariant(bl->file_infos.n_files_extant == 0);
|
invariant(bl->file_infos.n_files_extant == 0);
|
||||||
invariant(bl->progress == PROGRESS_MAX);
|
invariant(bl->progress == PROGRESS_MAX);
|
||||||
|
|
|
@ -14,7 +14,7 @@ static int put_multiple_generate(DB *UU(dest_db), DB *UU(src_db), DBT *UU(dest_k
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void loader_open_abort(void) {
|
static void loader_open_abort(int ndb) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
r = system("rm -rf " ENVDIR); CKERR(r);
|
r = system("rm -rf " ENVDIR); CKERR(r);
|
||||||
|
@ -28,16 +28,32 @@ static void loader_open_abort(void) {
|
||||||
r = env->open(env, ENVDIR, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
|
r = env->open(env, ENVDIR, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
|
||||||
env->set_errfile(env, stderr);
|
env->set_errfile(env, stderr);
|
||||||
|
|
||||||
|
DB *dbs[ndb];
|
||||||
|
uint32_t db_flags[ndb];
|
||||||
|
uint32_t dbt_flags[ndb];
|
||||||
|
for (int i = 0; i < ndb; i++) {
|
||||||
|
db_flags[i] = DB_NOOVERWRITE;
|
||||||
|
dbt_flags[i] = 0;
|
||||||
|
r = db_create(&dbs[i], env, 0); CKERR(r);
|
||||||
|
char name[32];
|
||||||
|
sprintf(name, "db%d", i);
|
||||||
|
r = dbs[i]->open(dbs[i], NULL, name, NULL, DB_BTREE, DB_CREATE, 0666); CKERR(r);
|
||||||
|
}
|
||||||
|
|
||||||
DB_TXN *txn;
|
DB_TXN *txn;
|
||||||
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
|
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
|
||||||
|
|
||||||
DB_LOADER *loader;
|
DB_LOADER *loader;
|
||||||
r = env->create_loader(env, txn, &loader, NULL, 0, NULL, NULL, NULL, loader_flags); CKERR(r);
|
r = env->create_loader(env, txn, &loader, dbs[0], ndb, dbs, db_flags, dbt_flags, loader_flags); CKERR(r);
|
||||||
|
|
||||||
r = loader->close(loader); CKERR(r);
|
r = loader->close(loader); CKERR(r);
|
||||||
|
|
||||||
r = txn->commit(txn, 0); CKERR(r);
|
r = txn->commit(txn, 0); CKERR(r);
|
||||||
|
|
||||||
|
for (int i = 0; i < ndb; i++) {
|
||||||
|
r = dbs[i]->close(dbs[i], 0); CKERR(r);
|
||||||
|
}
|
||||||
|
|
||||||
r = env->close(env, 0); CKERR(r);
|
r = env->close(env, 0); CKERR(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +65,7 @@ static void do_args(int argc, char * const argv[]) {
|
||||||
if (strcmp(argv[0], "-h")==0) {
|
if (strcmp(argv[0], "-h")==0) {
|
||||||
resultcode=0;
|
resultcode=0;
|
||||||
do_usage:
|
do_usage:
|
||||||
fprintf(stderr, "Usage: -h -c -d <num_dbs> -r <num_rows>\n%s\n", cmd);
|
fprintf(stderr, "Usage: %s -h -v -q -p\n", cmd);
|
||||||
exit(resultcode);
|
exit(resultcode);
|
||||||
} else if (strcmp(argv[0], "-v")==0) {
|
} else if (strcmp(argv[0], "-v")==0) {
|
||||||
verbose++;
|
verbose++;
|
||||||
|
@ -70,6 +86,8 @@ static void do_args(int argc, char * const argv[]) {
|
||||||
|
|
||||||
int test_main(int argc, char * const *argv) {
|
int test_main(int argc, char * const *argv) {
|
||||||
do_args(argc, argv);
|
do_args(argc, argv);
|
||||||
loader_open_abort();
|
loader_open_abort(0);
|
||||||
|
loader_open_abort(1);
|
||||||
|
loader_open_abort(2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue