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
|
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 2008-2011 WiredTiger, Inc.
* All rights reserved.
*/
#include "wt_internal.h"
/*
* __wt_page_type_string --
* Return a string representing the page type.
*/
const char *
__wt_page_type_string(u_int type)
{
switch (type) {
case WT_PAGE_INVALID:
return ("invalid");
case WT_PAGE_COL_FIX:
return ("column-store fixed-length leaf");
case WT_PAGE_COL_INT:
return ("column-store internal");
case WT_PAGE_COL_VAR:
return ("column-store variable-length leaf");
case WT_PAGE_OVFL:
return ("overflow");
case WT_PAGE_ROW_INT:
return ("row-store internal");
case WT_PAGE_ROW_LEAF:
return ("row-store leaf");
case WT_PAGE_FREELIST:
return ("freelist");
default:
return ("unknown");
}
/* NOTREACHED */
}
/*
* __wt_cell_type_string --
* Return a string representing the cell type.
*/
const char *
__wt_cell_type_string(uint8_t type)
{
switch (type) {
case WT_CELL_ADDR:
return ("address");
case WT_CELL_DEL:
return ("deleted");
case WT_CELL_KEY:
return ("key");
case WT_CELL_KEY_OVFL:
return ("key-overflow");
case WT_CELL_KEY_SHORT:
return ("short-key");
case WT_CELL_VALUE:
return ("value");
case WT_CELL_VALUE_OVFL:
return ("value-overflow");
case WT_CELL_VALUE_SHORT:
return ("short-value");
default:
return ("illegal");
}
/* NOTREACHED */
}
/*
* __wt_page_addr_string --
* Figure out a page's "address" and load a buffer with a printable,
* nul-terminated representation of that address.
*/
const char *
__wt_page_addr_string(WT_SESSION_IMPL *session, WT_BUF *buf, WT_PAGE *page)
{
uint32_t size;
const uint8_t *addr;
if (WT_PAGE_IS_ROOT(page)) {
buf->data = "[Root]";
buf->size = WT_STORE_SIZE(strlen("[Root]"));
return (0);
}
__wt_get_addr(page->parent, page->parent_ref.ref, &addr, &size);
return (__wt_addr_string(session, buf, addr, size));
}
/*
* __wt_addr_string --
* Load a buffer with a printable, nul-terminated representation of an
* address.
*/
const char *
__wt_addr_string(
WT_SESSION_IMPL *session, WT_BUF *buf, const uint8_t *addr, uint32_t size)
{
if (addr == NULL) {
buf->data = WT_NOADDR;
buf->size = WT_STORE_SIZE(strlen(WT_NOADDR));
} else if (__wt_bm_addr_string(session, buf, addr, size) != 0) {
buf->data = "[Error]";
buf->size = WT_STORE_SIZE(strlen("[Error]"));
}
return ((char *)buf->data);
}
|