diff options
author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2011-10-28 12:41:27 +1100 |
---|---|---|
committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2011-10-28 12:41:27 +1100 |
commit | bb3509b6d2ed7caee810d79fcc71db45a12d06e4 (patch) | |
tree | 65ca3078fa00e761ca72d1a8f6b607a281b4a629 | |
parent | c21ec9fffc6f25081cdf008e3051e81710a38125 (diff) | |
download | samba-bb3509b6d2ed7caee810d79fcc71db45a12d06e4.tar.gz samba-bb3509b6d2ed7caee810d79fcc71db45a12d06e4.tar.xz samba-bb3509b6d2ed7caee810d79fcc71db45a12d06e4.zip |
ReadOnly: If record does not exist, upgrade to write-lock
If we attempt a readonly lock request for a record that do not exist (yet)
in the local TDB, then upgrade the request to ask for a write lock and force a
request for migrate the record onto the local node.
This allows the "only request record on second local request for known contended records"
heuristics to try to avoid creating readonly delegations unless we have good reason to
assume it is a contended record.
(This used to be ctdb commit e6003e52617385f731ccf93b13d21d5403534a78)
-rw-r--r-- | ctdb/libctdb/ctdb.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ctdb/libctdb/ctdb.c b/ctdb/libctdb/ctdb.c index b555360e63..099ceac087 100644 --- a/ctdb/libctdb/ctdb.c +++ b/ctdb/libctdb/ctdb.c @@ -806,6 +806,13 @@ static bool try_readrecordlock(struct ctdb_lock *lock, TDB_DATA *data) return true; } + /* we dont have the record locally, + * drop to writelock to force a migration + */ + if (!hdr && lock->readonly) { + lock->readonly = false; + } + tdb_chainunlock(lock->ctdb_db->tdb, lock->key); free(hdr); return NULL; |