Skip to content

Commit 31922a5

Browse files
ruby-oujoEvergreen Agent
authored andcommitted
Import wiredtiger: 288bc6e9d8861fac16adb16dd9116be85d6481cc from branch mongodb-master
ref: 3c4bad55a5..288bc6e9d8 for: 7.2.0-rc0 Revert "WT-11721 Chunk cache metadata file management
1 parent 74956f1 commit 31922a5

File tree

9 files changed

+5
-139
lines changed

9 files changed

+5
-139
lines changed

src/third_party/wiredtiger/dist/s_string.ok

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@ WideCharToMultiByte
425425
WinNT
426426
WiredTiger
427427
WiredTiger's
428-
WiredTigerCC
429428
WiredTigerCheckpoint
430429
WiredTigerChunkCache
431430
WiredTigerHS

src/third_party/wiredtiger/import.data

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"vendor": "wiredtiger",
33
"github": "wiredtiger/wiredtiger.git",
44
"branch": "mongodb-master",
5-
"commit": "3c4bad55a5e5ea77a5547381f777757349375e2a"
5+
"commit": "288bc6e9d8861fac16adb16dd9116be85d6481cc"
66
}

src/third_party/wiredtiger/src/block/block_open.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -328,17 +328,6 @@ __wt_desc_write(WT_SESSION_IMPL *session, WT_FH *fh, uint32_t allocsize)
328328
return (ret);
329329
}
330330

331-
/*
332-
* __file_is_wt_internal --
333-
* Check if a filename is one used by WiredTiger internal files.
334-
*/
335-
static bool
336-
__file_is_wt_internal(const char *name)
337-
{
338-
return (strcmp(name, WT_METAFILE) == 0 || strcmp(name, WT_HS_FILE) == 0 ||
339-
strcmp(name, WT_CC_METAFILE) == 0);
340-
}
341-
342331
/*
343332
* __desc_read --
344333
* Read and verify the file's metadata.
@@ -415,7 +404,7 @@ __desc_read(WT_SESSION_IMPL *session, uint32_t allocsize, WT_BLOCK *block)
415404
* file name, and is now frantically pounding their interrupt key.
416405
*/
417406
if (desc->magic != WT_BLOCK_MAGIC || !checksum_matched) {
418-
if (__file_is_wt_internal(block->name))
407+
if (strcmp(block->name, WT_METAFILE) == 0 || strcmp(block->name, WT_HS_FILE) == 0)
419408
WT_ERR_MSG(session, WT_TRY_SALVAGE,
420409
"%s is corrupted: calculated block checksum of %#" PRIx32
421410
" doesn't match expected checksum of %#" PRIx32,

src/third_party/wiredtiger/src/block_cache/block_chunkcache.c

Lines changed: 2 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -20,75 +20,6 @@
2020
#define WT_CHUNK_OFFSET(chunkcache, offset) \
2121
(wt_off_t)(((size_t)offset / (chunkcache)->chunk_size) * (chunkcache)->chunk_size)
2222

23-
/*
24-
* __chunkcache_create_metadata_file --
25-
* Create the table that will persistently track what chunk cache content is on disk.
26-
*/
27-
static int
28-
__chunkcache_create_metadata_file(
29-
WT_SESSION_IMPL *session, uint64_t capacity, unsigned int hashtable_size, size_t chunk_size)
30-
{
31-
char cfg[128];
32-
WT_RET(__wt_snprintf(cfg, sizeof(cfg),
33-
WT_CC_APP_META_FORMAT ",key_format=" WT_CC_KEY_FORMAT ",value_format=" WT_CC_VALUE_FORMAT,
34-
capacity, hashtable_size, chunk_size));
35-
36-
return (__wt_session_create(session, WT_CC_METAFILE_URI, cfg));
37-
}
38-
39-
/*
40-
* __chunkcache_get_metadata_config --
41-
* If present, retrieve the on-disk configuration for the chunk cache metadata file. The caller
42-
* must only use *config if *found is true. The caller is responsible for freeing the memory
43-
* allocated into *config.
44-
*/
45-
static int
46-
__chunkcache_get_metadata_config(WT_SESSION_IMPL *session, char **config)
47-
{
48-
WT_CURSOR *cursor;
49-
WT_DECL_RET;
50-
char *tmp;
51-
52-
*config = NULL;
53-
54-
WT_RET(__wt_metadata_cursor(session, &cursor));
55-
cursor->set_key(cursor, WT_CC_METAFILE_URI);
56-
WT_ERR(cursor->search(cursor));
57-
58-
WT_ERR(cursor->get_value(cursor, &tmp));
59-
WT_ERR(__wt_strdup(session, tmp, config));
60-
61-
err:
62-
WT_TRET(__wt_metadata_cursor_release(session, &cursor));
63-
return (ret);
64-
}
65-
66-
/*
67-
* __chunkcache_verify_metadata_config --
68-
* Check that the existing chunk cache configuration is compatible with our current
69-
* configuration (and ergo, whether we can reuse the chunk cache contents).
70-
*/
71-
static int
72-
__chunkcache_verify_metadata_config(WT_SESSION_IMPL *session, char *md_config, uint64_t capacity,
73-
unsigned int hashtable_size, size_t chunk_size)
74-
{
75-
WT_DECL_RET;
76-
char tmp[128];
77-
78-
WT_RET(
79-
__wt_snprintf(tmp, sizeof(tmp), WT_CC_APP_META_FORMAT, capacity, hashtable_size, chunk_size));
80-
81-
if (strstr(md_config, tmp) == NULL) {
82-
__wt_verbose_error(session, WT_VERB_CHUNKCACHE,
83-
"stored chunk cache config (%s) incompatible with runtime config (%s)", md_config, tmp);
84-
ret = -1;
85-
}
86-
87-
/* FIXME-WT-11723 Open the underlying table just to verify it exists. */
88-
89-
return (ret);
90-
}
91-
9223
/*
9324
* __chunkcache_bitmap_find_free --
9425
* Iterate through the bitmap to find a free chunk in the cache.
@@ -972,13 +903,12 @@ __wt_chunkcache_setup(WT_SESSION_IMPL *session, const char *cfg[])
972903
WT_CONFIG_ITEM cval;
973904
WT_DECL_RET;
974905
unsigned int cnt, i;
975-
char *metadata_config, **pinned_objects;
906+
char **pinned_objects;
976907
size_t mapped_size;
977908

978909
chunkcache = &S2C(session)->chunkcache;
979-
cnt = 0;
980-
metadata_config = NULL;
981910
pinned_objects = NULL;
911+
cnt = 0;
982912

983913
if (F_ISSET(chunkcache, WT_CHUNKCACHE_CONFIGURED))
984914
WT_RET_MSG(session, EINVAL, "chunk cache setup requested, but cache is already configured");
@@ -1039,21 +969,6 @@ __wt_chunkcache_setup(WT_SESSION_IMPL *session, const char *cfg[])
1039969
WT_RET(__wt_calloc(session,
1040970
WT_CHUNKCACHE_BITMAP_SIZE(chunkcache->capacity, chunkcache->chunk_size), sizeof(uint8_t),
1041971
&chunkcache->free_bitmap));
1042-
1043-
/* Retrieve the chunk cache metadata config, and ensure it matches our startup config. */
1044-
ret = __chunkcache_get_metadata_config(session, &metadata_config);
1045-
if (ret == WT_NOTFOUND) {
1046-
WT_RET(__chunkcache_create_metadata_file(
1047-
session, chunkcache->capacity, chunkcache->hashtable_size, chunkcache->chunk_size));
1048-
__wt_verbose(session, WT_VERB_CHUNKCACHE, "%s", "created chunkcache metadata file");
1049-
} else if (ret == 0) {
1050-
WT_RET(__chunkcache_verify_metadata_config(session, metadata_config,
1051-
chunkcache->capacity, chunkcache->hashtable_size, chunkcache->chunk_size));
1052-
__wt_verbose(session, WT_VERB_CHUNKCACHE, "%s", "reused chunkcache metadata file");
1053-
} else {
1054-
WT_RET(ret);
1055-
}
1056-
__wt_free(session, metadata_config);
1057972
}
1058973

1059974
WT_RET(__wt_config_gets(session, cfg, "chunk_cache.flushed_data_cache_insertion", &cval));
@@ -1117,28 +1032,6 @@ __wt_chunkcache_teardown(WT_SESSION_IMPL *session)
11171032
return (ret);
11181033
}
11191034

1120-
/*
1121-
* __wt_chunkcache_salvage --
1122-
* Remove any knowledge of any extant chunk cache metadata. We can always rebuild the cache
1123-
* later, so make no attempt at a "real" salvage.
1124-
*/
1125-
int
1126-
__wt_chunkcache_salvage(WT_SESSION_IMPL *session)
1127-
{
1128-
WT_DECL_RET;
1129-
const char *drop_cfg[] = {WT_CONFIG_BASE(session, WT_SESSION_drop), NULL};
1130-
1131-
/* Check that we're holding the schema lock (or take it) before doing a schema operation. */
1132-
if (FLD_ISSET(session->lock_flags, WT_SESSION_LOCKED_SCHEMA))
1133-
ret = __wt_schema_drop(session, WT_CC_METAFILE_URI, drop_cfg);
1134-
else
1135-
WT_WITH_SCHEMA_LOCK(session, ret = __wt_schema_drop(session, WT_CC_METAFILE_URI, drop_cfg));
1136-
1137-
if (ret == ENOENT)
1138-
return (0);
1139-
return (ret);
1140-
}
1141-
11421035
#ifdef HAVE_UNITTEST
11431036

11441037
int

src/third_party/wiredtiger/src/conn/conn_api.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2947,6 +2947,7 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, const char *c
29472947
WT_ERR(__wt_verbose_config(session, cfg, false));
29482948
WT_ERR(__wt_timing_stress_config(session, cfg));
29492949
WT_ERR(__wt_blkcache_setup(session, cfg, false));
2950+
WT_ERR(__wt_chunkcache_setup(session, cfg));
29502951
WT_ERR(__wt_extra_diagnostics_config(session, cfg));
29512952
WT_ERR(__wt_conn_optrack_setup(session, cfg, false));
29522953
WT_ERR(__conn_session_size(session, cfg, &conn->session_size));
@@ -3159,9 +3160,6 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, const char *c
31593160
wt_session = &session->iface;
31603161
WT_ERR(__wt_copy_and_sync(wt_session, WT_METAFILE, WT_METAFILE_SLVG));
31613162
WT_ERR(wt_session->salvage(wt_session, WT_METAFILE_URI, NULL));
3162-
3163-
/* Now that the metadata is usable, see if we need to erase the chunk cache. */
3164-
WT_ERR(__wt_chunkcache_salvage(session));
31653163
}
31663164

31673165
/* Initialize connection values from stored metadata. */

src/third_party/wiredtiger/src/conn/conn_open.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,6 @@ __wt_connection_workers(WT_SESSION_IMPL *session, const char *cfg[])
228228
/* Initialize metadata tracking, required before creating tables. */
229229
WT_RET(__wt_meta_track_init(session));
230230

231-
/* Can create a table, so must be done after metadata tracking. */
232-
WT_RET(__wt_chunkcache_setup(session, cfg));
233-
234231
/*
235232
* Create the history store file. This will only actually create it on a clean upgrade or when
236233
* creating a new database.

src/third_party/wiredtiger/src/include/block_chunkcache.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88

99
/* WiredTiger's chunk cache. Locally caches chunks of remote objects. */
1010

11-
#define WT_CC_KEY_FORMAT WT_UNCHECKED_STRING(SLq)
12-
#define WT_CC_VALUE_FORMAT WT_UNCHECKED_STRING(QQ)
13-
#define WT_CC_APP_META_FORMAT \
14-
"app_metadata=\"version=1,capacity=%" PRIu64 ",buckets=%u,chunk_size=%" WT_SIZET_FMT "\""
15-
1611
struct __wt_chunkcache_hashid {
1712
const char *objectname;
1813
uint32_t objectid;

src/third_party/wiredtiger/src/include/extern.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,6 @@ extern int __wt_chunkcache_reconfig(WT_SESSION_IMPL *session, const char **cfg)
417417
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
418418
extern int __wt_chunkcache_remove(WT_SESSION_IMPL *session, WT_BLOCK *block, uint32_t objectid,
419419
wt_off_t offset, uint32_t size) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
420-
extern int __wt_chunkcache_salvage(WT_SESSION_IMPL *session)
421-
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
422420
extern int __wt_chunkcache_setup(WT_SESSION_IMPL *session, const char *cfg[])
423421
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
424422
extern int __wt_chunkcache_teardown(WT_SESSION_IMPL *session)

src/third_party/wiredtiger/src/include/meta.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
#define WT_HS_FILE "WiredTigerHS.wt" /* History store table */
3535
#define WT_HS_URI "file:WiredTigerHS.wt" /* History store table URI */
3636

37-
#define WT_CC_METAFILE "WiredTigerCC.wt" /* Chunk cache metadata table */
38-
#define WT_CC_METAFILE_URI "file:WiredTigerCC.wt" /* Chunk cache metadata table URI */
39-
4037
#define WT_SYSTEM_PREFIX "system:" /* System URI prefix */
4138
#define WT_SYSTEM_CKPT_TS "checkpoint_timestamp" /* Checkpoint timestamp name */
4239
#define WT_SYSTEM_CKPT_URI "system:checkpoint" /* Checkpoint timestamp URI */

0 commit comments

Comments
 (0)