/*
attach to a specific database - client call
*/
-struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name, bool persistent)
+struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name, bool persistent, uint32_t tdb_flags)
{
struct ctdb_db_context *ctdb_db;
TDB_DATA data;
data.dsize = strlen(name)+1;
/* tell ctdb daemon to attach */
- ret = ctdb_control(ctdb, CTDB_CURRENT_NODE, 0,
+ ret = ctdb_control(ctdb, CTDB_CURRENT_NODE, tdb_flags,
persistent?CTDB_CONTROL_DB_ATTACH_PERSISTENT:CTDB_CONTROL_DB_ATTACH,
0, data, ctdb_db, &data, &res, NULL, NULL);
if (ret != 0 || res != 0 || data.dsize != sizeof(uint32_t)) {
/*
attach to a ctdb database
*/
-struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name, bool persistent);
+struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name, bool persistent, uint32_t tdb_flags);
/*
find an attached ctdb_db handle given a name
}
/* attach to it */
- ctdb_db = ctdb_attach(ctdb, name, persistent);
+ ctdb_db = ctdb_attach(ctdb, name, persistent, 0);
if (ctdb_db == NULL) {
DEBUG(DEBUG_ERR,(__location__ " Failed to attach to database '%s'\n", name));
talloc_free(tmp_ctx);
&cluster_ready);
/* attach to a specific database */
- ctdb_db = ctdb_attach(ctdb, "test.tdb", false);
+ ctdb_db = ctdb_attach(ctdb, "test.tdb", false, 0);
if (!ctdb_db) {
printf("ctdb_attach failed - %s\n", ctdb_errstr(ctdb));
exit(1);
&cluster_ready);
/* attach to a specific database */
- ctdb_db = ctdb_attach(ctdb, "test.tdb", false);
+ ctdb_db = ctdb_attach(ctdb, "test.tdb", false, 0);
if (!ctdb_db) {
printf("ctdb_attach failed - %s\n", ctdb_errstr(ctdb));
exit(1);
{
struct ctdb_context *ctdb;
struct ctdb_db_context *ctdb_db;
-
+ int unsafe_writes = 0;
struct poptOption popt_options[] = {
POPT_AUTOHELP
POPT_CTDB_CMDLINE
{ "timelimit", 't', POPT_ARG_INT, &timelimit, 0, "timelimit", "integer" },
+ { "unsafe-writes", 'u', POPT_ARG_NONE, &unsafe_writes, 0, "do not use tdb transactions when writing", NULL },
POPT_TABLEEND
};
int opt;
ev = event_context_init(NULL);
ctdb = ctdb_cmdline_client(ev);
+ if (ctdb == NULL) {
+ printf("Could not attach to daemon\n");
+ return 1;
+ }
/* attach to a specific database */
- ctdb_db = ctdb_attach(ctdb, "persistent.tdb", true);
+ if (unsafe_writes == 1) {
+ ctdb_db = ctdb_attach(ctdb, "persistent.tdb", true, TDB_NOSYNC);
+ } else {
+ ctdb_db = ctdb_attach(ctdb, "persistent.tdb", true, 0);
+ }
+
if (!ctdb_db) {
printf("ctdb_attach failed - %s\n", ctdb_errstr(ctdb));
exit(1);
ctdb = ctdb_cmdline_client(ev);
/* attach to a specific database */
- ctdb_db = ctdb_attach(ctdb, "test.tdb", false);
+ ctdb_db = ctdb_attach(ctdb, "test.tdb", false, 0);
if (!ctdb_db) {
printf("ctdb_attach failed - %s\n", ctdb_errstr(ctdb));
exit(1);
ctdb = ctdb_cmdline_client(ev);
/* attach to a specific database */
- ctdb_db = ctdb_attach(ctdb, "test.tdb", false);
+ ctdb_db = ctdb_attach(ctdb, "test.tdb", false, 0);
if (!ctdb_db) {
printf("ctdb_attach failed - %s\n", ctdb_errstr(ctdb));
exit(1);
ctdb = ctdb_cmdline_client(ev);
/* attach to a specific database */
- ctdb_db = ctdb_attach(ctdb, dbname, false);
+ ctdb_db = ctdb_attach(ctdb, dbname, false, 0);
if (!ctdb_db) {
printf("ctdb_attach failed - %s\n", ctdb_errstr(ctdb));
exit(1);
NUMNODES=$1
fi
-echo "Starting $NUMNODES daemons"
+
+echo "Starting $NUMNODES daemons for SAFE persistent writes"
tests/start_daemons.sh $NUMNODES || exit 1
killall -9 -q ctdb_persistent
echo "Shutting down"
bin/ctdb shutdown -n all --socket=sock.1
+killall -9 ctdbd
+
+
+
+echo "Starting $NUMNODES daemons for UNSAFE persistent writes"
+tests/start_daemons.sh $NUMNODES || exit 1
+
+killall -9 -q ctdb_persistent
+
+for i in `seq 1 $NUMNODES`; do
+ $VALGRIND bin/ctdb_persistent --unsafe-writes --timelimit 30 --socket sock.$i $* &
+done
+wait
+
+echo "Shutting down"
+bin/ctdb shutdown -n all --socket=sock.1
+killall -9 ctdbd
+
+
exit 0
}
db_name = argv[0];
- ctdb_db = ctdb_attach(ctdb, db_name, false);
+ ctdb_db = ctdb_attach(ctdb, db_name, false, 0);
if (ctdb_db == NULL) {
DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
}
db_name = argv[0];
- ctdb_db = ctdb_attach(ctdb, db_name, false);
+ ctdb_db = ctdb_attach(ctdb, db_name, false, 0);
if (ctdb_db == NULL) {
DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
return -1;
return -1;
}
- ctdb_db = ctdb_attach(ctdb, name, persistent);
+ ctdb_db = ctdb_attach(ctdb, name, persistent, 0);
if (ctdb_db == NULL) {
DEBUG(DEBUG_ERR,(__location__ " Failed to attach to database '%s'\n", name));
talloc_free(vdata);
return -1;
}
- ctdb_db = ctdb_attach(ctdb, name, persistent);
+ ctdb_db = ctdb_attach(ctdb, name, persistent, 0);
if (ctdb_db == NULL) {
DEBUG(DEBUG_ERR,(__location__ " Failed to attach to database '%s'\n", name));
return -1;