diff options
author | Luke Chen <luke.chen@mongodb.com> | 2022-11-21 14:16:12 +1100 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-11-21 03:50:48 +0000 |
commit | d21a7491385af59f829a8b982def3064a1b21ae6 (patch) | |
tree | 72bcb8cc02aa9994f06b066c2b4d5dbdbd2c2614 | |
parent | eff237c48a77788d4d294f548e0d2b82210e960c (diff) | |
download | mongo-d21a7491385af59f829a8b982def3064a1b21ae6.tar.gz |
Import wiredtiger: 9a35c70af8a4e8c67b850d7982a77d5260fb5f08 from branch mongodb-6.2
ref: 2cb2316c04..9a35c70af8
for: 6.2.0-rc2
WT-9773 Fix mirrored table bulk load fail on cache pressure
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/bulk.c | 36 |
2 files changed, 23 insertions, 15 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 77b5124d330..001d6130100 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-6.2", - "commit": "2cb2316c04ed3eb46a983338c3db2dc690e26f32" + "commit": "9a35c70af8a4e8c67b850d7982a77d5260fb5f08" } diff --git a/src/third_party/wiredtiger/test/format/bulk.c b/src/third_party/wiredtiger/test/format/bulk.c index 5969324a8de..a88d3b3a9c4 100644 --- a/src/third_party/wiredtiger/test/format/bulk.c +++ b/src/third_party/wiredtiger/test/format/bulk.c @@ -86,7 +86,7 @@ table_load(TABLE *base, TABLE *table) uint32_t committed_keyno, keyno, rows_current, v; uint8_t bitv; char config[100], track_buf[128]; - bool is_bulk; + bool is_bulk, report_progress; conn = g.wts_conn; @@ -123,7 +123,7 @@ table_load(TABLE *base, TABLE *table) if (base == NULL) val_gen(table, NULL, &value, &bitv, keyno); else { - testutil_assert(read_op(base_cursor, NEXT, NULL) == 0); + testutil_check(read_op(base_cursor, NEXT, NULL)); testutil_check(base_cursor->get_value(base_cursor, &value)); val_to_flcs(table, &value, &bitv); } @@ -161,8 +161,12 @@ table_load(TABLE *base, TABLE *table) * row counter and continue. */ if ((ret = cursor->insert(cursor)) != 0) { - testutil_assertfmt( - ret == WT_CACHE_FULL || ret == WT_ROLLBACK, "WT_CURSOR.insert failed: %d", ret); + /* + * We cannot fail when loading mirrored table. Otherwise, we will encounter data + * mismatch in the future. + */ + testutil_assertfmt(base == NULL && (ret == WT_CACHE_FULL || ret == WT_ROLLBACK), + "WT_CURSOR.insert failed: %d", ret); if (g.transaction_timestamps_config) { bulk_rollback_transaction(session); @@ -187,19 +191,23 @@ table_load(TABLE *base, TABLE *table) } /* - * When first starting up, restart the enclosing transaction every 10 operations so we never - * end up with an empty object. After 5K records, restart the transaction every 5K records - * so we don't overflow the cache. + * When first starting up, report the progress for every 10 keys in the first 5K keys. After + * 5K records, report every 5K keys. */ - if ((keyno < 5000 && keyno % 10 == 0) || keyno % 5000 == 0) { - /* Report on progress. */ + report_progress = (keyno < 5000 && keyno % 10 == 0) || keyno % 5000 == 0; + /* Report on progress. */ + if (report_progress) track(track_buf, keyno); - if (g.transaction_timestamps_config) { - bulk_commit_transaction(session); - committed_keyno = keyno; - bulk_begin_transaction(session); - } + /* + * If we are loading a mirrored table, commit after each operation to ensure that we are not + * generating excessive cache pressure and we can successfully load the same content as the + * base table. Otherwise, commit if we report progress. + */ + if (g.transaction_timestamps_config && (report_progress || base != NULL)) { + bulk_commit_transaction(session); + committed_keyno = keyno; + bulk_begin_transaction(session); } } |