mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
cat the log file prior to scanning it refs[t:2432]
git-svn-id: file:///svn/toku/tokudb@18214 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
d968f27fc4
commit
0955312a20
1 changed files with 13 additions and 0 deletions
|
@ -55,10 +55,23 @@ static toku_off_t lc_file_len(const char *name) {
|
|||
return buf.st_size;
|
||||
}
|
||||
|
||||
static void catfile(const char *fname, void *buffer, size_t buffer_size) {
|
||||
int fd = open(fname, O_RDONLY);
|
||||
if (fd >= 0) {
|
||||
while (1) {
|
||||
ssize_t r = read(fd, buffer, buffer_size);
|
||||
if ((int)r <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static int lc_open_logfile(TOKULOGCURSOR lc, int index) {
|
||||
int r=0;
|
||||
assert( !lc->is_open );
|
||||
if( index == -1 || index >= lc->n_logfiles) return DB_NOTFOUND;
|
||||
catfile(lc->logfiles[index], lc->buffer, lc->buffer_size);
|
||||
lc->cur_fp = fopen(lc->logfiles[index], "rb");
|
||||
if ( lc->cur_fp == NULL )
|
||||
return DB_NOTFOUND;
|
||||
|
|
Loading…
Add table
Reference in a new issue