summaryrefslogtreecommitdiff
path: root/source3/lib/dbwrap
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-09-20 04:33:31 +0200
committerMichael Adam <obnox@samba.org>2011-09-20 07:59:20 +0200
commitda5224a9d2684c0a95f056700af4c4f7be2f93f9 (patch)
tree238bcce5d8e7d19bb6a205f3bad73b820509fa3f /source3/lib/dbwrap
parent4d30fd8c5163c92e8fdbfd1cae7088e9e010b8cd (diff)
downloadsamba-da5224a9d2684c0a95f056700af4c4f7be2f93f9.tar.gz
samba-da5224a9d2684c0a95f056700af4c4f7be2f93f9.tar.bz2
samba-da5224a9d2684c0a95f056700af4c4f7be2f93f9.zip
s3:dbwrap_ctdb: skip the internal __db_sequence_number__ key from (persistent) traverse and traverse_read
This is is used internally in the persistent transactions and should not surface. Autobuild-User: Michael Adam <obnox@samba.org> Autobuild-Date: Tue Sep 20 07:59:20 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/lib/dbwrap')
-rw-r--r--source3/lib/dbwrap/dbwrap_ctdb.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index 429f542f1a..d9fb48950c 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -1261,11 +1261,25 @@ static int traverse_persistent_callback(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DAT
struct db_record *rec;
TALLOC_CTX *tmp_ctx = talloc_new(state->db);
int ret = 0;
+
+ /*
+ * Skip the __db_sequence_number__ key:
+ * This is used for persistent transactions internally.
+ */
+ if (kbuf.dsize == strlen(CTDB_DB_SEQNUM_KEY) + 1 &&
+ strncmp((const char*)kbuf.dptr, CTDB_DB_SEQNUM_KEY,
+ strlen(CTDB_DB_SEQNUM_KEY)) == 0)
+ {
+ goto done;
+ }
+
/* we have to give them a locked record to prevent races */
rec = db_ctdb_fetch_locked(state->db, tmp_ctx, kbuf);
if (rec && rec->value.dsize > 0) {
ret = state->fn(rec, state->private_data);
}
+
+done:
talloc_free(tmp_ctx);
return ret;
}
@@ -1321,6 +1335,18 @@ static int traverse_persistent_callback_read(TDB_CONTEXT *tdb, TDB_DATA kbuf, TD
{
struct traverse_state *state = (struct traverse_state *)private_data;
struct db_record rec;
+
+ /*
+ * Skip the __db_sequence_number__ key:
+ * This is used for persistent transactions internally.
+ */
+ if (kbuf.dsize == strlen(CTDB_DB_SEQNUM_KEY) + 1 &&
+ strncmp((const char*)kbuf.dptr, CTDB_DB_SEQNUM_KEY,
+ strlen(CTDB_DB_SEQNUM_KEY)) == 0)
+ {
+ return 0;
+ }
+
rec.key = kbuf;
rec.value = dbuf;
rec.store = db_ctdb_store_deny;