Commit b3476b95 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Up roll.c coverage to 52.4% from 46.4%. Addresses #536.

git-svn-id: file:///svn/tokudb@2814 c7de825b-a66e-492c-adef-691d508d4ae1
parent 7988ee4b
...@@ -35,17 +35,17 @@ int tokudb_recover(const char *data_dir, const char *log_dir) { ...@@ -35,17 +35,17 @@ int tokudb_recover(const char *data_dir, const char *log_dir) {
lockfd = open(lockfname, O_RDWR|O_CREAT, S_IRUSR | S_IWUSR); lockfd = open(lockfname, O_RDWR|O_CREAT, S_IRUSR | S_IWUSR);
if (lockfd<0) { if (lockfd<0) {
printf("Couldn't open %s\n", lockfname); printf("Couldn't open %s\n", lockfname);
exit(1); return errno;
} }
r=flock(lockfd, LOCK_EX | LOCK_NB); r=flock(lockfd, LOCK_EX | LOCK_NB);
if (r!=0) { if (r!=0) {
printf("Couldn't run recovery because some other process holds the recovery lock %s\n", lockfname); printf("Couldn't run recovery because some other process holds the recovery lock %s\n", lockfname);
exit(1); return errno;
} }
} }
r = toku_logger_find_logfiles(log_dir, &n_logfiles, &logfiles); r = toku_logger_find_logfiles(log_dir, &n_logfiles, &logfiles);
if (r!=0) exit(1); if (r!=0) return r;
int i; int i;
toku_recover_init(); toku_recover_init();
char org_wd[1000]; char org_wd[1000];
...@@ -80,10 +80,10 @@ int tokudb_recover(const char *data_dir, const char *log_dir) { ...@@ -80,10 +80,10 @@ int tokudb_recover(const char *data_dir, const char *log_dir) {
if (r!=EOF) { if (r!=EOF) {
if (r==DB_BADFORMAT) { if (r==DB_BADFORMAT) {
fprintf(stderr, "Bad log format at record %d\n", entrycount); fprintf(stderr, "Bad log format at record %d\n", entrycount);
exit(1); return r;
} else { } else {
fprintf(stderr, "Huh? %s\n", strerror(r)); fprintf(stderr, "Huh? %s\n", strerror(r));
exit(1); return r;
} }
} }
fclose(f); fclose(f);
...@@ -95,6 +95,10 @@ int tokudb_recover(const char *data_dir, const char *log_dir) { ...@@ -95,6 +95,10 @@ int tokudb_recover(const char *data_dir, const char *log_dir) {
toku_free(logfiles); toku_free(logfiles);
r=flock(lockfd, LOCK_UN); r=flock(lockfd, LOCK_UN);
if (r!=0) return errno;
r=chdir(org_wd);
if (r!=0) return errno;
//printf("%s:%d recovery successful! ls -l says\n", __FILE__, __LINE__); //printf("%s:%d recovery successful! ls -l says\n", __FILE__, __LINE__);
//system("ls -l"); //system("ls -l");
......
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