The Samba-Bugzilla – Attachment 6999 Details for
Bug 8527
db_ctdb_traverse fails to traverse records created within the current transaction
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for v3-6-test
0001-s3-dbwrap-traverse-records-created-within-this-trans.patch (text/plain), 2.35 KB, created by
Gregor Beck (550 Unknown user)
on 2011-10-14 13:40:12 UTC
(
hide
)
Description:
patch for v3-6-test
Filename:
MIME Type:
Creator:
Gregor Beck (550 Unknown user)
Created:
2011-10-14 13:40:12 UTC
Size:
2.35 KB
patch
obsolete
>From 186f326371eb7f45969090e307920b635444d24d Mon Sep 17 00:00:00 2001 >From: Gregor Beck <gbeck@sernet.de> >Date: Thu, 22 Sep 2011 13:58:24 +0200 >Subject: [PATCH] s3:dbwrap: traverse records created within this transaction. > >Signed-off-by: Michael Adam <obnox@samba.org> >(cherry picked from commit a6cd71da858062a66f83775cf655b79b6c8d75e7) >--- > source3/lib/dbwrap_ctdb.c | 40 +++++++++++++++++++++++++++++++++++++++- > 1 files changed, 39 insertions(+), 1 deletions(-) > >diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c >index 468a74f..463af54 100644 >--- a/source3/lib/dbwrap_ctdb.c >+++ b/source3/lib/dbwrap_ctdb.c >@@ -1246,6 +1246,13 @@ static int traverse_persistent_callback(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DAT > return ret; > } > >+/* wrapper to use traverse_persistent_callback with dbwrap */ >+static int traverse_persistent_callback_dbwrap(struct db_record *rec, void* data) >+{ >+ return traverse_persistent_callback(NULL, rec->key, rec->value, data); >+} >+ >+ > static int db_ctdb_traverse(struct db_context *db, > int (*fn)(struct db_record *rec, > void *private_data), >@@ -1260,9 +1267,40 @@ static int db_ctdb_traverse(struct db_context *db, > state.private_data = private_data; > > if (db->persistent) { >+ struct tdb_context *ltdb = ctx->wtdb->tdb; >+ int ret; >+ > /* for persistent databases we don't need to do a ctdb traverse, > we can do a faster local traverse */ >- return tdb_traverse(ctx->wtdb->tdb, traverse_persistent_callback, &state); >+ ret = tdb_traverse(ltdb, traverse_persistent_callback, &state); >+ if (ret < 0) { >+ return ret; >+ } >+ if (ctx->transaction && ctx->transaction->m_write) { >+ /* we now have to handle keys not yet present at transaction start */ >+ struct db_context *newkeys = db_open_rbt(talloc_tos()); >+ struct ctdb_marshall_buffer *mbuf = ctx->transaction->m_write; >+ struct ctdb_rec_data *rec=NULL; >+ NTSTATUS status; >+ int i; >+ for (i=0; i<mbuf->count; i++) { >+ TDB_DATA key; >+ rec =db_ctdb_marshall_loop_next(mbuf, rec, >+ NULL, NULL, >+ &key, NULL); >+ SMB_ASSERT(rec != NULL); >+ >+ if (!tdb_exists(ltdb, key)) { >+ dbwrap_store(newkeys, key, tdb_null, 0); >+ } >+ } >+ status = dbwrap_traverse(newkeys, >+ traverse_persistent_callback_dbwrap, >+ &state); >+ ret = NT_STATUS_IS_OK(status) ? 0 : -1; >+ talloc_free(newkeys); >+ } >+ return ret; > } > > >-- >1.7.4.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
metze
:
review-
Actions:
View
Attachments on
bug 8527
:
6999
|
7003