summaryrefslogtreecommitdiffstats
path: root/ctdb/include
diff options
context:
space:
mode:
Diffstat (limited to 'ctdb/include')
-rw-r--r--ctdb/include/ctdb_client.h21
-rw-r--r--ctdb/include/ctdb_private.h21
-rw-r--r--ctdb/include/ctdb_protocol.h14
3 files changed, 51 insertions, 5 deletions
diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h
index 95b907378a..01219f341b 100644
--- a/ctdb/include/ctdb_client.h
+++ b/ctdb/include/ctdb_client.h
@@ -179,6 +179,8 @@ int ctdb_client_send_message(struct ctdb_context *ctdb, uint32_t pnn,
struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx,
TDB_DATA key, TDB_DATA *data);
+struct ctdb_record_handle *ctdb_fetch_readonly_lock(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx, TDB_DATA key, TDB_DATA *data, int read_only);
+
int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data);
int ctdb_fetch(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx,
@@ -215,7 +217,9 @@ struct ctdb_dbid_map {
uint32_t num;
struct ctdb_dbid {
uint32_t dbid;
- bool persistent;
+#define CTDB_DB_FLAGS_PERSISTENT 0x01
+#define CTDB_DB_FLAGS_READONLY 0x02
+ uint8_t flags;
} dbs[1];
};
int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb,
@@ -592,4 +596,19 @@ int ctdb_ctrl_get_db_priority(struct ctdb_context *ctdb, struct timeval timeout,
int ctdb_ctrl_getstathistory(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, struct ctdb_statistics_wire **stats);
+
+struct ctdb_client_control_state *
+ctdb_ctrl_updaterecord_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, struct ctdb_db_context *ctdb_db, TDB_DATA key, struct ctdb_ltdb_header *header, TDB_DATA data);
+
+int ctdb_ctrl_updaterecord_recv(struct ctdb_context *ctdb, struct ctdb_client_control_state *state);
+
+int
+ctdb_ctrl_updaterecord(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, struct ctdb_db_context *ctdb_db, TDB_DATA key, struct ctdb_ltdb_header *header, TDB_DATA data);
+
+
+struct ctdb_client_control_state *
+ctdb_ctrl_set_db_readonly_send(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid);
+int ctdb_ctrl_set_db_readonly_recv(struct ctdb_context *ctdb, struct ctdb_client_control_state *state);
+int ctdb_ctrl_set_db_readonly(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid);
+
#endif /* _CTDB_CLIENT_H */
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index edf1d88dd8..b093bf09ac 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -504,9 +504,11 @@ struct ctdb_db_context {
uint32_t db_id;
uint32_t priority;
bool persistent;
+ bool readonly; /* Do we support read-only delegations ? */
const char *db_name;
const char *db_path;
struct tdb_wrap *ltdb;
+ struct tdb_context *rottdb; /* ReadOnly tracking TDB */
struct ctdb_registered_call *calls; /* list of registered calls */
uint32_t seqnum;
struct timed_event *seqnum_update;
@@ -517,6 +519,7 @@ struct ctdb_db_context {
int pending_requests;
struct lockwait_handle *lockwait_active;
struct lockwait_handle *lockwait_overflow;
+ struct revokechild_handle *revokechild_active;
struct ctdb_persistent_state *persistent_state;
struct trbt_tree *delete_queue;
int (*ctdb_ltdb_store_fn)(struct ctdb_db_context *ctdb_db,
@@ -668,6 +671,9 @@ int ctdb_ltdb_fetch(struct ctdb_db_context *ctdb_db,
int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
struct ctdb_ltdb_header *header, TDB_DATA data);
int ctdb_ltdb_delete(struct ctdb_db_context *ctdb_db, TDB_DATA key);
+int ctdb_ltdb_fetch_readonly(struct ctdb_db_context *ctdb_db,
+ TDB_DATA key, struct ctdb_ltdb_header *header,
+ TALLOC_CTX *mem_ctx, TDB_DATA *data);
int32_t ctdb_control_start_persistent_update(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
TDB_DATA recdata);
@@ -791,7 +797,7 @@ struct ctdb_call_state *ctdb_daemon_call_send_remote(struct ctdb_db_context *ctd
int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call,
struct ctdb_ltdb_header *header, TALLOC_CTX *mem_ctx,
- TDB_DATA *data);
+ TDB_DATA *data, bool updatetdb);
#define ctdb_reqid_find(ctdb, reqid, type) (type *)_ctdb_reqid_find(ctdb, reqid, #type, __location__)
@@ -1448,5 +1454,18 @@ void ctdb_takeover_run_core(struct ctdb_context *ctdb,
struct ctdb_node_map *nodemap,
struct ctdb_public_ip_list **all_ips_p);
+int ctdb_trackingdb_add_pnn(struct ctdb_context *ctdb, TDB_DATA *data, uint32_t pnn);
+
+typedef void (*ctdb_trackingdb_cb)(struct ctdb_context *ctdb, uint32_t pnn, void *private_data);
+
+void ctdb_trackingdb_traverse(struct ctdb_context *ctdb, TDB_DATA data, ctdb_trackingdb_cb cb, void *private_data);
+
+int ctdb_start_revoke_ro_record(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_db, TDB_DATA key, struct ctdb_ltdb_header *header, TDB_DATA data);
+
+typedef void (*deferred_requeue_fn)(void *call_context, struct ctdb_req_header *hdr);
+
+int ctdb_add_revoke_deferred_call(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_db, TDB_DATA key, struct ctdb_req_header *hdr, deferred_requeue_fn fn, void *call_context);
+
+int ctdb_set_db_readonly(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_db);
#endif
diff --git a/ctdb/include/ctdb_protocol.h b/ctdb/include/ctdb_protocol.h
index 0422afeb7b..f4019ab172 100644
--- a/ctdb/include/ctdb_protocol.h
+++ b/ctdb/include/ctdb_protocol.h
@@ -30,8 +30,9 @@
#define CTDB_DS_ALIGNMENT 8
-#define CTDB_NULL_FUNC 0xFF000001
-#define CTDB_FETCH_FUNC 0xFF000002
+#define CTDB_NULL_FUNC 0xFF000001
+#define CTDB_FETCH_FUNC 0xFF000002
+#define CTDB_FETCH_WITH_HEADER_FUNC 0xFF000003
struct ctdb_call {
@@ -40,8 +41,9 @@ struct ctdb_call {
TDB_DATA call_data;
TDB_DATA reply_data;
uint32_t status;
-#define CTDB_IMMEDIATE_MIGRATION 0x00000001
+#define CTDB_IMMEDIATE_MIGRATION 0x00000001
#define CTDB_CALL_FLAG_VACUUM_MIGRATION 0x00000002
+#define CTDB_WANT_READONLY 0x00000004
uint32_t flags;
};
@@ -50,6 +52,7 @@ struct ctdb_call {
*/
struct ctdb_call_info {
TDB_DATA key; /* record key */
+ struct ctdb_ltdb_header *header;
TDB_DATA record_data; /* current data in the record */
TDB_DATA *new_data; /* optionally updated record data */
TDB_DATA *call_data; /* optionally passed from caller */
@@ -363,6 +366,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE = 126,
CTDB_CONTROL_GET_STAT_HISTORY = 127,
CTDB_CONTROL_SCHEDULE_FOR_DELETION = 128,
+ CTDB_CONTROL_SET_DB_READONLY = 129,
};
/*
@@ -486,6 +490,10 @@ struct ctdb_ltdb_header {
#define CTDB_REC_FLAG_MIGRATED_WITH_DATA 0x00010000
#define CTDB_REC_FLAG_VACUUM_MIGRATED 0x00020000
#define CTDB_REC_FLAG_AUTOMATIC 0x00040000
+#define CTDB_REC_RO_HAVE_DELEGATIONS 0x01000000
+#define CTDB_REC_RO_HAVE_READONLY 0x02000000
+#define CTDB_REC_RO_REVOKING_READONLY 0x04000000
+#define CTDB_REC_RO_REVOKE_COMPLETE 0x08000000
uint32_t flags;
};