diff options
-rw-r--r-- | lib/tdb2/private.h | 1 | ||||
-rw-r--r-- | lib/tdb2/tdb1.h | 2 | ||||
-rw-r--r-- | lib/tdb2/traverse.c | 6 |
3 files changed, 7 insertions, 2 deletions
diff --git a/lib/tdb2/private.h b/lib/tdb2/private.h index 71ef07538ec..f4fba85d3ef 100644 --- a/lib/tdb2/private.h +++ b/lib/tdb2/private.h @@ -693,6 +693,7 @@ enum TDB_ERROR tdb1_parse_record(struct tdb_context *tdb, TDB_DATA key, void *private_data); void tdb1_increment_seqnum_nonblock(struct tdb_context *tdb); int tdb1_get_seqnum(struct tdb_context *tdb); +int tdb1_wipe_all(struct tdb_context *tdb); /* tdb1_transaction.c: */ int tdb1_transaction_start(struct tdb_context *tdb); diff --git a/lib/tdb2/tdb1.h b/lib/tdb2/tdb1.h index 90cd7fa14ab..3d9fcd70a46 100644 --- a/lib/tdb2/tdb1.h +++ b/lib/tdb2/tdb1.h @@ -42,8 +42,6 @@ uint64_t tdb1_incompatible_hash(const void *key, size_t len, uint64_t seed, void /* @} ******************************************************************/ -/* wipe and repack */ -int tdb1_wipe_all(struct tdb_context *tdb); int tdb1_repack(struct tdb_context *tdb); extern TDB_DATA tdb1_null; diff --git a/lib/tdb2/traverse.c b/lib/tdb2/traverse.c index b27550032f3..b1897ce1b8b 100644 --- a/lib/tdb2/traverse.c +++ b/lib/tdb2/traverse.c @@ -115,6 +115,12 @@ enum TDB_ERROR tdb_wipe_all(struct tdb_context *tdb) enum TDB_ERROR ecode; int64_t count; + if (tdb->flags & TDB_VERSION1) { + if (tdb1_wipe_all(tdb) == -1) + return tdb->last_error; + return TDB_SUCCESS; + } + ecode = tdb_allrecord_lock(tdb, F_WRLCK, TDB_LOCK_WAIT, false); if (ecode != TDB_SUCCESS) return tdb->last_error = ecode; |