fix bug exposed by new group commit behavior; nextUnstableLSN was returning the offset of the beginning of the CRC entry, not the end of it. This was causing an assertion to fail.
This commit is contained in:
parent
250223086c
commit
f2ee7b6573
3 changed files with 18 additions and 4 deletions
|
@ -53,11 +53,11 @@ void stasis_log_group_force(stasis_log_group_force_t* lh, lsn_t lsn) {
|
|||
pthread_mutex_lock(&lh->check_commit);
|
||||
if(lsn == INVALID_LSN) {
|
||||
lsn = lh->log->first_unstable_lsn(lh->log,LOG_FORCE_COMMIT);
|
||||
}
|
||||
if(lh->log->first_unstable_lsn(lh->log,LOG_FORCE_COMMIT) > lsn) {
|
||||
} else if(lh->log->first_unstable_lsn(lh->log,LOG_FORCE_COMMIT) > lsn) {
|
||||
pthread_mutex_unlock(&lh->check_commit);
|
||||
return;
|
||||
}
|
||||
|
||||
if(lh->log->is_durable(lh->log)) {
|
||||
struct timeval now;
|
||||
struct timespec timeout;
|
||||
|
@ -97,7 +97,6 @@ void stasis_log_group_force(stasis_log_group_force_t* lh, lsn_t lsn) {
|
|||
if(lh->log->first_unstable_lsn(lh->log,LOG_FORCE_COMMIT) <= lsn) {
|
||||
lh->log->force_tail(lh->log, LOG_FORCE_COMMIT);
|
||||
lh->minNumActive = 0;
|
||||
assert(lh->log->first_unstable_lsn(lh->log,LOG_FORCE_COMMIT) > lsn);
|
||||
pthread_cond_broadcast(&lh->tooFewXacts);
|
||||
}
|
||||
assert(lh->log->first_unstable_lsn(lh->log,LOG_FORCE_COMMIT) > lsn);
|
||||
|
|
|
@ -421,7 +421,7 @@ static void syncLog_LogWriter(stasis_log_t * log,
|
|||
stasis_log_safe_writes_state* sw = log->impl;
|
||||
lsn_t newFlushedLSN;
|
||||
|
||||
newFlushedLSN = log_crc_entry(log);
|
||||
newFlushedLSN = log_crc_entry(log) + sizeofInternalLogEntry_LogWriter(log, 0);
|
||||
|
||||
fflush(sw->fp);
|
||||
|
||||
|
|
|
@ -594,12 +594,27 @@ START_TEST(loggerTruncateReopenTest) {
|
|||
reopenLogWorkload(1);
|
||||
} END_TEST
|
||||
|
||||
static void loggerEmptyForce_helper() {
|
||||
Tinit();
|
||||
int xid = Tbegin();
|
||||
TsoftCommit(xid);
|
||||
TforceCommits();
|
||||
Tdeinit();
|
||||
}
|
||||
START_TEST(loggerEmptyFileForceTest) {
|
||||
stasis_log_type = LOG_TO_FILE;
|
||||
} END_TEST
|
||||
START_TEST(loggerEmptyMemForceTest) {
|
||||
stasis_log_type = LOG_TO_MEMORY;
|
||||
} END_TEST
|
||||
Suite * check_suite(void) {
|
||||
Suite *s = suite_create("logWriter");
|
||||
/* Begin a new test */
|
||||
TCase *tc = tcase_create("writeNew");
|
||||
tcase_set_timeout(tc, 0);
|
||||
/* Sub tests are added, one per line, here */
|
||||
tcase_add_test(tc, loggerEmptyFileForceTest);
|
||||
tcase_add_test(tc, loggerEmptyMemForceTest);
|
||||
tcase_add_test(tc, loggerFileTest);
|
||||
tcase_add_test(tc, loggerMemTest);
|
||||
tcase_add_test(tc, logHandleFileColdReverseIterator);
|
||||
|
|
Loading…
Reference in a new issue