summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/include/meta.h
blob: ac9e0be3c20c9f154335c682ee45a22806f056cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*-
 * Copyright (c) 2014-2019 MongoDB, Inc.
 * Copyright (c) 2008-2014 WiredTiger, Inc.
 *	All rights reserved.
 *
 * See the file LICENSE for redistribution information.
 */

#define	WT_WIREDTIGER		"WiredTiger"		/* Version file */
#define	WT_SINGLETHREAD		"WiredTiger.lock"	/* Locking file */

#define	WT_BASECONFIG		"WiredTiger.basecfg"	/* Base configuration */
#define	WT_BASECONFIG_SET	"WiredTiger.basecfg.set"/* Base config temp */

#define	WT_USERCONFIG		"WiredTiger.config"	/* User configuration */

#define	WT_BACKUP_TMP		"WiredTiger.backup.tmp"	/* Backup tmp file */
#define	WT_METADATA_BACKUP	"WiredTiger.backup"	/* Hot backup file */
#define	WT_INCREMENTAL_BACKUP	"WiredTiger.ibackup"	/* Incremental backup */
#define	WT_INCREMENTAL_SRC	"WiredTiger.isrc"	/* Incremental source */

#define	WT_METADATA_TURTLE	"WiredTiger.turtle"	/* Metadata metadata */
#define	WT_METADATA_TURTLE_SET	"WiredTiger.turtle.set"	/* Turtle temp file */

#define	WT_METADATA_URI		"metadata:"		/* Metadata alias */
#define	WT_METAFILE		"WiredTiger.wt"		/* Metadata table */
#define	WT_METAFILE_SLVG	"WiredTiger.wt.orig"	/* Metadata copy */
#define	WT_METAFILE_URI		"file:WiredTiger.wt"	/* Metadata table URI */

#define	WT_LAS_FILE		"WiredTigerLAS.wt"	/* Lookaside table */
#define	WT_LAS_URI		"file:WiredTigerLAS.wt"	/* Lookaside table URI*/

#define	WT_SYSTEM_PREFIX	"system:"		/* System URI prefix */
#define	WT_SYSTEM_CKPT_URI	"system:checkpoint"	/* Checkpoint URI */

/*
 * Optimize comparisons against the metafile URI, flag handles that reference
 * the metadata file.
 */
#define	WT_IS_METADATA(dh)      F_ISSET((dh), WT_DHANDLE_IS_METADATA)
#define	WT_METAFILE_ID		0			/* Metadata file ID */

#define	WT_METADATA_COMPAT	"Compatibility version"
#define	WT_METADATA_VERSION	"WiredTiger version"	/* Version keys */
#define	WT_METADATA_VERSION_STR	"WiredTiger version string"

/*
 * WT_WITH_TURTLE_LOCK --
 *	Acquire the turtle file lock, perform an operation, drop the lock.
 */
#define	WT_WITH_TURTLE_LOCK(session, op) do {				\
	WT_ASSERT(session, !F_ISSET(session, WT_SESSION_LOCKED_TURTLE));\
	WT_WITH_LOCK_WAIT(session,					\
	    &S2C(session)->turtle_lock, WT_SESSION_LOCKED_TURTLE, op);	\
} while (0)

/*
 * WT_CKPT --
 *	Encapsulation of checkpoint information, shared by the metadata, the
 * btree engine, and the block manager.
 */
#define	WT_CHECKPOINT		"WiredTigerCheckpoint"
#define	WT_CKPT_FOREACH(ckptbase, ckpt)					\
	for ((ckpt) = (ckptbase); (ckpt)->name != NULL; ++(ckpt))

struct __wt_ckpt {
	char	*name;			/* Name or NULL */

	/*
	 * Each internal checkpoint name is appended with a generation
	 * to make it a unique name.  We're solving two problems: when
	 * two checkpoints are taken quickly, the timer may not be
	 * unique and/or we can even see time travel on the second
	 * checkpoint if we snapshot the time in-between nanoseconds
	 * rolling over.  Second, if we reset the generational counter
	 * when new checkpoints arrive, we could logically re-create
	 * specific checkpoints, racing with cursors open on those
	 * checkpoints.  I can't think of any way to return incorrect
	 * results by racing with those cursors, but it's simpler not
	 * to worry about it.
	 */
	int64_t	 order;			/* Checkpoint order */

	uint64_t sec;                   /* Wall clock time */

	uint64_t size;			/* Checkpoint size */

	uint64_t write_gen;		/* Write generation */

	char	*block_metadata;	/* Block-stored metadata */
	char	*block_checkpoint;	/* Block-stored checkpoint */

					/* Validity window */
	wt_timestamp_t	newest_durable_ts;
	wt_timestamp_t	oldest_start_ts;
	uint64_t	oldest_start_txn;
	wt_timestamp_t	newest_stop_ts;
	uint64_t	newest_stop_txn;

	WT_ITEM  addr;			/* Checkpoint cookie string */
	WT_ITEM  raw;			/* Checkpoint cookie raw */

	void	*bpriv;			/* Block manager private */

/* AUTOMATIC FLAG VALUE GENERATION START */
#define	WT_CKPT_ADD	0x1u		/* Checkpoint to be added */
#define	WT_CKPT_DELETE	0x2u		/* Checkpoint to be deleted */
#define	WT_CKPT_FAKE	0x4u		/* Checkpoint is a fake */
#define	WT_CKPT_UPDATE	0x8u		/* Checkpoint requires update */
/* AUTOMATIC FLAG VALUE GENERATION STOP */
	uint32_t flags;
};