diff options
author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2008-05-12 13:37:31 +1000 |
---|---|---|
committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2008-05-12 13:37:31 +1000 |
commit | b8eb5925cf6e5a97f5bd2eca5a71968d954d1351 (patch) | |
tree | 6d27eee3eec093f7ef2ac1d2ef41f7a68aa72849 /ctdb/server/ctdb_ltdb_server.c | |
parent | d5ec45ee80f7d3311beb904d5723125220248070 (diff) | |
download | samba-b8eb5925cf6e5a97f5bd2eca5a71968d954d1351.tar.gz samba-b8eb5925cf6e5a97f5bd2eca5a71968d954d1351.tar.xz samba-b8eb5925cf6e5a97f5bd2eca5a71968d954d1351.zip |
Try to use tdb transactions when updating a record and record header inside the ctdb daemon.
If a transaction could be started, do safe transaction store when updating the record inside the daemon.
If the transaction could not be started (maybe another samba process has a lock on the database?) then just do a normal store instead (instead of blocking the ctdb daemon).
The client can "signal" ctdb that updates to this database should, if possible, be done using safe transactions by specifying the TDB_NOSYNC flag when attaching to the database.
The TDB flags are passed to ctdb in the "srvid" field of the control header when attaching using the CTDB_CONTROL_DB_ATTACH_PERSISTENT.
Currently, samba3.2 does not yet tell ctdbd to handle any persistent databases using safe transactions.
If samba3.2 wants a particular persistent database to be handled using
safe transactions inside the ctdbd daemon, it should pass
TDB_NOSYNC as the flags to the call to attach to a persistent database
in ctdbd_db_attach() it currently specifies 0 as the srvid
(This used to be ctdb commit 8d6ecf47318188448d934ab76e40da7e4cece67d)
Diffstat (limited to 'ctdb/server/ctdb_ltdb_server.c')
-rw-r--r-- | ctdb/server/ctdb_ltdb_server.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c index e900f7b9ca..5146ed86da 100644 --- a/ctdb/server/ctdb_ltdb_server.c +++ b/ctdb/server/ctdb_ltdb_server.c @@ -296,12 +296,19 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo a client has asked to attach a new database */ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, - TDB_DATA *outdata, bool persistent) + TDB_DATA *outdata, uint64_t tdb_flags, + bool persistent) { const char *db_name = (const char *)indata.dptr; struct ctdb_db_context *db; struct ctdb_node *node = ctdb->nodes[ctdb->pnn]; + /* the client can optionally pass additional tdb flags, but we + only allow a subset of those on the database in ctdb. Note + that tdb_flags is passed in via the (otherwise unused) + srvid to the attach control */ + tdb_flags &= TDB_NOSYNC; + /* If the node is inactive it is not part of the cluster and we should not allow clients to attach to any databases @@ -317,6 +324,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, if (db) { outdata->dptr = (uint8_t *)&db->db_id; outdata->dsize = sizeof(db->db_id); + db->client_tdb_flags |= tdb_flags; return 0; } @@ -330,6 +338,9 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, return -1; } + /* remember the flags the client has specified */ + db->client_tdb_flags = tdb_flags; + outdata->dptr = (uint8_t *)&db->db_id; outdata->dsize = sizeof(db->db_id); |