summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/conn/conn_tiered.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/conn/conn_tiered.c')
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_tiered.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/third_party/wiredtiger/src/conn/conn_tiered.c b/src/third_party/wiredtiger/src/conn/conn_tiered.c
index 0d94e891d38..eb43e427b2c 100644
--- a/src/third_party/wiredtiger/src/conn/conn_tiered.c
+++ b/src/third_party/wiredtiger/src/conn/conn_tiered.c
@@ -68,8 +68,10 @@ __flush_tier_wait(WT_SESSION_IMPL *session, const char **cfg)
}
if (++yield_count < WT_THOUSAND)
__wt_yield();
- else
+ else {
+ __wt_cond_signal(session, conn->tiered_cond);
__wt_cond_wait(session, conn->flush_cond, 200, NULL);
+ }
}
return (0);
}
@@ -111,7 +113,11 @@ __flush_tier_once(WT_SESSION_IMPL *session, uint32_t flags)
*/
WT_ASSERT(session, FLD_ISSET(session->lock_flags, WT_SESSION_LOCKED_CHECKPOINT));
__wt_seconds(session, &flush_time);
- /* XXX If/when flush tier no longer requires the checkpoint lock, this needs consideration. */
+ /*
+ * XXX If/when flush tier no longer requires the checkpoint lock, all of these global values and
+ * their settings need consideration to make sure they don't race with a checkpoint.
+ */
+ conn->flush_ckpt_complete = false;
conn->flush_most_recent = WT_MAX(flush_time, conn->ckpt_most_recent);
conn->flush_ts = conn->txn_global.last_ckpt_timestamp;
@@ -436,6 +442,9 @@ __tier_storage_copy(WT_SESSION_IMPL *session)
WT_DECL_RET;
WT_TIERED_WORK_UNIT *entry;
+ /* There is nothing to do until the checkpoint after the flush completes. */
+ if (!S2C(session)->flush_ckpt_complete)
+ return (0);
entry = NULL;
for (;;) {
/* Check if we're quitting or being reconfigured. */
@@ -496,6 +505,7 @@ __wt_flush_tier(WT_SESSION_IMPL *session, const char *config)
WT_DECL_RET;
uint32_t flags;
const char *cfg[3];
+ const char *checkpoint_cfg[] = {WT_CONFIG_BASE(session, WT_SESSION_checkpoint), NULL};
bool locked, wait;
conn = S2C(session);
@@ -548,6 +558,8 @@ __wt_flush_tier(WT_SESSION_IMPL *session, const char *config)
WT_WITH_SCHEMA_LOCK_NOWAIT(session, ret, ret = __flush_tier_once(session, flags)));
__wt_spin_unlock(session, &conn->flush_tier_lock);
locked = false;
+ if (FLD_ISSET(conn->debug_flags, WT_CONN_DEBUG_FLUSH_CKPT))
+ WT_ERR(__wt_txn_checkpoint(session, checkpoint_cfg, true));
if (ret == 0 && LF_ISSET(WT_FLUSH_TIER_ON))
WT_ERR(__flush_tier_wait(session, cfg));
@@ -806,6 +818,11 @@ __wt_tiered_storage_destroy(WT_SESSION_IMPL *session)
/* Stop the internal server thread. */
if (conn->flush_cond != NULL)
__wt_cond_signal(session, conn->flush_cond);
+ if (conn->tiered_cond != NULL) {
+ __wt_cond_signal(session, conn->tiered_cond);
+ /* Give thread time to drain the work. */
+ __wt_sleep(1, 0);
+ }
FLD_CLR(conn->server_flags, WT_CONN_SERVER_TIERED);
if (conn->tiered_tid_set) {
WT_ASSERT(session, conn->tiered_cond != NULL);