diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-02-03 11:00:54 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2012-03-05 01:11:26 +0100 |
commit | 5bda06877303b4ac01081b12f889db1409c0a6f6 (patch) | |
tree | ced934126e83567cf7d7f4539173c694d57e3a7f /source3/lib/ctdbd_conn.c | |
parent | 67bb5abe81dc64758a792060673b923cd77a018a (diff) | |
download | samba-5bda06877303b4ac01081b12f889db1409c0a6f6.tar.gz samba-5bda06877303b4ac01081b12f889db1409c0a6f6.tar.bz2 samba-5bda06877303b4ac01081b12f889db1409c0a6f6.zip |
dbwrap_ctdb: only fetch a read-only copy if we had a record already.
Because revoking read-only copies of records is expensive, we only
want ctdbd to do it for high-turnover records. A basic heuristic is
that if we don't find a local copy of the record, don't ask for a
read-only copy.
The fetch itself will cause ctdbd to migrate the record, so eventually
we will have a local copy. Next time it gets migrated away, we'll
call ctdbd_fetch() with local_copy = true.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'source3/lib/ctdbd_conn.c')
-rw-r--r-- | source3/lib/ctdbd_conn.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index f160fd6151..47090a5412 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -1394,7 +1394,8 @@ NTSTATUS ctdbd_migrate(struct ctdbd_connection *conn, uint32 db_id, * remotely fetch a record (read-only) */ NTSTATUS ctdbd_fetch(struct ctdbd_connection *conn, uint32 db_id, - TDB_DATA key, TALLOC_CTX *mem_ctx, TDB_DATA *data) + TDB_DATA key, TALLOC_CTX *mem_ctx, TDB_DATA *data, + bool local_copy) { struct ctdb_req_call req; struct ctdb_reply_call *reply; @@ -1407,7 +1408,7 @@ NTSTATUS ctdbd_fetch(struct ctdbd_connection *conn, uint32 db_id, req.hdr.ctdb_version = CTDB_VERSION; req.hdr.operation = CTDB_REQ_CALL; req.hdr.reqid = ctdbd_next_reqid(conn); - req.flags = CTDB_WANT_READONLY; + req.flags = local_copy ? CTDB_WANT_READONLY : 0; req.callid = CTDB_FETCH_FUNC; req.db_id = db_id; req.keylen = key.dsize; |