Commit f3e09918 authored by Rich Prohaska's avatar Rich Prohaska

Add a dirty bit to the BRT node object. This bit is set by code

that modifies the state of a BRT node object.  A node is unpinned with
its dirty bit passed to the cache table.



git-svn-id: file:///svn/tokudb@316 c7de825b-a66e-492c-adef-691d508d4ae1
parent 8c958bb6
...@@ -27,6 +27,7 @@ struct brtnode { ...@@ -27,6 +27,7 @@ struct brtnode {
unsigned int nodesize; unsigned int nodesize;
diskoff thisnodename; diskoff thisnodename;
int height; /* height is always >= 0. 0 for leaf, >0 for nonleaf. */ int height; /* height is always >= 0. 0 for leaf, >0 for nonleaf. */
int dirty;
union node { union node {
struct nonleaf { struct nonleaf {
int n_children; /* if n_children==TREE_FANOUT+1 then the tree needs to be rebalanced. */ int n_children; /* if n_children==TREE_FANOUT+1 then the tree needs to be rebalanced. */
...@@ -91,6 +92,10 @@ void brtnode_free (BRTNODE *node); ...@@ -91,6 +92,10 @@ void brtnode_free (BRTNODE *node);
//int write_brt_header (int fd, struct brt_header *header); //int write_brt_header (int fd, struct brt_header *header);
static inline void brtnode_set_dirty(BRTNODE node) {
node->dirty = 1;
}
#if 1 #if 1
#define DEADBEEF ((void*)0xDEADBEEF) #define DEADBEEF ((void*)0xDEADBEEF)
#else #else
......
...@@ -173,6 +173,7 @@ int deserialize_brtnode_from (int fd, diskoff off, BRTNODE *brtnode, int nodesiz ...@@ -173,6 +173,7 @@ int deserialize_brtnode_from (int fd, diskoff off, BRTNODE *brtnode, int nodesiz
result->nodesize = nodesize; // How to compute the nodesize? result->nodesize = nodesize; // How to compute the nodesize?
result->thisnodename = off; result->thisnodename = off;
result->height = rbuf_int(&rc); result->height = rbuf_int(&rc);
result->dirty = 0;
//printf("height==%d\n", result->height); //printf("height==%d\n", result->height);
if (result->height>0) { if (result->height>0) {
result->u.n.totalchildkeylens=0; result->u.n.totalchildkeylens=0;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment