summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/configure.in28
-rw-r--r--source3/lib/ctdbd_conn.c9
-rw-r--r--source3/lib/dbwrap/dbwrap_ctdb.c4
3 files changed, 40 insertions, 1 deletions
diff --git a/source3/configure.in b/source3/configure.in
index 937867dc9a..8c069a09cf 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -5612,6 +5612,34 @@ if test "x$have_cluster_support" = "xyes" ; then
fi
fi
+AC_ARG_ENABLE([ctdb-readonly-records],
+ AS_HELP_STRING([--enable-ctdb-readonly-records],
+ [Turn on CTDB readonly records support (default=yes)]),
+ [want_ctdb_readonly=$enableval],
+ [want_ctdb_readonly=yes])
+
+if test "x$have_cluster_support" = "xyes" -a "x$want_ctdb_readonly" = "xyes" ; then
+ AC_HAVE_DECL(CTDB_WANT_READONLY,[
+ #include "confdefs.h"
+ #define NO_CONFIG_H
+ #include "replace.h"
+ #include "system/wait.h"
+ #include "system/network.h"
+ #include <talloc.h>
+ #include <tdb.h>
+ #include <ctdb.h>
+ ])
+
+ if test "x$ac_cv_have_CTDB_WANT_READONLY_decl" != "xyes" ; then
+ if test "x$enable_old_ctdb" = "xyes" ; then
+ AC_MSG_WARN([ignoring missing READONLY support (--enable-old-ctdb)])
+ else
+ ctdb_broken="support for CTDB readonly records missing"
+ have_cluster_support=no
+ fi
+ fi
+fi
+
if test "x$have_cluster_support" = "xyes" ; then
# In ctdb 1.0.57, ctdb_control_tcp was temporarily renamed
# to ctdb_tcp_client.
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 47090a5412..b5c8280c4d 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -1400,6 +1400,13 @@ NTSTATUS ctdbd_fetch(struct ctdbd_connection *conn, uint32 db_id,
struct ctdb_req_call req;
struct ctdb_reply_call *reply;
NTSTATUS status;
+ uint32_t flags;
+
+#ifdef HAVE_CTDB_WANT_READONLY_DECL
+ flags = local_copy ? CTDB_WANT_READONLY : 0;
+#else
+ flags = 0;
+#endif
ZERO_STRUCT(req);
@@ -1408,7 +1415,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 = local_copy ? CTDB_WANT_READONLY : 0;
+ req.flags = flags;
req.callid = CTDB_FETCH_FUNC;
req.db_id = db_id;
req.keylen = key.dsize;
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index a05f9554b7..2e0146fdb0 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -1012,6 +1012,7 @@ static bool db_ctdb_own_record(TDB_DATA ctdb_data, bool read_only)
if (ctdb_data.dsize < sizeof(struct ctdb_ltdb_header))
return false;
+#ifdef HAVE_CTDB_WANT_READONLY_DECL
hdr = (struct ctdb_ltdb_header *)ctdb_data.dptr;
if (hdr->dmaster != get_my_vnn()) {
/* If we're not dmaster, it must be r/o copy. */
@@ -1020,6 +1021,9 @@ static bool db_ctdb_own_record(TDB_DATA ctdb_data, bool read_only)
/* If we want write access, noone can have r/o copies. */
return read_only || !(hdr->flags & CTDB_REC_RO_HAVE_DELEGATIONS);
+#else
+ return !read_only;
+#endif
}
static struct db_record *fetch_locked_internal(struct db_ctdb_ctx *ctx,