From 376eae9eefe9f752d8d9b5189528f1353c019e54 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 16 May 2023 22:21:25 +0000 Subject: Import wiredtiger: 04dcc362042b8cc35fdd8de8343be3a15d4fa47c from branch mongodb-master ref: d310d6330e..04dcc36204 for: 7.1.0-rc0 WT-10898 Add assertions for owning a spinlock --- src/third_party/wiredtiger/src/schema/schema_rename.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/third_party/wiredtiger/src/schema/schema_rename.c') diff --git a/src/third_party/wiredtiger/src/schema/schema_rename.c b/src/third_party/wiredtiger/src/schema/schema_rename.c index 372c64e6f27..0bfdc400765 100644 --- a/src/third_party/wiredtiger/src/schema/schema_rename.c +++ b/src/third_party/wiredtiger/src/schema/schema_rename.c @@ -321,6 +321,16 @@ __wt_schema_rename(WT_SESSION_IMPL *session, const char *uri, const char *newuri WT_DECL_RET; WT_SESSION_IMPL *int_session; + /* + * We should be calling this function with the checkpoint lock and the schema lock, but we + * cannot verify that here because we can re-enter this function with the internal session. If + * we get here using the internal session, we cannot check whether we own the locks, as they + * would be locked by the outer session. We can thus only check whether the locks are acquired, + * as opposed to, whether the locks are acquired by us. + */ + WT_ASSERT(session, __wt_spin_locked(session, &S2C(session)->checkpoint_lock)); + WT_ASSERT(session, __wt_spin_locked(session, &S2C(session)->schema_lock)); + WT_RET(__wt_schema_internal_session(session, &int_session)); ret = __schema_rename(int_session, uri, newuri, cfg); WT_TRET(__wt_schema_session_release(session, int_session)); -- cgit v1.2.1