/* * __wt_metadata_cursor_open -- * Opens a cursor on the metadata. */ int __wt_metadata_cursor_open( WT_SESSION_IMPL *session, const char *config, WT_CURSOR **cursorp) { WT_BTREE *btree; WT_DECL_RET; const char *open_cursor_cfg[] = { WT_CONFIG_BASE(session, WT_SESSION_open_cursor), config, NULL }; WT_WITHOUT_DHANDLE(session, ret = __wt_open_cursor( session, WT_METAFILE_URI, NULL, open_cursor_cfg, cursorp)); WT_RET(ret); /* * Retrieve the btree from the cursor, rather than the session because * we don't always switch the metadata handle in to the session before * entering this function. */ btree = ((WT_CURSOR_BTREE *)(*cursorp))->btree; /* * Special settings for metadata: skew eviction so metadata almost * always stays in cache and make sure metadata is logged if possible. * * Test before setting so updates can't race in subsequent opens (the * first update is safe because it's single-threaded from * wiredtiger_open). */ if (btree->evict_priority == 0) WT_WITH_BTREE(session, btree, __wt_evict_priority_set(session, WT_EVICT_INT_SKEW)); if (F_ISSET(btree, WT_BTREE_NO_LOGGING)) F_CLR(btree, WT_BTREE_NO_LOGGING); /* The metadata file always uses checkpoint IDs in visibility checks. */ btree->include_checkpoint_txn = true; return (0); }
/* * __bloom_open_cursor -- * Open a cursor to read from a Bloom filter. */ static int __bloom_open_cursor(WT_BLOOM *bloom, WT_CURSOR *owner) { WT_CURSOR *c; WT_SESSION_IMPL *session; const char *cfg[3]; if ((c = bloom->c) != NULL) return (0); session = bloom->session; cfg[0] = WT_CONFIG_BASE(session, WT_SESSION_open_cursor); cfg[1] = bloom->config; cfg[2] = NULL; c = NULL; WT_RET(__wt_open_cursor(session, bloom->uri, owner, cfg, &c)); /* Bump the cache priority for Bloom filters. */ __wt_evict_priority_set(session, WT_EVICT_INT_SKEW); bloom->c = c; return (0); }