[SCM] Samba Shared Repository - branch v3-6-test updated
Karolin Seeger
kseeger at samba.org
Sat Feb 18 11:44:57 MST 2012
The branch, v3-6-test has been updated
via fa17a55 s3:dbwrap_ctdb: return the number of records in db_ctdb_traverse() for persistent dbs
via b0ac125 s3-dbwrap_ctdb: fix the build.
via fc5ba7a s3:dbwrap: traverse records created within this transaction.
via 9c5bee9 s3:dbwrap: change the dbwrap_traverse() wrapper to return the count in an additional parameter (similar to commit 8f098a635f713652c4846d71e24c0a199c25b8b7)
from 16f900c Allow vfs_aio_pthread to build as a static module.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test
- Log -----------------------------------------------------------------
commit fa17a5518ff050234cccc1d35ec3699202a3e941
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Oct 14 16:11:06 2011 +0200
s3:dbwrap_ctdb: return the number of records in db_ctdb_traverse() for persistent dbs
metze
Autobuild-User: Stefan Metzmacher <metze at samba.org>
Autobuild-Date: Fri Oct 14 20:59:37 CEST 2011 on sn-devel-104
(cherry picked from commit 15b8efeae3b0133ae60a8ce582e4ca4d4dbe6bb1)
The last 4 patches address bug #8527 (db_ctdb_traverse fails to traverse records
created within the current transaction).
commit b0ac12539673a2e6b19e52f36822850b40d9dfae
Author: Günther Deschner <gd at samba.org>
Date: Wed Oct 12 11:48:55 2011 +0200
s3-dbwrap_ctdb: fix the build.
Michael, please check.
Guenther
Autobuild-User: Günther Deschner <gd at samba.org>
Autobuild-Date: Wed Oct 12 15:25:56 CEST 2011 on sn-devel-104
(cherry picked from commit fc320551d84508371ab1c082752515d538648f49)
commit fc5ba7a9cc0e3fd76edb85be72406d0e77788dab
Author: Gregor Beck <gbeck at sernet.de>
Date: Thu Sep 22 13:58:24 2011 +0200
s3:dbwrap: traverse records created within this transaction.
Signed-off-by: Michael Adam <obnox at samba.org>
(cherry picked from commit a6cd71da858062a66f83775cf655b79b6c8d75e7)
commit 9c5bee9f731b70b0a01248f52adf7622025591c2
Author: Michael Adam <obnox at samba.org>
Date: Fri Oct 14 16:33:00 2011 +0200
s3:dbwrap: change the dbwrap_traverse() wrapper to return the count in an additional parameter (similar to commit 8f098a635f713652c4846d71e24c0a199c25b8b7)
Signed-off-by: Stefan Metzmacher <metze at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/include/dbwrap.h | 3 +-
source3/lib/dbwrap_ctdb.c | 54 ++++++++++++++++++++++++++++++++++++++-
source3/lib/dbwrap_util.c | 13 +++++++--
source3/utils/net_idmap_check.c | 6 ++--
4 files changed, 68 insertions(+), 8 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/dbwrap.h b/source3/include/dbwrap.h
index d657ee7..8938880 100644
--- a/source3/include/dbwrap.h
+++ b/source3/include/dbwrap.h
@@ -134,7 +134,8 @@ NTSTATUS dbwrap_trans_traverse(struct db_context *db,
void *private_data);
NTSTATUS dbwrap_traverse(struct db_context *db,
int (*f)(struct db_record*, void*),
- void *private_data);
+ void *private_data,
+ int *count);
NTSTATUS dbwrap_delete_bystring_upper(struct db_context *db, const char *key);
NTSTATUS dbwrap_store_bystring_upper(struct db_context *db, const char *key,
diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c
index 468a74f..2c68f21 100644
--- a/source3/lib/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap_ctdb.c
@@ -22,6 +22,7 @@
#include "system/filesys.h"
#include "lib/util/tdb_wrap.h"
#include "util_tdb.h"
+
#ifdef CLUSTER_SUPPORT
#include "ctdb.h"
#include "ctdb_private.h"
@@ -1246,6 +1247,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 +1268,53 @@ 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;
+ int count = 0;
+
+ if (newkeys == NULL) {
+ return -1;
+ }
+
+ 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,
+ &count);
+ talloc_free(newkeys);
+ if (!NT_STATUS_IS_OK(status)) {
+ return -1;
+ }
+ ret += count;
+ }
+ return ret;
}
diff --git a/source3/lib/dbwrap_util.c b/source3/lib/dbwrap_util.c
index 365f0a0..1e28f84 100644
--- a/source3/lib/dbwrap_util.c
+++ b/source3/lib/dbwrap_util.c
@@ -446,14 +446,21 @@ NTSTATUS dbwrap_trans_traverse(struct db_context *db,
NTSTATUS dbwrap_traverse(struct db_context *db,
int (*f)(struct db_record*, void*),
- void *private_data)
+ void *private_data,
+ int *count)
{
int ret = db->traverse(db, f, private_data);
- return (ret == -1) ? NT_STATUS_INTERNAL_DB_CORRUPTION : NT_STATUS_OK;
-}
+ if (ret < 0) {
+ return NT_STATUS_INTERNAL_DB_CORRUPTION;
+ }
+ if (count != NULL) {
+ *count = ret;
+ }
+ return NT_STATUS_OK;
+}
NTSTATUS dbwrap_delete_bystring_upper(struct db_context *db, const char *key)
{
diff --git a/source3/utils/net_idmap_check.c b/source3/utils/net_idmap_check.c
index e406a65..25997b1 100644
--- a/source3/utils/net_idmap_check.c
+++ b/source3/utils/net_idmap_check.c
@@ -890,7 +890,7 @@ static bool check_do_checks(struct check_ctx* ctx)
return false;
}
- status = dbwrap_traverse(ctx->db, traverse_check, ctx);
+ status = dbwrap_traverse(ctx->db, traverse_check, ctx, NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("failed to traverse %s\n", ctx->name));
@@ -927,7 +927,7 @@ static bool check_transaction_cancel(struct check_ctx* ctx) {
static void check_diff_list(struct check_ctx* ctx) {
- NTSTATUS status = dbwrap_traverse(ctx->diff, traverse_print_diff, ctx);
+ NTSTATUS status = dbwrap_traverse(ctx->diff, traverse_print_diff, ctx, NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("failed to traverse diff\n"));
@@ -963,7 +963,7 @@ static bool check_commit(struct check_ctx* ctx)
return false;
}
- status = dbwrap_traverse(ctx->diff, traverse_commit, ctx);
+ status = dbwrap_traverse(ctx->diff, traverse_commit, ctx, NULL);
if (!NT_STATUS_IS_OK(status)) {
check_transaction_cancel(ctx);
--
Samba Shared Repository
More information about the samba-cvs
mailing list