From d78ea3e34abd30fb388c4cc39e12611e211416a6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 22 Sep 2005 04:16:46 +0000 Subject: r10406: added --nosync option to all ldb tools, so that you can control if transactions are synchronous or not on the command line. add LDB_FLG_NOSYNC flag to ldb_connect() so we can make our temporary ldb databases non-synchronous (This used to be commit dba41164e0c52f1e4351bd9057b16661cee3a822) --- source4/lib/ldb/tools/cmdline.c | 7 ++++++- source4/lib/ldb/tools/cmdline.h | 1 + source4/lib/ldb/tools/ldbtest.c | 7 ++++++- 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'source4/lib/ldb/tools') diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c index fb0292b7d9..7cdecc334f 100644 --- a/source4/lib/ldb/tools/cmdline.c +++ b/source4/lib/ldb/tools/cmdline.c @@ -55,6 +55,7 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const { "num-searches", 0, POPT_ARG_INT, &options.num_searches, 0, "number of test searches", NULL }, { "num-records", 0, POPT_ARG_INT, &options.num_records, 0, "number of test records", NULL }, { "all", 'a', POPT_ARG_NONE, &options.all_records, 0, "dn=*", NULL }, + { "nosync", 0, POPT_ARG_NONE, &options.nosync, 0, "non-synchronous transactions", NULL }, { "sorted", 'S', POPT_ARG_NONE, &options.sorted, 0, "sort attributes", NULL }, { "sasl-mechanism", 0, POPT_ARG_STRING, &options.sasl_mechanism, 0, "choose SASL mechanism", "MECHANISM" }, { "input", 'I', POPT_ARG_STRING, &options.input, 0, "Input File", "Input" }, @@ -159,7 +160,11 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const } if (strcmp(ret->url, "NONE") != 0) { - if (ldb_connect(ldb, ret->url, 0, ret->options) != 0) { + int flags = 0; + if (options.nosync) { + flags |= LDB_FLG_NOSYNC; + } + if (ldb_connect(ldb, ret->url, flags, ret->options) != 0) { fprintf(stderr, "Failed to connect to %s - %s\n", ret->url, ldb_errstring(ldb)); goto failed; diff --git a/source4/lib/ldb/tools/cmdline.h b/source4/lib/ldb/tools/cmdline.h index daf9c06f42..9aaf37a978 100644 --- a/source4/lib/ldb/tools/cmdline.h +++ b/source4/lib/ldb/tools/cmdline.h @@ -34,6 +34,7 @@ struct ldb_cmdline { int verbose; int recursive; int all_records; + int nosync; const char **options; int argc; const char **argv; diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c index eeedd49e84..08ce99d20f 100644 --- a/source4/lib/ldb/tools/ldbtest.c +++ b/source4/lib/ldb/tools/ldbtest.c @@ -299,6 +299,11 @@ static void start_test_index(struct ldb_context **ldb) struct ldb_dn *indexlist; struct ldb_dn *basedn; int ret; + int flags = 0; + + if (options->nosync) { + flags |= LDB_FLG_NOSYNC; + } printf("Starting index test\n"); @@ -337,7 +342,7 @@ static void start_test_index(struct ldb_context **ldb) (*ldb) = ldb_init(options); - ret = ldb_connect(*ldb, options->url, 0, NULL); + ret = ldb_connect(*ldb, options->url, flags, NULL); if (ret != 0) { printf("failed to connect to %s\n", options->url); exit(1); -- cgit