skip the log force when TforceCommits() is called and the entire log has already been forced. The old behavior generated a redundant CRC entry and force wrote it.
This commit is contained in:
parent
9f0886a565
commit
5f705a4463
1 changed files with 8 additions and 2 deletions
|
@ -51,9 +51,15 @@ void stasis_log_group_force(stasis_log_group_force_t* lh, lsn_t lsn) {
|
||||||
// static int pendingCommits;
|
// static int pendingCommits;
|
||||||
|
|
||||||
pthread_mutex_lock(&lh->check_commit);
|
pthread_mutex_lock(&lh->check_commit);
|
||||||
|
lsn_t first_unstable = lh->log->first_unstable_lsn(lh->log,LOG_FORCE_COMMIT);
|
||||||
|
lsn_t next_available = lh->log->next_available_lsn(lh->log);
|
||||||
|
DEBUG(stderr, "state: lsn=%lld first_unstable=%lld next_available=%lld\n",
|
||||||
|
lsn, first_unstable, next_available);
|
||||||
if(lsn == INVALID_LSN) {
|
if(lsn == INVALID_LSN) {
|
||||||
lsn = lh->log->first_unstable_lsn(lh->log,LOG_FORCE_COMMIT);
|
lsn = next_available - 1;
|
||||||
} else if(lh->log->first_unstable_lsn(lh->log,LOG_FORCE_COMMIT) > lsn) {
|
}
|
||||||
|
if(first_unstable > lsn || first_unstable == next_available) {
|
||||||
|
DEBUG(stderr, "skipped group force\n");
|
||||||
pthread_mutex_unlock(&lh->check_commit);
|
pthread_mutex_unlock(&lh->check_commit);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue