summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlison Felizzi <alison.felizzi@mongodb.com>2021-09-02 06:33:29 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-09-02 06:58:55 +0000
commitf1e8a4fc4f34dca9b90b3a7880a1d47de14f5c8e (patch)
treed50a82756a261651952f1e8f06cdd9836b72517e
parent21dd47f34a6db5031b8e7507c6d0566a9ebca42b (diff)
downloadmongo-f1e8a4fc4f34dca9b90b3a7880a1d47de14f5c8e.tar.gz
Import wiredtiger: be4dbb0d7e1dfda6e4a21ce6f2b99e351bb71172 from branch mongodb-master
ref: 387b83a039..be4dbb0d7e for: 5.1.0 WT-7902 Retry the alter command after a system wide checkpoint
-rw-r--r--src/third_party/wiredtiger/dist/stat_data.py1
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/include/extern.h2
-rw-r--r--src/third_party/wiredtiger/src/include/stat.h1
-rw-r--r--src/third_party/wiredtiger/src/include/wiredtiger.in218
-rw-r--r--src/third_party/wiredtiger/src/session/session_api.c81
-rw-r--r--src/third_party/wiredtiger/src/session/session_compact.c53
-rw-r--r--src/third_party/wiredtiger/src/support/stat.c4
-rw-r--r--src/third_party/wiredtiger/test/suite/test_alter05.py104
9 files changed, 301 insertions, 165 deletions
diff --git a/src/third_party/wiredtiger/dist/stat_data.py b/src/third_party/wiredtiger/dist/stat_data.py
index f35e56252a1..cd3a473a3cd 100644
--- a/src/third_party/wiredtiger/dist/stat_data.py
+++ b/src/third_party/wiredtiger/dist/stat_data.py
@@ -485,6 +485,7 @@ conn_stats = [
SessionOpStat('session_table_alter_fail', 'table alter failed calls', 'no_clear,no_scale'),
SessionOpStat('session_table_alter_skip', 'table alter unchanged and skipped', 'no_clear,no_scale'),
SessionOpStat('session_table_alter_success', 'table alter successful calls', 'no_clear,no_scale'),
+ SessionOpStat('session_table_alter_trigger_checkpoint', 'table alter triggering checkpoint calls', 'no_clear,no_scale'),
SessionOpStat('session_table_compact_fail', 'table compact failed calls', 'no_clear,no_scale'),
SessionOpStat('session_table_compact_success', 'table compact successful calls', 'no_clear,no_scale'),
SessionOpStat('session_table_create_fail', 'table create failed calls', 'no_clear,no_scale'),
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 72a90223e13..14caeb944d5 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": "387b83a0394c004244383bea306bb4f3e641d249"
+ "commit": "be4dbb0d7e1dfda6e4a21ce6f2b99e351bb71172"
}
diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h
index 8cabf3ee413..3f574d16bc7 100644
--- a/src/third_party/wiredtiger/src/include/extern.h
+++ b/src/third_party/wiredtiger/src/include/extern.h
@@ -1357,6 +1357,8 @@ extern int __wt_scr_alloc_func(WT_SESSION_IMPL *session, size_t size, WT_ITEM **
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_search_insert(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
WT_INSERT_HEAD *ins_head, WT_ITEM *srch_key) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
+extern int __wt_session_blocking_checkpoint(WT_SESSION_IMPL *session, bool force, uint64_t seconds)
+ WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_session_breakpoint(WT_SESSION *wt_session)
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_session_close_internal(WT_SESSION_IMPL *session)
diff --git a/src/third_party/wiredtiger/src/include/stat.h b/src/third_party/wiredtiger/src/include/stat.h
index e590bae7f20..4e64a758999 100644
--- a/src/third_party/wiredtiger/src/include/stat.h
+++ b/src/third_party/wiredtiger/src/include/stat.h
@@ -689,6 +689,7 @@ struct __wt_connection_stats {
int64_t session_query_ts;
int64_t session_table_alter_fail;
int64_t session_table_alter_success;
+ int64_t session_table_alter_trigger_checkpoint;
int64_t session_table_alter_skip;
int64_t session_table_compact_fail;
int64_t session_table_compact_success;
diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in
index e292d1c74fd..c79f26b0525 100644
--- a/src/third_party/wiredtiger/src/include/wiredtiger.in
+++ b/src/third_party/wiredtiger/src/include/wiredtiger.in
@@ -5891,264 +5891,266 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection);
#define WT_STAT_CONN_SESSION_TABLE_ALTER_FAIL 1374
/*! session: table alter successful calls */
#define WT_STAT_CONN_SESSION_TABLE_ALTER_SUCCESS 1375
+/*! session: table alter triggering checkpoint calls */
+#define WT_STAT_CONN_SESSION_TABLE_ALTER_TRIGGER_CHECKPOINT 1376
/*! session: table alter unchanged and skipped */
-#define WT_STAT_CONN_SESSION_TABLE_ALTER_SKIP 1376
+#define WT_STAT_CONN_SESSION_TABLE_ALTER_SKIP 1377
/*! session: table compact failed calls */
-#define WT_STAT_CONN_SESSION_TABLE_COMPACT_FAIL 1377
+#define WT_STAT_CONN_SESSION_TABLE_COMPACT_FAIL 1378
/*! session: table compact successful calls */
-#define WT_STAT_CONN_SESSION_TABLE_COMPACT_SUCCESS 1378
+#define WT_STAT_CONN_SESSION_TABLE_COMPACT_SUCCESS 1379
/*! session: table create failed calls */
-#define WT_STAT_CONN_SESSION_TABLE_CREATE_FAIL 1379
+#define WT_STAT_CONN_SESSION_TABLE_CREATE_FAIL 1380
/*! session: table create successful calls */
-#define WT_STAT_CONN_SESSION_TABLE_CREATE_SUCCESS 1380
+#define WT_STAT_CONN_SESSION_TABLE_CREATE_SUCCESS 1381
/*! session: table drop failed calls */
-#define WT_STAT_CONN_SESSION_TABLE_DROP_FAIL 1381
+#define WT_STAT_CONN_SESSION_TABLE_DROP_FAIL 1382
/*! session: table drop successful calls */
-#define WT_STAT_CONN_SESSION_TABLE_DROP_SUCCESS 1382
+#define WT_STAT_CONN_SESSION_TABLE_DROP_SUCCESS 1383
/*! session: table rename failed calls */
-#define WT_STAT_CONN_SESSION_TABLE_RENAME_FAIL 1383
+#define WT_STAT_CONN_SESSION_TABLE_RENAME_FAIL 1384
/*! session: table rename successful calls */
-#define WT_STAT_CONN_SESSION_TABLE_RENAME_SUCCESS 1384
+#define WT_STAT_CONN_SESSION_TABLE_RENAME_SUCCESS 1385
/*! session: table salvage failed calls */
-#define WT_STAT_CONN_SESSION_TABLE_SALVAGE_FAIL 1385
+#define WT_STAT_CONN_SESSION_TABLE_SALVAGE_FAIL 1386
/*! session: table salvage successful calls */
-#define WT_STAT_CONN_SESSION_TABLE_SALVAGE_SUCCESS 1386
+#define WT_STAT_CONN_SESSION_TABLE_SALVAGE_SUCCESS 1387
/*! session: table truncate failed calls */
-#define WT_STAT_CONN_SESSION_TABLE_TRUNCATE_FAIL 1387
+#define WT_STAT_CONN_SESSION_TABLE_TRUNCATE_FAIL 1388
/*! session: table truncate successful calls */
-#define WT_STAT_CONN_SESSION_TABLE_TRUNCATE_SUCCESS 1388
+#define WT_STAT_CONN_SESSION_TABLE_TRUNCATE_SUCCESS 1389
/*! session: table verify failed calls */
-#define WT_STAT_CONN_SESSION_TABLE_VERIFY_FAIL 1389
+#define WT_STAT_CONN_SESSION_TABLE_VERIFY_FAIL 1390
/*! session: table verify successful calls */
-#define WT_STAT_CONN_SESSION_TABLE_VERIFY_SUCCESS 1390
+#define WT_STAT_CONN_SESSION_TABLE_VERIFY_SUCCESS 1391
/*! session: tiered operations dequeued and processed */
-#define WT_STAT_CONN_TIERED_WORK_UNITS_DEQUEUED 1391
+#define WT_STAT_CONN_TIERED_WORK_UNITS_DEQUEUED 1392
/*! session: tiered operations scheduled */
-#define WT_STAT_CONN_TIERED_WORK_UNITS_CREATED 1392
+#define WT_STAT_CONN_TIERED_WORK_UNITS_CREATED 1393
/*! session: tiered storage local retention time (secs) */
-#define WT_STAT_CONN_TIERED_RETENTION 1393
+#define WT_STAT_CONN_TIERED_RETENTION 1394
/*! session: tiered storage object size */
-#define WT_STAT_CONN_TIERED_OBJECT_SIZE 1394
+#define WT_STAT_CONN_TIERED_OBJECT_SIZE 1395
/*! thread-state: active filesystem fsync calls */
-#define WT_STAT_CONN_THREAD_FSYNC_ACTIVE 1395
+#define WT_STAT_CONN_THREAD_FSYNC_ACTIVE 1396
/*! thread-state: active filesystem read calls */
-#define WT_STAT_CONN_THREAD_READ_ACTIVE 1396
+#define WT_STAT_CONN_THREAD_READ_ACTIVE 1397
/*! thread-state: active filesystem write calls */
-#define WT_STAT_CONN_THREAD_WRITE_ACTIVE 1397
+#define WT_STAT_CONN_THREAD_WRITE_ACTIVE 1398
/*! thread-yield: application thread time evicting (usecs) */
-#define WT_STAT_CONN_APPLICATION_EVICT_TIME 1398
+#define WT_STAT_CONN_APPLICATION_EVICT_TIME 1399
/*! thread-yield: application thread time waiting for cache (usecs) */
-#define WT_STAT_CONN_APPLICATION_CACHE_TIME 1399
+#define WT_STAT_CONN_APPLICATION_CACHE_TIME 1400
/*!
* thread-yield: connection close blocked waiting for transaction state
* stabilization
*/
-#define WT_STAT_CONN_TXN_RELEASE_BLOCKED 1400
+#define WT_STAT_CONN_TXN_RELEASE_BLOCKED 1401
/*! thread-yield: connection close yielded for lsm manager shutdown */
-#define WT_STAT_CONN_CONN_CLOSE_BLOCKED_LSM 1401
+#define WT_STAT_CONN_CONN_CLOSE_BLOCKED_LSM 1402
/*! thread-yield: data handle lock yielded */
-#define WT_STAT_CONN_DHANDLE_LOCK_BLOCKED 1402
+#define WT_STAT_CONN_DHANDLE_LOCK_BLOCKED 1403
/*!
* thread-yield: get reference for page index and slot time sleeping
* (usecs)
*/
-#define WT_STAT_CONN_PAGE_INDEX_SLOT_REF_BLOCKED 1403
+#define WT_STAT_CONN_PAGE_INDEX_SLOT_REF_BLOCKED 1404
/*! thread-yield: page access yielded due to prepare state change */
-#define WT_STAT_CONN_PREPARED_TRANSITION_BLOCKED_PAGE 1404
+#define WT_STAT_CONN_PREPARED_TRANSITION_BLOCKED_PAGE 1405
/*! thread-yield: page acquire busy blocked */
-#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1405
+#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1406
/*! thread-yield: page acquire eviction blocked */
-#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1406
+#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1407
/*! thread-yield: page acquire locked blocked */
-#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1407
+#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1408
/*! thread-yield: page acquire read blocked */
-#define WT_STAT_CONN_PAGE_READ_BLOCKED 1408
+#define WT_STAT_CONN_PAGE_READ_BLOCKED 1409
/*! thread-yield: page acquire time sleeping (usecs) */
-#define WT_STAT_CONN_PAGE_SLEEP 1409
+#define WT_STAT_CONN_PAGE_SLEEP 1410
/*!
* thread-yield: page delete rollback time sleeping for state change
* (usecs)
*/
-#define WT_STAT_CONN_PAGE_DEL_ROLLBACK_BLOCKED 1410
+#define WT_STAT_CONN_PAGE_DEL_ROLLBACK_BLOCKED 1411
/*! thread-yield: page reconciliation yielded due to child modification */
-#define WT_STAT_CONN_CHILD_MODIFY_BLOCKED_PAGE 1411
+#define WT_STAT_CONN_CHILD_MODIFY_BLOCKED_PAGE 1412
/*! transaction: Number of prepared updates */
-#define WT_STAT_CONN_TXN_PREPARED_UPDATES 1412
+#define WT_STAT_CONN_TXN_PREPARED_UPDATES 1413
/*! transaction: Number of prepared updates committed */
-#define WT_STAT_CONN_TXN_PREPARED_UPDATES_COMMITTED 1413
+#define WT_STAT_CONN_TXN_PREPARED_UPDATES_COMMITTED 1414
/*! transaction: Number of prepared updates repeated on the same key */
-#define WT_STAT_CONN_TXN_PREPARED_UPDATES_KEY_REPEATED 1414
+#define WT_STAT_CONN_TXN_PREPARED_UPDATES_KEY_REPEATED 1415
/*! transaction: Number of prepared updates rolled back */
-#define WT_STAT_CONN_TXN_PREPARED_UPDATES_ROLLEDBACK 1415
+#define WT_STAT_CONN_TXN_PREPARED_UPDATES_ROLLEDBACK 1416
/*! transaction: prepared transactions */
-#define WT_STAT_CONN_TXN_PREPARE 1416
+#define WT_STAT_CONN_TXN_PREPARE 1417
/*! transaction: prepared transactions committed */
-#define WT_STAT_CONN_TXN_PREPARE_COMMIT 1417
+#define WT_STAT_CONN_TXN_PREPARE_COMMIT 1418
/*! transaction: prepared transactions currently active */
-#define WT_STAT_CONN_TXN_PREPARE_ACTIVE 1418
+#define WT_STAT_CONN_TXN_PREPARE_ACTIVE 1419
/*! transaction: prepared transactions rolled back */
-#define WT_STAT_CONN_TXN_PREPARE_ROLLBACK 1419
+#define WT_STAT_CONN_TXN_PREPARE_ROLLBACK 1420
/*! transaction: query timestamp calls */
-#define WT_STAT_CONN_TXN_QUERY_TS 1420
+#define WT_STAT_CONN_TXN_QUERY_TS 1421
/*! transaction: race to read prepared update retry */
-#define WT_STAT_CONN_TXN_READ_RACE_PREPARE_UPDATE 1421
+#define WT_STAT_CONN_TXN_READ_RACE_PREPARE_UPDATE 1422
/*! transaction: rollback to stable calls */
-#define WT_STAT_CONN_TXN_RTS 1422
+#define WT_STAT_CONN_TXN_RTS 1423
/*!
* transaction: rollback to stable history store records with stop
* timestamps older than newer records
*/
-#define WT_STAT_CONN_TXN_RTS_HS_STOP_OLDER_THAN_NEWER_START 1423
+#define WT_STAT_CONN_TXN_RTS_HS_STOP_OLDER_THAN_NEWER_START 1424
/*! transaction: rollback to stable inconsistent checkpoint */
-#define WT_STAT_CONN_TXN_RTS_INCONSISTENT_CKPT 1424
+#define WT_STAT_CONN_TXN_RTS_INCONSISTENT_CKPT 1425
/*! transaction: rollback to stable keys removed */
-#define WT_STAT_CONN_TXN_RTS_KEYS_REMOVED 1425
+#define WT_STAT_CONN_TXN_RTS_KEYS_REMOVED 1426
/*! transaction: rollback to stable keys restored */
-#define WT_STAT_CONN_TXN_RTS_KEYS_RESTORED 1426
+#define WT_STAT_CONN_TXN_RTS_KEYS_RESTORED 1427
/*! transaction: rollback to stable pages visited */
-#define WT_STAT_CONN_TXN_RTS_PAGES_VISITED 1427
+#define WT_STAT_CONN_TXN_RTS_PAGES_VISITED 1428
/*! transaction: rollback to stable restored tombstones from history store */
-#define WT_STAT_CONN_TXN_RTS_HS_RESTORE_TOMBSTONES 1428
+#define WT_STAT_CONN_TXN_RTS_HS_RESTORE_TOMBSTONES 1429
/*! transaction: rollback to stable restored updates from history store */
-#define WT_STAT_CONN_TXN_RTS_HS_RESTORE_UPDATES 1429
+#define WT_STAT_CONN_TXN_RTS_HS_RESTORE_UPDATES 1430
/*! transaction: rollback to stable skipping delete rle */
-#define WT_STAT_CONN_TXN_RTS_DELETE_RLE_SKIPPED 1430
+#define WT_STAT_CONN_TXN_RTS_DELETE_RLE_SKIPPED 1431
/*! transaction: rollback to stable skipping stable rle */
-#define WT_STAT_CONN_TXN_RTS_STABLE_RLE_SKIPPED 1431
+#define WT_STAT_CONN_TXN_RTS_STABLE_RLE_SKIPPED 1432
/*! transaction: rollback to stable sweeping history store keys */
-#define WT_STAT_CONN_TXN_RTS_SWEEP_HS_KEYS 1432
+#define WT_STAT_CONN_TXN_RTS_SWEEP_HS_KEYS 1433
/*! transaction: rollback to stable tree walk skipping pages */
-#define WT_STAT_CONN_TXN_RTS_TREE_WALK_SKIP_PAGES 1433
+#define WT_STAT_CONN_TXN_RTS_TREE_WALK_SKIP_PAGES 1434
/*! transaction: rollback to stable updates aborted */
-#define WT_STAT_CONN_TXN_RTS_UPD_ABORTED 1434
+#define WT_STAT_CONN_TXN_RTS_UPD_ABORTED 1435
/*! transaction: rollback to stable updates removed from history store */
-#define WT_STAT_CONN_TXN_RTS_HS_REMOVED 1435
+#define WT_STAT_CONN_TXN_RTS_HS_REMOVED 1436
/*! transaction: sessions scanned in each walk of concurrent sessions */
-#define WT_STAT_CONN_TXN_SESSIONS_WALKED 1436
+#define WT_STAT_CONN_TXN_SESSIONS_WALKED 1437
/*! transaction: set timestamp calls */
-#define WT_STAT_CONN_TXN_SET_TS 1437
+#define WT_STAT_CONN_TXN_SET_TS 1438
/*! transaction: set timestamp durable calls */
-#define WT_STAT_CONN_TXN_SET_TS_DURABLE 1438
+#define WT_STAT_CONN_TXN_SET_TS_DURABLE 1439
/*! transaction: set timestamp durable updates */
-#define WT_STAT_CONN_TXN_SET_TS_DURABLE_UPD 1439
+#define WT_STAT_CONN_TXN_SET_TS_DURABLE_UPD 1440
/*! transaction: set timestamp oldest calls */
-#define WT_STAT_CONN_TXN_SET_TS_OLDEST 1440
+#define WT_STAT_CONN_TXN_SET_TS_OLDEST 1441
/*! transaction: set timestamp oldest updates */
-#define WT_STAT_CONN_TXN_SET_TS_OLDEST_UPD 1441
+#define WT_STAT_CONN_TXN_SET_TS_OLDEST_UPD 1442
/*! transaction: set timestamp stable calls */
-#define WT_STAT_CONN_TXN_SET_TS_STABLE 1442
+#define WT_STAT_CONN_TXN_SET_TS_STABLE 1443
/*! transaction: set timestamp stable updates */
-#define WT_STAT_CONN_TXN_SET_TS_STABLE_UPD 1443
+#define WT_STAT_CONN_TXN_SET_TS_STABLE_UPD 1444
/*! transaction: transaction begins */
-#define WT_STAT_CONN_TXN_BEGIN 1444
+#define WT_STAT_CONN_TXN_BEGIN 1445
/*! transaction: transaction checkpoint currently running */
-#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1445
+#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1446
/*!
* transaction: transaction checkpoint currently running for history
* store file
*/
-#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING_HS 1446
+#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING_HS 1447
/*! transaction: transaction checkpoint generation */
-#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1447
+#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1448
/*!
* transaction: transaction checkpoint history store file duration
* (usecs)
*/
-#define WT_STAT_CONN_TXN_HS_CKPT_DURATION 1448
+#define WT_STAT_CONN_TXN_HS_CKPT_DURATION 1449
/*! transaction: transaction checkpoint max time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1449
+#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1450
/*! transaction: transaction checkpoint min time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1450
+#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1451
/*!
* transaction: transaction checkpoint most recent duration for gathering
* all handles (usecs)
*/
-#define WT_STAT_CONN_TXN_CHECKPOINT_HANDLE_DURATION 1451
+#define WT_STAT_CONN_TXN_CHECKPOINT_HANDLE_DURATION 1452
/*!
* transaction: transaction checkpoint most recent duration for gathering
* applied handles (usecs)
*/
-#define WT_STAT_CONN_TXN_CHECKPOINT_HANDLE_DURATION_APPLY 1452
+#define WT_STAT_CONN_TXN_CHECKPOINT_HANDLE_DURATION_APPLY 1453
/*!
* transaction: transaction checkpoint most recent duration for gathering
* skipped handles (usecs)
*/
-#define WT_STAT_CONN_TXN_CHECKPOINT_HANDLE_DURATION_SKIP 1453
+#define WT_STAT_CONN_TXN_CHECKPOINT_HANDLE_DURATION_SKIP 1454
/*! transaction: transaction checkpoint most recent handles applied */
-#define WT_STAT_CONN_TXN_CHECKPOINT_HANDLE_APPLIED 1454
+#define WT_STAT_CONN_TXN_CHECKPOINT_HANDLE_APPLIED 1455
/*! transaction: transaction checkpoint most recent handles skipped */
-#define WT_STAT_CONN_TXN_CHECKPOINT_HANDLE_SKIPPED 1455
+#define WT_STAT_CONN_TXN_CHECKPOINT_HANDLE_SKIPPED 1456
/*! transaction: transaction checkpoint most recent handles walked */
-#define WT_STAT_CONN_TXN_CHECKPOINT_HANDLE_WALKED 1456
+#define WT_STAT_CONN_TXN_CHECKPOINT_HANDLE_WALKED 1457
/*! transaction: transaction checkpoint most recent time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1457
+#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1458
/*! transaction: transaction checkpoint prepare currently running */
-#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_RUNNING 1458
+#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_RUNNING 1459
/*! transaction: transaction checkpoint prepare max time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_MAX 1459
+#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_MAX 1460
/*! transaction: transaction checkpoint prepare min time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_MIN 1460
+#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_MIN 1461
/*! transaction: transaction checkpoint prepare most recent time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_RECENT 1461
+#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_RECENT 1462
/*! transaction: transaction checkpoint prepare total time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_TOTAL 1462
+#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_TOTAL 1463
/*! transaction: transaction checkpoint scrub dirty target */
-#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TARGET 1463
+#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TARGET 1464
/*! transaction: transaction checkpoint scrub time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TIME 1464
+#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TIME 1465
/*! transaction: transaction checkpoint total time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1465
+#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1466
/*! transaction: transaction checkpoints */
-#define WT_STAT_CONN_TXN_CHECKPOINT 1466
+#define WT_STAT_CONN_TXN_CHECKPOINT 1467
/*! transaction: transaction checkpoints due to obsolete pages */
-#define WT_STAT_CONN_TXN_CHECKPOINT_OBSOLETE_APPLIED 1467
+#define WT_STAT_CONN_TXN_CHECKPOINT_OBSOLETE_APPLIED 1468
/*!
* transaction: transaction checkpoints skipped because database was
* clean
*/
-#define WT_STAT_CONN_TXN_CHECKPOINT_SKIPPED 1468
+#define WT_STAT_CONN_TXN_CHECKPOINT_SKIPPED 1469
/*! transaction: transaction failures due to history store */
-#define WT_STAT_CONN_TXN_FAIL_CACHE 1469
+#define WT_STAT_CONN_TXN_FAIL_CACHE 1470
/*!
* transaction: transaction fsync calls for checkpoint after allocating
* the transaction ID
*/
-#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST 1470
+#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST 1471
/*!
* transaction: transaction fsync duration for checkpoint after
* allocating the transaction ID (usecs)
*/
-#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST_DURATION 1471
+#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST_DURATION 1472
/*! transaction: transaction range of IDs currently pinned */
-#define WT_STAT_CONN_TXN_PINNED_RANGE 1472
+#define WT_STAT_CONN_TXN_PINNED_RANGE 1473
/*! transaction: transaction range of IDs currently pinned by a checkpoint */
-#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1473
+#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1474
/*! transaction: transaction range of timestamps currently pinned */
-#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP 1474
+#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP 1475
/*! transaction: transaction range of timestamps pinned by a checkpoint */
-#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_CHECKPOINT 1475
+#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_CHECKPOINT 1476
/*!
* transaction: transaction range of timestamps pinned by the oldest
* active read timestamp
*/
-#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_READER 1476
+#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_READER 1477
/*!
* transaction: transaction range of timestamps pinned by the oldest
* timestamp
*/
-#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_OLDEST 1477
+#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_OLDEST 1478
/*! transaction: transaction read timestamp of the oldest active reader */
-#define WT_STAT_CONN_TXN_TIMESTAMP_OLDEST_ACTIVE_READ 1478
+#define WT_STAT_CONN_TXN_TIMESTAMP_OLDEST_ACTIVE_READ 1479
/*! transaction: transaction rollback to stable currently running */
-#define WT_STAT_CONN_TXN_ROLLBACK_TO_STABLE_RUNNING 1479
+#define WT_STAT_CONN_TXN_ROLLBACK_TO_STABLE_RUNNING 1480
/*! transaction: transaction walk of concurrent sessions */
-#define WT_STAT_CONN_TXN_WALK_SESSIONS 1480
+#define WT_STAT_CONN_TXN_WALK_SESSIONS 1481
/*! transaction: transactions committed */
-#define WT_STAT_CONN_TXN_COMMIT 1481
+#define WT_STAT_CONN_TXN_COMMIT 1482
/*! transaction: transactions rolled back */
-#define WT_STAT_CONN_TXN_ROLLBACK 1482
+#define WT_STAT_CONN_TXN_ROLLBACK 1483
/*! transaction: update conflicts */
-#define WT_STAT_CONN_TXN_UPDATE_CONFLICT 1483
+#define WT_STAT_CONN_TXN_UPDATE_CONFLICT 1484
/*!
* @}
diff --git a/src/third_party/wiredtiger/src/session/session_api.c b/src/third_party/wiredtiger/src/session/session_api.c
index 62464af3c6a..877085a90c3 100644
--- a/src/third_party/wiredtiger/src/session/session_api.c
+++ b/src/third_party/wiredtiger/src/session/session_api.c
@@ -637,16 +637,13 @@ err:
}
/*
- * __session_alter --
- * Alter a table setting.
+ * __session_alter_internal --
+ * Internal implementation of the WT_SESSION.alter method.
*/
static int
-__session_alter(WT_SESSION *wt_session, const char *uri, const char *config)
+__session_alter_internal(WT_SESSION_IMPL *session, const char *uri, const char *config)
{
WT_DECL_RET;
- WT_SESSION_IMPL *session;
-
- session = (WT_SESSION_IMPL *)wt_session;
SESSION_API_CALL(session, alter, config, cfg);
@@ -675,6 +672,78 @@ err:
}
/*
+ * __wt_session_blocking_checkpoint --
+ * Perform a checkpoint or wait if it is already running to resolve an EBUSY error.
+ */
+int
+__wt_session_blocking_checkpoint(WT_SESSION_IMPL *session, bool force, uint64_t seconds)
+{
+ WT_DECL_RET;
+ WT_TXN_GLOBAL *txn_global;
+ uint64_t txn_gen;
+ const char *cfg[3] = {NULL, NULL, NULL};
+
+ cfg[0] = WT_CONFIG_BASE(session, WT_SESSION_checkpoint);
+ if (force)
+ cfg[1] = "force=1";
+
+ if ((ret = __wt_txn_checkpoint(session, cfg, false)) == 0)
+ return (0);
+ WT_RET_BUSY_OK(ret);
+
+ /*
+ * If there's a checkpoint running, wait for it to complete. If there's no checkpoint running or
+ * the checkpoint generation number changes, the checkpoint blocking us has completed.
+ */
+#define WT_CKPT_WAIT 2
+ txn_global = &S2C(session)->txn_global;
+ for (txn_gen = __wt_gen(session, WT_GEN_CHECKPOINT);; __wt_sleep(WT_CKPT_WAIT, 0)) {
+ /*
+ * This loop only checks objects that are declared volatile, therefore no barriers are
+ * needed.
+ */
+ if (!txn_global->checkpoint_running || txn_gen != __wt_gen(session, WT_GEN_CHECKPOINT))
+ break;
+
+ /* If there's a timeout, give up. */
+ if (seconds == 0)
+ continue;
+ if (seconds <= WT_CKPT_WAIT)
+ return (EBUSY);
+ seconds -= WT_CKPT_WAIT;
+ }
+
+ return (0);
+}
+
+/*
+ * __session_alter --
+ * Alter a table setting.
+ */
+static int
+__session_alter(WT_SESSION *wt_session, const char *uri, const char *config)
+{
+ WT_DECL_RET;
+ WT_SESSION_IMPL *session;
+
+ session = (WT_SESSION_IMPL *)wt_session;
+
+ /*
+ * Alter table can return EBUSY error when the table is modified in parallel by eviction. Retry
+ * the command after performing a system wide checkpoint. Only retry once to avoid potentially
+ * waiting forever.
+ */
+ ret = __session_alter_internal(session, uri, config);
+ if (ret == EBUSY) {
+ WT_RET(__wt_session_blocking_checkpoint(session, false, 0));
+ WT_STAT_CONN_INCR(session, session_table_alter_trigger_checkpoint);
+ ret = __session_alter_internal(session, uri, config);
+ }
+
+ return (ret);
+}
+
+/*
* __session_alter_readonly --
* WT_SESSION->alter method; readonly version.
*/
diff --git a/src/third_party/wiredtiger/src/session/session_compact.c b/src/third_party/wiredtiger/src/session/session_compact.c
index b4064eb1f69..1f83d6e4c83 100644
--- a/src/third_party/wiredtiger/src/session/session_compact.c
+++ b/src/third_party/wiredtiger/src/session/session_compact.c
@@ -193,53 +193,6 @@ __wt_session_compact_check_timeout(WT_SESSION_IMPL *session)
}
/*
- * __compact_checkpoint --
- * Perform a checkpoint for compaction.
- */
-static int
-__compact_checkpoint(WT_SESSION_IMPL *session)
-{
- WT_DECL_RET;
- WT_TXN_GLOBAL *txn_global;
- uint64_t txn_gen;
-
- /*
- * Force compaction checkpoints: we don't want to skip it because the work we need to have done
- * is done in the underlying block manager.
- */
- const char *checkpoint_cfg[] = {
- WT_CONFIG_BASE(session, WT_SESSION_checkpoint), "force=1", NULL};
-
- /* Checkpoints take a lot of time, check if we've run out. */
- WT_RET(__wt_session_compact_check_timeout(session));
-
- ret = __wt_txn_checkpoint(session, checkpoint_cfg, false);
- if (ret == 0)
- return (0);
- WT_RET_BUSY_OK(ret);
-
- /*
- * If there's a checkpoint running, wait for it to complete, checking if we're out of time. If
- * there's no checkpoint running or the checkpoint generation number changes, the checkpoint
- * blocking us has completed.
- */
- txn_global = &S2C(session)->txn_global;
- for (txn_gen = __wt_gen(session, WT_GEN_CHECKPOINT);;) {
- /*
- * This loop only checks objects that are declared volatile, therefore no barriers are
- * needed.
- */
- if (!txn_global->checkpoint_running || txn_gen != __wt_gen(session, WT_GEN_CHECKPOINT))
- break;
-
- WT_RET(__wt_session_compact_check_timeout(session));
- __wt_sleep(2, 0);
- }
-
- return (0);
-}
-
-/*
* __compact_worker --
* Function to alternate between checkpoints and compaction calls.
*/
@@ -260,7 +213,7 @@ __compact_worker(WT_SESSION_IMPL *session)
/*
* Perform an initial checkpoint (see this file's leading comment for details).
*/
- WT_ERR(__compact_checkpoint(session));
+ WT_ERR(__wt_session_blocking_checkpoint(session, true, session->compact->max_time));
/*
* We compact 10% of a file on each pass (but the overall size of the file is decreasing each
@@ -310,8 +263,8 @@ __compact_worker(WT_SESSION_IMPL *session)
/*
* Perform two checkpoints (see this file's leading comment for details).
*/
- WT_ERR(__compact_checkpoint(session));
- WT_ERR(__compact_checkpoint(session));
+ WT_ERR(__wt_session_blocking_checkpoint(session, true, session->compact->max_time));
+ WT_ERR(__wt_session_blocking_checkpoint(session, true, session->compact->max_time));
}
err:
diff --git a/src/third_party/wiredtiger/src/support/stat.c b/src/third_party/wiredtiger/src/support/stat.c
index c33d3b60bef..25cb80b8e40 100644
--- a/src/third_party/wiredtiger/src/support/stat.c
+++ b/src/third_party/wiredtiger/src/support/stat.c
@@ -1372,6 +1372,7 @@ static const char *const __stats_connection_desc[] = {
"session: session query timestamp calls",
"session: table alter failed calls",
"session: table alter successful calls",
+ "session: table alter triggering checkpoint calls",
"session: table alter unchanged and skipped",
"session: table compact failed calls",
"session: table compact successful calls",
@@ -1898,6 +1899,7 @@ __wt_stat_connection_clear_single(WT_CONNECTION_STATS *stats)
stats->session_query_ts = 0;
/* not clearing session_table_alter_fail */
/* not clearing session_table_alter_success */
+ /* not clearing session_table_alter_trigger_checkpoint */
/* not clearing session_table_alter_skip */
/* not clearing session_table_compact_fail */
/* not clearing session_table_compact_success */
@@ -2433,6 +2435,8 @@ __wt_stat_connection_aggregate(WT_CONNECTION_STATS **from, WT_CONNECTION_STATS *
to->session_query_ts += WT_STAT_READ(from, session_query_ts);
to->session_table_alter_fail += WT_STAT_READ(from, session_table_alter_fail);
to->session_table_alter_success += WT_STAT_READ(from, session_table_alter_success);
+ to->session_table_alter_trigger_checkpoint +=
+ WT_STAT_READ(from, session_table_alter_trigger_checkpoint);
to->session_table_alter_skip += WT_STAT_READ(from, session_table_alter_skip);
to->session_table_compact_fail += WT_STAT_READ(from, session_table_compact_fail);
to->session_table_compact_success += WT_STAT_READ(from, session_table_compact_success);
diff --git a/src/third_party/wiredtiger/test/suite/test_alter05.py b/src/third_party/wiredtiger/test/suite/test_alter05.py
new file mode 100644
index 00000000000..1105d0402f6
--- /dev/null
+++ b/src/third_party/wiredtiger/test/suite/test_alter05.py
@@ -0,0 +1,104 @@
+#!/usr/bin/env python
+#
+# Public Domain 2014-present MongoDB, Inc.
+# Public Domain 2008-2014 WiredTiger, Inc.
+#
+# This is free and unencumbered software released into the public domain.
+#
+# Anyone is free to copy, modify, publish, use, compile, sell, or
+# distribute this software, either in source code form or as a compiled
+# binary, for any purpose, commercial or non-commercial, and by any
+# means.
+#
+# In jurisdictions that recognize copyright laws, the author or authors
+# of this software dedicate any and all copyright interest in the
+# software to the public domain. We make this dedication for the benefit
+# of the public at large and to the detriment of our heirs and
+# successors. We intend this dedication to be an overt act of
+# relinquishment in perpetuity of all present and future rights to this
+# software under copyright law.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+import wiredtiger, wttest
+from wiredtiger import stat
+
+# test_alter05.py
+# Check the alter command succeeds even if the file is modified.
+class test_alter05(wttest.WiredTigerTestCase):
+ conn_config = "statistics=(all)"
+ name = "alter05"
+
+ def get_stat(self, stat):
+ stat_cursor = self.session.open_cursor('statistics:')
+ val = stat_cursor[stat][2]
+ stat_cursor.close()
+ return val
+
+ def verify_metadata(self, metastr):
+ c = self.session.open_cursor('metadata:', None, None)
+
+ # We must find a file type entry for this object and its value
+ # should contain the provided file meta string.
+ c.set_key('file:' + self.name)
+ self.assertNotEqual(c.search(), wiredtiger.WT_NOTFOUND)
+ value = c.get_value()
+ self.assertTrue(value.find(metastr) != -1)
+
+ c.close()
+
+ # Alter file to change the metadata and verify.
+ def test_alter05(self):
+ uri = "file:" + self.name
+ entries = 100
+ create_params = 'key_format=i,value_format=i,'
+
+ self.session.create(uri, create_params + "log=(enabled=true)")
+
+ # Pin oldest and stable to timestamp 1.
+ self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(1) +
+ ',stable_timestamp=' + self.timestamp_str(1))
+
+ # Verify the string in the metadata.
+ self.verify_metadata('log=(enabled=true)')
+
+ # Put some data in table.
+ self.session.begin_transaction()
+ c = self.session.open_cursor(uri, None)
+ for k in range(entries):
+ c[k+1] = 1
+ c.close()
+ self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(2))
+
+ prev_alter_chceckpoints = self.get_stat(stat.conn.session_table_alter_trigger_checkpoint)
+
+ # Alter the table and verify.
+ self.session.alter(uri, 'log=(enabled=false)')
+ self.verify_metadata('log=(enabled=false)')
+
+ alter_chceckpoints = self.get_stat(stat.conn.session_table_alter_trigger_checkpoint)
+ self.assertEqual(prev_alter_chceckpoints + 1, alter_chceckpoints)
+ prev_alter_chceckpoints = alter_chceckpoints
+
+ # Open a cursor, insert some data and try to alter with cursor open.
+ c2 = self.session.open_cursor(uri, None)
+ for k in range(entries):
+ c2[k+1] = 2
+
+ self.assertRaisesException(wiredtiger.WiredTigerError,
+ lambda: self.session.alter(uri, 'log=(enabled=true)'))
+ self.verify_metadata('log=(enabled=false)')
+
+ alter_chceckpoints = self.get_stat(stat.conn.session_table_alter_trigger_checkpoint)
+ self.assertEqual(prev_alter_chceckpoints + 1, alter_chceckpoints)
+
+ c2.close()
+
+if __name__ == '__main__':
+ wttest.run()