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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
25d6b8f4
Commit
25d6b8f4
authored
Jul 07, 2009
by
Bradley C. Kuszmaul
Committed by
Yoni Fogel
Apr 16, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1846.
git-svn-id:
file:///svn/toku/tokudb@13130
c7de825b-a66e-492c-adef-691d508d4ae1
parent
b5f1a01d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
107 deletions
+5
-107
newbrt/brt.c
newbrt/brt.c
+2
-4
newbrt/logformat.c
newbrt/logformat.c
+1
-24
newbrt/recover.c
newbrt/recover.c
+2
-79
No files found.
newbrt/brt.c
View file @
25d6b8f4
...
...
@@ -700,7 +700,7 @@ initialize_empty_brtnode (BRT t, BRTNODE n, BLOCKNUM nodename, int height, size_
}
static
int
brt_init_new_root
(
BRT
brt
,
BRTNODE
nodea
,
BRTNODE
nodeb
,
DBT
splitk
,
CACHEKEY
*
rootp
,
TOKULOGGER
logger
,
BRTNODE
*
newrootp
)
brt_init_new_root
(
BRT
brt
,
BRTNODE
nodea
,
BRTNODE
nodeb
,
DBT
splitk
,
CACHEKEY
*
rootp
,
TOKULOGGER
logger
__attribute__
((
__unused__
))
,
BRTNODE
*
newrootp
)
// Effect: Create a new root node whose two children are NODEA and NODEB, an dthe pivotkey is SPLITK.
// Store the new root's identity in *ROOTP, and the node in *NEWROOTP.
// Unpin nodea and nodeb.
...
...
@@ -714,7 +714,6 @@ brt_init_new_root(BRT brt, BRTNODE nodea, BRTNODE nodeb, DBT splitk, CACHEKEY *r
toku_allocate_blocknum
(
brt
->
h
->
blocktable
,
&
newroot_diskoff
,
brt
->
h
);
assert
(
newroot
);
newroot
->
ever_been_written
=
0
;
toku_log_changeunnamedroot
(
logger
,
(
LSN
*
)
0
,
0
,
toku_cachefile_filenum
(
brt
->
cf
),
*
rootp
,
newroot_diskoff
);
*
rootp
=
newroot_diskoff
;
initialize_empty_brtnode
(
brt
,
newroot
,
newroot_diskoff
,
new_height
,
0
);
//printf("new_root %lld %d %lld %lld\n", newroot_diskoff, newroot->height, nodea->thisnodename, nodeb->thisnodename);
...
...
@@ -2873,7 +2872,6 @@ brt_init_header_partial (BRT t) {
#ifdef __ICL
lh = lh; //Satisfy icl (variable set but unused)
#endif
//if ((r=toku_log_fheader(toku_txn_logger(txn), (LSN*)0, 0, toku_txn_get_txnid(txn), toku_cachefile_filenum(t->cf), lh))) { return r; }
}
#endif
BLOCKNUM
root
=
t
->
h
->
root
;
...
...
@@ -3308,7 +3306,7 @@ int toku_close_brt (BRT brt, TOKULOGGER logger, char **error_string) {
if
(
logger
)
{
assert
(
brt
->
fname
);
BYTESTRING
bs
=
{.
len
=
strlen
(
brt
->
fname
),
.
data
=
brt
->
fname
};
r
=
toku_log_
brt
close
(
logger
,
&
lsn
,
1
,
bs
,
toku_cachefile_filenum
(
brt
->
cf
));
// flush the log on close, otherwise it might not make it out.
r
=
toku_log_
f
close
(
logger
,
&
lsn
,
1
,
bs
,
toku_cachefile_filenum
(
brt
->
cf
));
// flush the log on close, otherwise it might not make it out.
if
(
r
!=
0
)
return
r
;
}
if
(
!
brt
->
h
->
panic
)
...
...
newbrt/logformat.c
View file @
25d6b8f4
...
...
@@ -101,41 +101,18 @@ const struct logtype logtypes[] = {
{
"commit"
,
'C'
,
FA
{{
"TXNID"
,
"txnid"
,
0
},
NULLFIELD
}},
{
"xabort"
,
'q'
,
FA
{{
"TXNID"
,
"txnid"
,
0
},
NULLFIELD
}},
{
"xbegin"
,
'b'
,
FA
{{
"TXNID"
,
"parenttxnid"
,
0
},
NULLFIELD
}},
#if 0
{"tl_delete", 'D', FA{{"FILENUM", "filenum", 0}, // tl logentries can be used, by themselves, to rebuild the whole DB from scratch.
{"BLOCKNUM", "blocknum", 0},
{"BYTESTRING", "key", 0},
{"BYTESTRING", "data", 0},
NULLFIELD}},
#endif
{
"fcreate"
,
'F'
,
FA
{{
"TXNID"
,
"txnid"
,
0
},
{
"FILENUM"
,
"filenum"
,
0
},
{
"BYTESTRING"
,
"fname"
,
0
},
{
"u_int32_t"
,
"mode"
,
"0%o"
},
NULLFIELD
}},
{
"fheader"
,
'H'
,
FA
{{
"TXNID"
,
"txnid"
,
0
},
{
"FILENUM"
,
"filenum"
,
0
},
{
"LOGGEDBRTHEADER"
,
"header"
,
0
},
NULLFIELD
}},
{
"changeunnamedroot"
,
'u'
,
FA
{{
"FILENUM"
,
"filenum"
,
0
},
{
"BLOCKNUM"
,
"oldroot"
,
0
},
{
"BLOCKNUM"
,
"newroot"
,
0
},
NULLFIELD
}},
{
"changenamedroot"
,
'n'
,
FA
{{
"FILENUM"
,
"filenum"
,
0
},
{
"BYTESTRING"
,
"name"
,
0
},
{
"BLOCKNUM"
,
"oldroot"
,
0
},
{
"BLOCKNUM"
,
"newroot"
,
0
},
NULLFIELD
}},
{
"fopen"
,
'O'
,
FA
{{
"TXNID"
,
"txnid"
,
0
},
{
"BYTESTRING"
,
"fname"
,
0
},
{
"FILENUM"
,
"filenum"
,
0
},
NULLFIELD
}},
{
"
brtclose"
,
'e'
,
FA
{{
"BYTESTRING"
,
"fname"
,
0
},
// brtclose is logged when a particular brt is closed
{
"
fclose"
,
'e'
,
FA
{{
"BYTESTRING"
,
"fname"
,
0
},
{
"FILENUM"
,
"filenum"
,
0
},
NULLFIELD
}},
{
"cfclose"
,
'o'
,
FA
{{
"BYTESTRING"
,
"fname"
,
0
},
// cfclose is logged when a cachefile actually closes ("cfclose" means cache file close)
{
"FILENUM"
,
"filenum"
,
0
},
NULLFIELD
}},
{
"enqrootentry"
,
'a'
,
FA
{{
"FILENUM"
,
"filenum"
,
0
},
{
"TXNID"
,
"xid"
,
0
},
{
"u_int32_t"
,
"typ"
,
0
},
...
...
newbrt/recover.c
View file @
25d6b8f4
...
...
@@ -200,44 +200,6 @@ static int toku_recover_backward_fcreate (struct logtype_fcreate *l, struct back
return
0
;
}
static
void
toku_recover_fheader
(
LSN
UU
(
lsn
),
TXNID
UU
(
txnid
),
FILENUM
filenum
,
LOGGEDBRTHEADER
header
)
{
struct
cf_pair
*
pair
=
NULL
;
int
r
=
find_cachefile
(
filenum
,
&
pair
);
assert
(
r
==
0
);
struct
brt_header
*
MALLOC
(
h
);
assert
(
h
);
h
->
dirty
=
0
;
h
->
panic
=
0
;
h
->
panic_string
=
0
;
h
->
flags
=
header
.
flags
;
h
->
nodesize
=
header
.
nodesize
;
//toku_blocktable_create_from_loggedheader(&h->blocktable, header);
assert
(
0
);
//create from loggedheader disabled for now. //TODO: #1605
assert
(
h
->
blocktable
);
h
->
root
=
header
.
root
;
h
->
root_hash
.
valid
=
FALSE
;
//toku_cachetable_put(pair->cf, header_blocknum, fullhash, h, 0, toku_brtheader_flush_callback, toku_brtheader_fetch_callback, 0);
if
(
pair
->
brt
)
{
toku_free
(
pair
->
brt
->
h
);
}
else
{
r
=
toku_brt_create
(
&
pair
->
brt
);
assert
(
r
==
0
);
pair
->
brt
->
cf
=
pair
->
cf
;
list_init
(
&
pair
->
brt
->
cursors
);
pair
->
brt
->
compare_fun
=
0
;
pair
->
brt
->
dup_compare
=
0
;
pair
->
brt
->
db
=
0
;
}
pair
->
brt
->
h
=
h
;
pair
->
brt
->
nodesize
=
h
->
nodesize
;
pair
->
brt
->
flags
=
h
->
nodesize
;
toku_cachefile_set_userdata
(
pair
->
cf
,
pair
->
brt
->
h
,
toku_brtheader_close
,
toku_brtheader_checkpoint
,
toku_brtheader_begin_checkpoint
,
toku_brtheader_end_checkpoint
);
}
static
int
toku_recover_backward_fheader
(
struct
logtype_fheader
*
UU
(
l
),
struct
backward_scan_state
*
UU
(
bs
))
{
return
0
;
}
static
void
toku_recover_enqrootentry
(
LSN
lsn
__attribute__
((
__unused__
)),
FILENUM
filenum
,
TXNID
xid
,
u_int32_t
typ
,
BYTESTRING
key
,
BYTESTRING
val
)
{
struct
cf_pair
*
pair
=
NULL
;
...
...
@@ -266,7 +228,7 @@ static int toku_recover_backward_enqrootentry (struct logtype_enqrootentry *l, s
static
void
toku_recover_
brt
close
(
LSN
UU
(
lsn
),
BYTESTRING
UU
(
fname
),
FILENUM
filenum
)
{
toku_recover_
f
close
(
LSN
UU
(
lsn
),
BYTESTRING
UU
(
fname
),
FILENUM
filenum
)
{
struct
cf_pair
*
pair
=
NULL
;
int
r
=
find_cachefile
(
filenum
,
&
pair
);
assert
(
r
==
0
);
...
...
@@ -276,50 +238,11 @@ toku_recover_brtclose (LSN UU(lsn), BYTESTRING UU(fname), FILENUM filenum) {
toku_free_BYTESTRING
(
fname
);
}
static
int
toku_recover_backward_
brtclose
(
struct
logtype_brt
close
*
l
,
struct
backward_scan_state
*
UU
(
bs
))
{
static
int
toku_recover_backward_
fclose
(
struct
logtype_f
close
*
l
,
struct
backward_scan_state
*
UU
(
bs
))
{
toku_free_BYTESTRING
(
l
->
fname
);
return
0
;
}
static
void
toku_recover_cfclose
(
LSN
UU
(
lsn
),
BYTESTRING
UU
(
fname
),
FILENUM
filenum
)
{
int
i
;
for
(
i
=
0
;
i
<
n_cf_pairs
;
i
++
)
{
if
(
filenum
.
fileid
==
cf_pairs
[
i
].
filenum
.
fileid
)
{
int
r
=
toku_cachefile_close
(
&
cf_pairs
[
i
].
cf
,
0
,
0
,
ZERO_LSN
);
assert
(
r
==
0
);
cf_pairs
[
i
]
=
cf_pairs
[
n_cf_pairs
-
1
];
n_cf_pairs
--
;
break
;
}
}
toku_free_BYTESTRING
(
fname
);
}
static
int
toku_recover_backward_cfclose
(
struct
logtype_cfclose
*
UU
(
l
),
struct
backward_scan_state
*
UU
(
bs
))
{
return
0
;
}
static
void
toku_recover_changeunnamedroot
(
LSN
UU
(
lsn
),
FILENUM
filenum
,
BLOCKNUM
UU
(
oldroot
),
BLOCKNUM
newroot
)
{
struct
cf_pair
*
pair
=
NULL
;
int
r
=
find_cachefile
(
filenum
,
&
pair
);
assert
(
r
==
0
);
assert
(
pair
->
brt
);
assert
(
pair
->
brt
->
h
);
pair
->
brt
->
h
->
root
=
newroot
;
pair
->
brt
->
h
->
root_hash
.
valid
=
FALSE
;
}
static
int
toku_recover_backward_changeunnamedroot
(
struct
logtype_changeunnamedroot
*
UU
(
l
),
struct
backward_scan_state
*
UU
(
bs
))
{
return
0
;
}
static
void
toku_recover_changenamedroot
(
LSN
UU
(
lsn
),
FILENUM
UU
(
filenum
),
BYTESTRING
UU
(
name
),
BLOCKNUM
UU
(
oldroot
),
BLOCKNUM
UU
(
newroot
))
{
assert
(
0
);
}
static
int
toku_recover_backward_changenamedroot
(
struct
logtype_changenamedroot
*
UU
(
l
),
struct
backward_scan_state
*
UU
(
bs
))
{
return
0
;
}
static
int
toku_recover_begin_checkpoint
(
LSN
UU
(
lsn
))
{
return
0
;
}
...
...
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