Commit e34f0439 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

closes #5146, fix test and fix bug

git-svn-id: file:///svn/toku/tokudb@44973 c7de825b-a66e-492c-adef-691d508d4ae1
parent 0183c086
......@@ -612,9 +612,23 @@ static int toku_recover_xstillopenprepared (struct logtype_xstillopenprepared *l
l->crc,
l->len,
renv);
if (r==0)
return toku_txn_prepare_txn(txn, l->xa_xid);
else
if (r != 0) {
goto exit;
}
switch (renv->ss.ss) {
case FORWARD_BETWEEN_CHECKPOINT_BEGIN_END: {
r = toku_txn_prepare_txn(txn, l->xa_xid);
break;
}
case FORWARD_NEWER_CHECKPOINT_END: {
assert(txn->state == TOKUTXN_PREPARING);
break;
}
default: {
assert(0);
}
}
exit:
return r;
}
......
......@@ -86,6 +86,15 @@ static void run_recover (void) {
int r;
r = db_env_create(&env, 0); CKERR(r);
r = env->open(env, ENVDIR, envflags + DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
// recover the prepared transaction and commit it
DB_PREPLIST l[1];
long count=-1;
CKERR(env->txn_recover(env, l, 1, &count, DB_FIRST));
printf("%s:%d count=%ld\n", __FILE__, __LINE__, count);
assert(count==1);
assert(l[0].gid[0]==42);
r = l->txn->commit(l->txn, 0);
CKERR(r);
r = env->close(env, 0); CKERR(r);
exit(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment