Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
07dc3a31
Commit
07dc3a31
authored
Dec 06, 2007
by
Bradley C. Kuszmaul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of childkeylens. Addresses #126.
git-svn-id:
file:///svn/tokudb@964
c7de825b-a66e-492c-adef-691d508d4ae1
parent
caba0db6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
14 deletions
+4
-14
newbrt/brt-internal.h
newbrt/brt-internal.h
+1
-1
newbrt/brt-serialize-test.c
newbrt/brt-serialize-test.c
+0
-1
newbrt/brt-serialize.c
newbrt/brt-serialize.c
+3
-4
newbrt/brt.c
newbrt/brt.c
+0
-8
No files found.
newbrt/brt-internal.h
View file @
07dc3a31
...
...
@@ -73,7 +73,7 @@ struct brtnode {
Note: It is possible that Child 1's keys are == to child 0's key's, so it is
not necessarily true that child 1's keys are > childkeys[0].
However, in the absense of duplicate keys, child 1's keys *are* > childkeys[0]. */
unsigned
int
childkeylens
[
TREE_FANOUT
];
//
unsigned int childkeylens[TREE_FANOUT];
unsigned
char
pivotflags
[
TREE_FANOUT
];
DISKOFF
children
[
TREE_FANOUT
+
1
];
/* unused if height==0 */
/* Note: The last element of these arrays is used only temporarily while splitting a node. */
HASHTABLE
htables
[
TREE_FANOUT
+
1
];
...
...
newbrt/brt-serialize-test.c
View file @
07dc3a31
...
...
@@ -33,7 +33,6 @@ static void test_serialize(void) {
sn
.
u
.
n
.
n_children
=
2
;
hello_string
=
toku_strdup
(
"hello"
);
sn
.
u
.
n
.
childkeys
[
0
]
=
kv_pair_malloc
(
hello_string
,
6
,
0
,
0
);
sn
.
u
.
n
.
childkeylens
[
0
]
=
6
;
sn
.
u
.
n
.
totalchildkeylens
=
6
;
sn
.
u
.
n
.
pivotflags
[
0
]
=
42
;
sn
.
u
.
n
.
children
[
0
]
=
sn
.
nodesize
*
30
;
...
...
newbrt/brt-serialize.c
View file @
07dc3a31
...
...
@@ -281,7 +281,6 @@ int toku_deserialize_brtnode_from (int fd, DISKOFF off, BRTNODE *brtnode, int fl
for
(
i
=
0
;
i
<
TREE_FANOUT
;
i
++
)
{
result
->
u
.
n
.
child_subtree_fingerprints
[
i
]
=
0
;
result
->
u
.
n
.
childkeys
[
i
]
=
0
;
result
->
u
.
n
.
childkeylens
[
i
]
=
0
;
}
for
(
i
=
0
;
i
<
TREE_FANOUT
+
1
;
i
++
)
{
result
->
u
.
n
.
children
[
i
]
=
0
;
...
...
@@ -307,12 +306,12 @@ int toku_deserialize_brtnode_from (int fd, DISKOFF off, BRTNODE *brtnode, int fl
unsigned
int
keylen
,
datalen
;
rbuf_bytes
(
&
rc
,
&
keyptr
,
&
keylen
);
rbuf_bytes
(
&
rc
,
&
dataptr
,
&
datalen
);
result
->
u
.
n
.
childkeylens
[
i
]
=
keylen
+
datalen
;
result
->
u
.
n
.
childkeys
[
i
]
=
kv_pair_malloc
(
keyptr
,
keylen
,
dataptr
,
datalen
);
}
else
{
bytevec
childkeyptr
;
rbuf_bytes
(
&
rc
,
&
childkeyptr
,
&
result
->
u
.
n
.
childkeylens
[
i
]);
/* Returns a pointer into the rbuf. */
result
->
u
.
n
.
childkeys
[
i
]
=
kv_pair_malloc
((
void
*
)
childkeyptr
,
result
->
u
.
n
.
childkeylens
[
i
],
0
,
0
);
unsigned
int
cklen
;
rbuf_bytes
(
&
rc
,
&
childkeyptr
,
&
cklen
);
/* Returns a pointer into the rbuf. */
result
->
u
.
n
.
childkeys
[
i
]
=
kv_pair_malloc
((
void
*
)
childkeyptr
,
cklen
,
0
,
0
);
}
//printf(" key %d length=%d data=%s\n", i, result->childkeylens[i], result->childkeys[i]);
result
->
u
.
n
.
totalchildkeylens
+=
toku_brtnode_pivot_key_len
(
result
,
result
->
u
.
n
.
childkeys
[
i
]);
...
...
newbrt/brt.c
View file @
07dc3a31
...
...
@@ -478,27 +478,22 @@ static void brt_nonleaf_split (BRT t, BRTNODE node, BRTNODE *nodea, BRTNODE *nod
}
for
(
i
=
0
;
i
<
n_children_in_a
-
1
;
i
++
)
{
A
->
u
.
n
.
childkeys
[
i
]
=
node
->
u
.
n
.
childkeys
[
i
];
A
->
u
.
n
.
childkeylens
[
i
]
=
node
->
u
.
n
.
childkeylens
[
i
];
A
->
u
.
n
.
pivotflags
[
i
]
=
node
->
u
.
n
.
pivotflags
[
i
];
A
->
u
.
n
.
totalchildkeylens
+=
toku_brt_pivot_key_len
(
t
,
node
->
u
.
n
.
childkeys
[
i
]);
node
->
u
.
n
.
totalchildkeylens
-=
toku_brt_pivot_key_len
(
t
,
node
->
u
.
n
.
childkeys
[
i
]);
node
->
u
.
n
.
childkeys
[
i
]
=
0
;
node
->
u
.
n
.
childkeylens
[
i
]
=
0
;
}
splitk
->
data
=
(
void
*
)(
node
->
u
.
n
.
childkeys
[
n_children_in_a
-
1
]);
splitk
->
size
=
toku_brt_pivot_key_len
(
t
,
node
->
u
.
n
.
childkeys
[
n_children_in_a
-
1
]);
splitk
->
flags
=
node
->
u
.
n
.
pivotflags
[
n_children_in_a
-
1
];
node
->
u
.
n
.
totalchildkeylens
-=
toku_brt_pivot_key_len
(
t
,
node
->
u
.
n
.
childkeys
[
n_children_in_a
-
1
]);
node
->
u
.
n
.
childkeys
[
n_children_in_a
-
1
]
=
0
;
node
->
u
.
n
.
childkeylens
[
n_children_in_a
-
1
]
=
0
;
for
(
i
=
n_children_in_a
;
i
<
node
->
u
.
n
.
n_children
-
1
;
i
++
)
{
B
->
u
.
n
.
childkeys
[
i
-
n_children_in_a
]
=
node
->
u
.
n
.
childkeys
[
i
];
B
->
u
.
n
.
childkeylens
[
i
-
n_children_in_a
]
=
node
->
u
.
n
.
childkeylens
[
i
];
B
->
u
.
n
.
pivotflags
[
i
-
n_children_in_a
]
=
node
->
u
.
n
.
pivotflags
[
i
];
B
->
u
.
n
.
totalchildkeylens
+=
toku_brt_pivot_key_len
(
t
,
node
->
u
.
n
.
childkeys
[
i
]);
node
->
u
.
n
.
totalchildkeylens
-=
toku_brt_pivot_key_len
(
t
,
node
->
u
.
n
.
childkeys
[
i
]);
node
->
u
.
n
.
childkeys
[
i
]
=
0
;
node
->
u
.
n
.
childkeylens
[
i
]
=
0
;
}
assert
(
node
->
u
.
n
.
totalchildkeylens
==
0
);
...
...
@@ -695,11 +690,9 @@ static int handle_split_of_child (BRT t, BRTNODE node, int childnum,
// Slide the keys over
for
(
cnum
=
node
->
u
.
n
.
n_children
-
1
;
cnum
>
childnum
;
cnum
--
)
{
node
->
u
.
n
.
childkeys
[
cnum
]
=
node
->
u
.
n
.
childkeys
[
cnum
-
1
];
node
->
u
.
n
.
childkeylens
[
cnum
]
=
node
->
u
.
n
.
childkeylens
[
cnum
-
1
];
node
->
u
.
n
.
pivotflags
[
cnum
]
=
node
->
u
.
n
.
pivotflags
[
cnum
-
1
];
}
node
->
u
.
n
.
childkeys
[
childnum
]
=
(
void
*
)
childsplitk
->
data
;
node
->
u
.
n
.
childkeylens
[
childnum
]
=
childsplitk
->
size
;
node
->
u
.
n
.
pivotflags
[
childnum
]
=
childsplitk
->
flags
;
node
->
u
.
n
.
totalchildkeylens
+=
childsplitk
->
size
;
node
->
u
.
n
.
n_children
++
;
...
...
@@ -1768,7 +1761,6 @@ static int brt_init_new_root(BRT brt, BRTNODE nodea, BRTNODE nodeb, DBT splitk,
newroot
->
u
.
n
.
n_children
=
2
;
//printf("%s:%d Splitkey=%p %s\n", __FILE__, __LINE__, splitkey, splitkey);
newroot
->
u
.
n
.
childkeys
[
0
]
=
splitk
.
data
;
newroot
->
u
.
n
.
childkeylens
[
0
]
=
splitk
.
size
;
newroot
->
u
.
n
.
pivotflags
[
0
]
=
splitk
.
flags
;
newroot
->
u
.
n
.
totalchildkeylens
=
splitk
.
size
;
newroot
->
u
.
n
.
children
[
0
]
=
nodea
->
thisnodename
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment