Fixed truncation bug (truncation is more aggressive now), and added more debugging info.
This commit is contained in:
parent
5f307ab820
commit
7bb0ce0d17
2 changed files with 11 additions and 6 deletions
|
@ -463,6 +463,7 @@ int truncateLog(lsn_t LSN) {
|
||||||
if(global_offset + sizeof(lsn_t) >= LSN) {
|
if(global_offset + sizeof(lsn_t) >= LSN) {
|
||||||
/* Another thread beat us to it...the log is already truncated
|
/* Another thread beat us to it...the log is already truncated
|
||||||
past the point requested, so just return. */
|
past the point requested, so just return. */
|
||||||
|
printf("Skipping truncate. global_offset = %ld, requested LSN = %ld\n", global_offset, LSN);
|
||||||
pthread_mutex_unlock(&truncateLog_mutex);
|
pthread_mutex_unlock(&truncateLog_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -530,6 +531,9 @@ int truncateLog(lsn_t LSN) {
|
||||||
|
|
||||||
perror("Error replacing old log file with new log file");
|
perror("Error replacing old log file with new log file");
|
||||||
return LLADD_IO_ERROR;
|
return LLADD_IO_ERROR;
|
||||||
|
} else {
|
||||||
|
printf("Truncation complete.\n");
|
||||||
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
int logFD = open (LOG_FILE, O_CREAT | O_WRONLY | O_APPEND | O_SYNC, S_IRWXU | S_IRWXG | S_IRWXO);
|
int logFD = open (LOG_FILE, O_CREAT | O_WRONLY | O_APPEND | O_SYNC, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
|
|
|
@ -171,12 +171,13 @@ int truncateNow() {
|
||||||
|
|
||||||
printf("Truncating to rec_lsn = %ld\n", rec_lsn);
|
printf("Truncating to rec_lsn = %ld\n", rec_lsn);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
if(rec_lsn != flushed) {
|
// What was this check for?!?
|
||||||
LogTruncate(rec_lsn);
|
//if(rec_lsn != flushed) {
|
||||||
return 1;
|
LogTruncate(rec_lsn);
|
||||||
} else {
|
return 1;
|
||||||
return 0;
|
// } else {
|
||||||
}
|
// return 0;
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue