mdbx: fix mtest1 for backlog-autosync.

After the ae324984cbdf6297f63586dd0fae286909be23dd steady
checkpoint(s) could be created automatically while reserve a
pages for deletion from freeDB.

In other words, some (beginning of list) of modify-ops were
"unexpectedly" synced to disk, despite of the no-sync closing
of DB by the mtest1 - therefore testcase could fail.

Now required rollback at least one of transactions after the
last explicit sync, but not all of ones.

Change-Id: I6ca6dba8a62a30f12f370fa91325efdf4fe35772
This commit is contained in:
Leo Yuriev 2016-04-25 21:00:33 +03:00
parent bfd82b5830
commit f57a54a301

View File

@ -120,22 +120,21 @@ int main(int argc,char * argv[])
mdb_txn_abort(txn);
mdb_env_sync(env, 1);
j=0;
int deleted = 0;
key.mv_data = sval;
for (i= count - 1; i > -1; i-= (rand()%5)) {
j++;
for (i = count - 1; i > -1; i -= (rand()%5)) {
txn=NULL;
E(mdb_txn_begin(env, NULL, 0, &txn));
sprintf(sval, "%03x ", values[i]);
if (RES(MDB_NOTFOUND, mdb_del(txn, dbi, &key, NULL))) {
j--;
mdb_txn_abort(txn);
} else {
E(mdb_txn_commit(txn));
deleted++;
}
}
free(values);
printf("Deleted %d values\n", j);
printf("Deleted %d values\n", deleted);
printf("check-preset-b.cursor-next\n");
E(mdb_env_stat(env, &mst));
@ -149,7 +148,7 @@ int main(int argc,char * argv[])
++present_b;
}
CHECK(rc == MDB_NOTFOUND, "mdb_cursor_get");
CHECK(present_b == present_a - j, "mismatch");
CHECK(present_b == present_a - deleted, "mismatch");
printf("check-preset-b.cursor-prev\n");
j = 1;
@ -184,7 +183,8 @@ int main(int argc,char * argv[])
++present_c;
}
CHECK(rc == MDB_NOTFOUND, "mdb_cursor_get");
CHECK(present_c == present_a, "mismatch");
printf("Rolled back %d deletion(s)\n", present_c - (present_a - deleted));
CHECK(present_c > present_a - deleted, "mismatch");
printf("check-preset-d.cursor-prev\n");
j = 1;