diff options
author | Amitay Isaacs <amitay@gmail.com> | 2018-02-14 14:19:44 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2018-10-08 02:46:20 +0200 |
commit | c4ec99b1d3f1c5bff83bf66e3fd64d45a8be7441 (patch) | |
tree | 87291c538e48d519f5dcc9ae724bfb361841f2d3 /ctdb/server | |
parent | 040401ca3abfa266261130f6c5ae4e9718f19cd7 (diff) | |
download | samba-c4ec99b1d3f1c5bff83bf66e3fd64d45a8be7441.tar.gz |
ctdb-daemon: Invalidate records if a node becomes INACTIVE
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb/server')
-rw-r--r-- | ctdb/server/ctdb_freeze.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/ctdb/server/ctdb_freeze.c b/ctdb/server/ctdb_freeze.c index c41fc7d53ee..10841efa1b9 100644 --- a/ctdb/server/ctdb_freeze.c +++ b/ctdb/server/ctdb_freeze.c @@ -140,6 +140,9 @@ static int ctdb_db_freeze_handle_destructor(struct ctdb_db_freeze_handle *h) ctdb_db->freeze_mode = CTDB_FREEZE_NONE; ctdb_db->freeze_handle = NULL; + /* Clear invalid records flag */ + ctdb_db->invalid_records = false; + talloc_free(h->lreq); return 0; } @@ -394,6 +397,19 @@ static int db_freeze_waiter_destructor(struct ctdb_db_freeze_waiter *w) } /** + * Invalidate the records in the database. + * This only applies to volatile databases. + */ +static int db_invalidate(struct ctdb_db_context *ctdb_db, void *private_data) +{ + if (ctdb_db_volatile(ctdb_db)) { + ctdb_db->invalid_records = true; + } + + return 0; +} + +/** * Count the number of databases */ static int db_count(struct ctdb_db_context *ctdb_db, void *private_data) @@ -436,13 +452,17 @@ static int db_freeze(struct ctdb_db_context *ctdb_db, void *private_data) } /* - start the freeze process for a certain priority + start the freeze process for all databases + This is only called from ctdb_control_freeze(), which is called + only on node becoming INACTIVE. So mark the records invalid. */ static void ctdb_start_freeze(struct ctdb_context *ctdb) { struct ctdb_freeze_handle *h; int ret; + ctdb_db_iterator(ctdb, db_invalidate, NULL); + if (ctdb->freeze_mode == CTDB_FREEZE_FROZEN) { int count = 0; @@ -534,6 +554,8 @@ static int ctdb_freeze_waiter_destructor(struct ctdb_freeze_waiter *w) /* freeze all the databases + This control is only used when freezing database on node becoming INACTIVE. + So mark the records invalid in ctdb_start_freeze(). */ int32_t ctdb_control_freeze(struct ctdb_context *ctdb, struct ctdb_req_control_old *c, bool *async_reply) |