summaryrefslogtreecommitdiff
path: root/src/include/btmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/btmem.h')
-rw-r--r--src/include/btmem.h110
1 files changed, 56 insertions, 54 deletions
diff --git a/src/include/btmem.h b/src/include/btmem.h
index 9bd835f5d09..43c1a309d52 100644
--- a/src/include/btmem.h
+++ b/src/include/btmem.h
@@ -435,6 +435,19 @@ struct __wt_page_modify {
};
/*
+ * WT_COL_RLE --
+ * Variable-length column-store pages have an array of page entries with RLE
+ * counts greater than 1 when reading the page, so it's not necessary to walk
+ * the page counting records to find a specific entry. We can do a binary search
+ * in this array, then an offset calculation to find the cell.
+ */
+WT_PACKED_STRUCT_BEGIN(__wt_col_rle)
+ uint64_t recno; /* Record number of first repeat. */
+ uint64_t rle; /* Repeat count. */
+ uint32_t indx; /* Slot of entry in col_var. */
+WT_PACKED_STRUCT_END
+
+/*
* WT_PAGE --
* The WT_PAGE structure describes the in-memory page information.
*/
@@ -515,53 +528,54 @@ struct __wt_page {
} while (0)
/* Row-store leaf page. */
- struct {
- WT_ROW *d; /* Key/value pairs */
- uint32_t entries; /* Entries */
- } row;
-#undef pg_row_d
-#define pg_row_d u.row.d
-#undef pg_row_entries
-#define pg_row_entries u.row.entries
+ WT_ROW *row; /* Key/value pairs */
+#undef pg_row
+#define pg_row u.row
/* Fixed-length column-store leaf page. */
- struct {
- uint8_t *bitf; /* Values */
- uint32_t entries; /* Entries */
- } col_fix;
+ uint8_t *fix_bitf; /* Values */
#undef pg_fix_bitf
-#define pg_fix_bitf u.col_fix.bitf
-#undef pg_fix_entries
-#define pg_fix_entries u.col_fix.entries
+#define pg_fix_bitf u.fix_bitf
/* Variable-length column-store leaf page. */
struct {
- WT_COL *d; /* Values */
+ WT_COL *col_var; /* Values */
/*
- * Variable-length column-store files maintain a list of
- * RLE entries on the page so it's unnecessary to walk
- * the page counting records to find a specific entry.
+ * Variable-length column-store pages have an array
+ * of page entries with RLE counts greater than 1 when
+ * reading the page, so it's not necessary to walk the
+ * page counting records to find a specific entry. We
+ * can do a binary search in this array, then an offset
+ * calculation to find the cell.
+ *
+ * It's a separate structure to keep the page structure
+ * as small as possible.
*/
- WT_COL_RLE *repeats; /* RLE array for lookups */
- uint32_t nrepeats; /* Number of repeat slots */
-
- uint32_t entries; /* Entries */
+ struct __wt_col_var_repeat {
+ uint32_t nrepeats; /* repeat slots */
+ WT_COL_RLE repeats[0]; /* lookup RLE array */
+ } *repeats;
+#define WT_COL_VAR_REPEAT_SET(page) \
+ ((page)->u.col_var.repeats != NULL)
} col_var;
-#undef pg_var_d
-#define pg_var_d u.col_var.d
+#undef pg_var
+#define pg_var u.col_var.col_var
#undef pg_var_repeats
-#define pg_var_repeats u.col_var.repeats
+#define pg_var_repeats u.col_var.repeats->repeats
#undef pg_var_nrepeats
-#define pg_var_nrepeats u.col_var.nrepeats
-#undef pg_var_entries
-#define pg_var_entries u.col_var.entries
+#define pg_var_nrepeats u.col_var.repeats->nrepeats
} u;
/*
- * The page's type and flags are positioned at the end of the WT_PAGE
- * union, it reduces cache misses in the row-store search function.
+ * Page entries, type and flags are positioned at the end of the WT_PAGE
+ * union to reduce cache misses in the row-store search function.
+ *
+ * The entries field only applies to leaf pages, internal pages use the
+ * page-index entries instead.
*/
+ uint32_t entries; /* Leaf page entries */
+
#define WT_PAGE_IS_INTERNAL(page) \
((page)->type == WT_PAGE_COL_INT || (page)->type == WT_PAGE_ROW_INT)
#define WT_PAGE_INVALID 0 /* Invalid page */
@@ -618,8 +632,8 @@ struct __wt_page {
#define WT_READGEN_START_VALUE 100
#define WT_READGEN_STEP 100
uint64_t read_gen;
- /* The evict pass generation for the page */
- uint64_t evict_pass_gen;
+
+ uint64_t evict_pass_gen; /* Eviction pass generation */
size_t memory_footprint; /* Memory attached to the page */
@@ -792,11 +806,11 @@ struct __wt_row { /* On-page key, on-page cell, or off-page WT_IKEY */
* Walk the entries of an in-memory row-store leaf page.
*/
#define WT_ROW_FOREACH(page, rip, i) \
- for ((i) = (page)->pg_row_entries, \
- (rip) = (page)->pg_row_d; (i) > 0; ++(rip), --(i))
+ for ((i) = (page)->entries, \
+ (rip) = (page)->pg_row; (i) > 0; ++(rip), --(i))
#define WT_ROW_FOREACH_REVERSE(page, rip, i) \
- for ((i) = (page)->pg_row_entries, \
- (rip) = (page)->pg_row_d + ((page)->pg_row_entries - 1); \
+ for ((i) = (page)->entries, \
+ (rip) = (page)->pg_row + ((page)->entries - 1); \
(i) > 0; --(rip), --(i))
/*
@@ -804,7 +818,7 @@ struct __wt_row { /* On-page key, on-page cell, or off-page WT_IKEY */
* Return the 0-based array offset based on a WT_ROW reference.
*/
#define WT_ROW_SLOT(page, rip) \
- ((uint32_t)(((WT_ROW *)(rip)) - (page)->pg_row_d))
+ ((uint32_t)(((WT_ROW *)(rip)) - (page)->pg_row))
/*
* WT_COL --
@@ -829,18 +843,6 @@ struct __wt_col {
};
/*
- * WT_COL_RLE --
- * In variable-length column store leaf pages, we build an array of entries
- * with RLE counts greater than 1 when reading the page. We can do a binary
- * search in this array, then an offset calculation to find the cell.
- */
-WT_PACKED_STRUCT_BEGIN(__wt_col_rle)
- uint64_t recno; /* Record number of first repeat. */
- uint64_t rle; /* Repeat count. */
- uint32_t indx; /* Slot of entry in col_var.d */
-WT_PACKED_STRUCT_END
-
-/*
* WT_COL_PTR, WT_COL_PTR_SET --
* Return/Set a pointer corresponding to the data offset. (If the item does
* not exist on the page, return a NULL.)
@@ -856,15 +858,15 @@ WT_PACKED_STRUCT_END
* Walk the entries of variable-length column-store leaf page.
*/
#define WT_COL_FOREACH(page, cip, i) \
- for ((i) = (page)->pg_var_entries, \
- (cip) = (page)->pg_var_d; (i) > 0; ++(cip), --(i))
+ for ((i) = (page)->entries, \
+ (cip) = (page)->pg_var; (i) > 0; ++(cip), --(i))
/*
* WT_COL_SLOT --
* Return the 0-based array offset based on a WT_COL reference.
*/
#define WT_COL_SLOT(page, cip) \
- ((uint32_t)(((WT_COL *)cip) - (page)->pg_var_d))
+ ((uint32_t)(((WT_COL *)cip) - (page)->pg_var))
/*
* WT_IKEY --
@@ -1041,7 +1043,7 @@ struct __wt_insert_head {
#define WT_ROW_INSERT_SMALLEST(page) \
((page)->modify == NULL || \
(page)->modify->mod_row_insert == NULL ? \
- NULL : (page)->modify->mod_row_insert[(page)->pg_row_entries])
+ NULL : (page)->modify->mod_row_insert[(page)->entries])
/*
* The column-store leaf page update lists are arrays of pointers to structures,