Commit de706bd5 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 3d9bf660
...@@ -612,10 +612,24 @@ static int toku_recover_xstillopenprepared (struct logtype_xstillopenprepared *l ...@@ -612,10 +612,24 @@ static int toku_recover_xstillopenprepared (struct logtype_xstillopenprepared *l
l->crc, l->crc,
l->len, l->len,
renv); renv);
if (r==0) if (r != 0) {
return toku_txn_prepare_txn(txn, l->xa_xid); goto exit;
else }
return r; 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;
} }
static int toku_recover_backward_xstillopen (struct logtype_xstillopen *UU(l), RECOVER_ENV UU(renv)) { static int toku_recover_backward_xstillopen (struct logtype_xstillopen *UU(l), RECOVER_ENV UU(renv)) {
......
...@@ -86,6 +86,15 @@ static void run_recover (void) { ...@@ -86,6 +86,15 @@ static void run_recover (void) {
int r; int r;
r = db_env_create(&env, 0); CKERR(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); 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); r = env->close(env, 0); CKERR(r);
exit(0); 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