From f57a54a301d07c52583dbeea8a1eb1db7d75b303 Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Mon, 25 Apr 2016 21:00:33 +0300 Subject: [PATCH] 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 --- mtest1.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mtest1.c b/mtest1.c index 68e108a6..e0b00b01 100644 --- a/mtest1.c +++ b/mtest1.c @@ -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;