summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavi Giri <ravi.giri@mongodb.com>2023-04-11 01:57:08 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-11 02:34:15 +0000
commitfdca3b21c2942eebffeadb79dd36d41c2e3d3ac3 (patch)
tree840c1d8a1e589ef3590dc6880b99a8b2f73a1abb
parentb52506b907047986d2bfbe7056278e6f2a7f25d1 (diff)
downloadmongo-fdca3b21c2942eebffeadb79dd36d41c2e3d3ac3.tar.gz
Import wiredtiger: 64742ea8bf037f425f8f4d128b33e5c8c5c9ec9e from branch mongodb-master
ref: 31c27f17bb..64742ea8bf for: 7.0.0-rc0 WT-10249 Prevent tiered dhandles that are queued for work from being swept
-rw-r--r--src/third_party/wiredtiger/dist/s_string.ok1
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_tiered.c2
-rw-r--r--src/third_party/wiredtiger/src/include/extern.h2
-rw-r--r--src/third_party/wiredtiger/src/tiered/tiered_work.c45
5 files changed, 42 insertions, 10 deletions
diff --git a/src/third_party/wiredtiger/dist/s_string.ok b/src/third_party/wiredtiger/dist/s_string.ok
index 138172982cd..4a75de0837e 100644
--- a/src/third_party/wiredtiger/dist/s_string.ok
+++ b/src/third_party/wiredtiger/dist/s_string.ok
@@ -1118,6 +1118,7 @@ relocked
repl
repositioned
repositions
+requeue
resizable
ret
retp
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 9f3a4169f27..cba85daaa6b 100644
--- a/src/third_party/wiredtiger/import.data
+++ b/src/third_party/wiredtiger/import.data
@@ -2,5 +2,5 @@
"vendor": "wiredtiger",
"github": "wiredtiger/wiredtiger.git",
"branch": "mongodb-master",
- "commit": "31c27f17bb4bf1802f20aebeadfa9068cec37213"
+ "commit": "64742ea8bf037f425f8f4d128b33e5c8c5c9ec9e"
}
diff --git a/src/third_party/wiredtiger/src/conn/conn_tiered.c b/src/third_party/wiredtiger/src/conn/conn_tiered.c
index f8f74519486..e71aea36560 100644
--- a/src/third_party/wiredtiger/src/conn/conn_tiered.c
+++ b/src/third_party/wiredtiger/src/conn/conn_tiered.c
@@ -69,7 +69,7 @@ __tier_storage_remove_local(WT_SESSION_IMPL *session)
*/
WT_ASSERT(session, entry->tiered != NULL && entry->tiered->bstorage != NULL);
entry->op_val = now + entry->tiered->bstorage->retain_secs;
- __wt_tiered_push_work(session, entry);
+ __wt_tiered_requeue_work(session, entry);
} else {
__wt_verbose_debug2(
session, WT_VERB_TIERED, "REMOVE_LOCAL: actually remove %s", object);
diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h
index 5bc24c1b5da..380e568c131 100644
--- a/src/third_party/wiredtiger/src/include/extern.h
+++ b/src/third_party/wiredtiger/src/include/extern.h
@@ -1956,8 +1956,8 @@ extern void __wt_tiered_get_remove_local(
extern void __wt_tiered_get_remove_shared(WT_SESSION_IMPL *session, WT_TIERED_WORK_UNIT **entryp);
extern void __wt_tiered_pop_work(
WT_SESSION_IMPL *session, uint32_t type, uint64_t maxval, WT_TIERED_WORK_UNIT **entryp);
-extern void __wt_tiered_push_work(WT_SESSION_IMPL *session, WT_TIERED_WORK_UNIT *entry);
extern void __wt_tiered_remove_work(WT_SESSION_IMPL *session, WT_TIERED *tiered, bool locked);
+extern void __wt_tiered_requeue_work(WT_SESSION_IMPL *session, WT_TIERED_WORK_UNIT *entry);
extern void __wt_tiered_work_free(WT_SESSION_IMPL *session, WT_TIERED_WORK_UNIT *entry);
extern void __wt_timestamp_to_hex_string(wt_timestamp_t ts, char *hex_timestamp);
extern void __wt_txn_bump_snapshot(WT_SESSION_IMPL *session);
diff --git a/src/third_party/wiredtiger/src/tiered/tiered_work.c b/src/third_party/wiredtiger/src/tiered/tiered_work.c
index 96fcfed66de..5692c877db7 100644
--- a/src/third_party/wiredtiger/src/tiered/tiered_work.c
+++ b/src/third_party/wiredtiger/src/tiered/tiered_work.c
@@ -36,6 +36,7 @@ __wt_tiered_work_free(WT_SESSION_IMPL *session, WT_TIERED_WORK_UNIT *entry)
WT_CONNECTION_IMPL *conn;
conn = S2C(session);
+ (void)__wt_atomic_subi32(&entry->tiered->iface.session_inuse, 1);
__tiered_flush_state(session, entry->type, false);
/* If all work is done signal any waiting thread waiting for sync. */
if (WT_FLUSH_STATE_DONE(conn->flush_state))
@@ -71,11 +72,11 @@ __wt_tiered_remove_work(WT_SESSION_IMPL *session, WT_TIERED *tiered, bool locked
}
/*
- * __wt_tiered_push_work --
+ * __tiered_push_work_internal --
* Push a work unit to the queue. Assumes it is passed an already filled out structure.
*/
-void
-__wt_tiered_push_work(WT_SESSION_IMPL *session, WT_TIERED_WORK_UNIT *entry)
+static void
+__tiered_push_work_internal(WT_SESSION_IMPL *session, WT_TIERED_WORK_UNIT *entry)
{
WT_CONNECTION_IMPL *conn;
@@ -91,6 +92,36 @@ __wt_tiered_push_work(WT_SESSION_IMPL *session, WT_TIERED_WORK_UNIT *entry)
}
/*
+ * __wt_tiered_requeue_work --
+ * Push an existing work unit to the queue. Assumes it was previously returned from one of the
+ * get functions, and it is being re-queued.
+ */
+void
+__wt_tiered_requeue_work(WT_SESSION_IMPL *session, WT_TIERED_WORK_UNIT *entry)
+{
+ /* The dhandle was marked in use when the entry was first made, don't do that here. */
+ __tiered_push_work_internal(session, entry);
+ return;
+}
+
+/*
+ * __tiered_push_new_work --
+ * Push a newly created work unit to the queue. Assumes it is passed an already filled out
+ * structure.
+ */
+static void
+__tiered_push_new_work(WT_SESSION_IMPL *session, WT_TIERED_WORK_UNIT *entry)
+{
+ /*
+ * Bump the in use count lock on the dhandle, this is kept until the work unit is freed. This
+ * prevents the an otherwise idle dhandle from being swept and freed.
+ */
+ (void)__wt_atomic_addi32(&entry->tiered->iface.session_inuse, 1);
+ __tiered_push_work_internal(session, entry);
+ return;
+}
+
+/*
* __wt_tiered_pop_work --
* Pop a work unit of the given type from the queue. If a maximum value is given, only return a
* work unit that is less than the maximum value. The caller is responsible for freeing the
@@ -221,7 +252,7 @@ __wt_tiered_put_flush_finish(WT_SESSION_IMPL *session, WT_TIERED *tiered, uint32
entry->type = WT_TIERED_WORK_FLUSH_FINISH;
entry->id = id;
entry->tiered = tiered;
- __wt_tiered_push_work(session, entry);
+ __tiered_push_new_work(session, entry);
return (0);
}
@@ -243,7 +274,7 @@ __wt_tiered_put_remove_local(WT_SESSION_IMPL *session, WT_TIERED *tiered, uint32
/* Put a work unit in the queue with the time this object expires. */
entry->op_val = now + tiered->bstorage->retain_secs;
entry->tiered = tiered;
- __wt_tiered_push_work(session, entry);
+ __tiered_push_new_work(session, entry);
return (0);
}
@@ -260,7 +291,7 @@ __wt_tiered_put_remove_shared(WT_SESSION_IMPL *session, WT_TIERED *tiered, uint3
entry->type = WT_TIERED_WORK_REMOVE_SHARED;
entry->id = id;
entry->tiered = tiered;
- __wt_tiered_push_work(session, entry);
+ __tiered_push_new_work(session, entry);
return (0);
}
@@ -278,6 +309,6 @@ __wt_tiered_put_flush(WT_SESSION_IMPL *session, WT_TIERED *tiered, uint32_t id)
entry->type = WT_TIERED_WORK_FLUSH;
entry->id = id;
entry->tiered = tiered;
- __wt_tiered_push_work(session, entry);
+ __tiered_push_new_work(session, entry);
return (0);
}