[SCM] CTDB repository - branch master updated - ctdb-1.0.90-23-gedb58a4
Ronnie Sahlberg
sahlberg at samba.org
Fri Sep 25 01:34:37 MDT 2009
The branch, master has been updated
via edb58a417bfeb094cbbbf96caec8e2918256dad9 (commit)
via 4364419a486c1995bea56dab603cc4960e7c8e7a (commit)
via 74e416108df6934f45ca646d709785dd76ab3c35 (commit)
via 84e5a55a900b01903b80e23045edfc726d8d77a1 (commit)
from db7195d762f69577c4e28f0b0e0ded0ac7f91f0b (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit edb58a417bfeb094cbbbf96caec8e2918256dad9
Merge: db7195d762f69577c4e28f0b0e0ded0ac7f91f0b 4364419a486c1995bea56dab603cc4960e7c8e7a
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Sep 25 17:34:59 2009 +1000
Merge commit 'obnox/master-rebase'
commit 4364419a486c1995bea56dab603cc4960e7c8e7a
Author: Michael Adam <obnox at samba.org>
Date: Thu Sep 10 16:21:01 2009 +0200
Revert "dont check if commit failed, we do allow the commit to fail sometimes"
This reverts commit affa6f47432507e84b7e76b88a2c27fff8e6e2e4.
Transaction commit should not be allowed to fail.
This is a fatal error.
Michael
commit 74e416108df6934f45ca646d709785dd76ab3c35
Author: Michael Adam <obnox at samba.org>
Date: Thu Sep 10 16:20:26 2009 +0200
Revert "allow the transaction commit to fail"
This reverts commit 7a6134e684c9ac4763bf198ef1410867b6082c94.
Transaction commit should not be allowed to fail.
This is a fatal error.
Michael
commit 84e5a55a900b01903b80e23045edfc726d8d77a1
Author: Michael Adam <obnox at samba.org>
Date: Tue Aug 4 09:45:50 2009 +0200
ctdb_client: fix race in starting concurrent transactions on a single node
There are two races in concurrent transactions on a single node.
One in starting a transaction, and one with committing (replaying).
This commit closes the first race by storing the pid in the
transaction-lock record and comparing the own pid against it
as a measure to prevent starting a second transaction when
a second node has come inbetween and changed the pid in the lock
record.
Michael
-----------------------------------------------------------------------
Summary of changes:
client/ctdb_client.c | 25 ++++++++++++++++++++++++-
tests/src/ctdb_persistent.c | 2 +-
tests/src/ctdb_transaction.c | 2 +-
3 files changed, 26 insertions(+), 3 deletions(-)
Changeset truncated at 500 lines:
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 1f5bb4c..9621435 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -3107,11 +3107,13 @@ static int ctdb_transaction_fetch_start(struct ctdb_transaction_handle *h)
{
struct ctdb_record_handle *rh;
TDB_DATA key;
+ TDB_DATA data;
struct ctdb_ltdb_header header;
TALLOC_CTX *tmp_ctx;
const char *keyname = CTDB_TRANSACTION_LOCK_KEY;
int ret;
struct ctdb_db_context *ctdb_db = h->ctdb_db;
+ pid_t pid;
key.dptr = discard_const(keyname);
key.dsize = strlen(keyname);
@@ -3130,6 +3132,21 @@ again:
talloc_free(tmp_ctx);
return -1;
}
+ /*
+ * store the pid in the database:
+ * it is not enough that the node is dmaster...
+ */
+ pid = getpid();
+ data.dptr = (unsigned char *)&pid;
+ data.dsize = sizeof(pid_t);
+ ret = ctdb_ltdb_store(ctdb_db, key, &(rh->header), data);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR, (__location__ " Failed to store pid in "
+ "transaction record\n"));
+ talloc_free(tmp_ctx);
+ return -1;
+ }
+
talloc_free(rh);
ret = tdb_transaction_start(ctdb_db->ltdb->tdb);
@@ -3139,13 +3156,19 @@ again:
return -1;
}
- ret = ctdb_ltdb_fetch(ctdb_db, key, &header, tmp_ctx, NULL);
+ ret = ctdb_ltdb_fetch(ctdb_db, key, &header, tmp_ctx, &data);
if (ret != 0 || header.dmaster != ctdb_db->ctdb->pnn) {
tdb_transaction_cancel(ctdb_db->ltdb->tdb);
talloc_free(tmp_ctx);
goto again;
}
+ if ((data.dsize != sizeof(pid_t)) || (*(pid_t *)(data.dptr) != pid)) {
+ tdb_transaction_cancel(ctdb_db->ltdb->tdb);
+ talloc_free(tmp_ctx);
+ goto again;
+ }
+
talloc_free(tmp_ctx);
return 0;
diff --git a/tests/src/ctdb_persistent.c b/tests/src/ctdb_persistent.c
index 4a50aa7..8110ce1 100644
--- a/tests/src/ctdb_persistent.c
+++ b/tests/src/ctdb_persistent.c
@@ -164,7 +164,7 @@ static void test_store_records(struct ctdb_context *ctdb, struct event_context *
ret = ctdb_transaction_commit(h);
if (ret != 0) {
DEBUG(DEBUG_ERR,("Failed to commit transaction\n"));
- //exit(1);
+ exit(1);
}
/* store the counters and verify that they are sane */
diff --git a/tests/src/ctdb_transaction.c b/tests/src/ctdb_transaction.c
index fdd2e89..c747e1a 100644
--- a/tests/src/ctdb_transaction.c
+++ b/tests/src/ctdb_transaction.c
@@ -197,7 +197,7 @@ static void test_store_records(struct ctdb_context *ctdb, struct event_context *
ret = ctdb_transaction_commit(h);
if (ret != 0) {
DEBUG(DEBUG_ERR,("Failed to commit transaction\n"));
- //exit(1);
+ exit(1);
}
if (verbose) printf("transaction committed\n");
} else {
--
CTDB repository
More information about the samba-cvs
mailing list