Fragment 1:
|
// Skip earlier days |
|
if (replicator->lastCheckedDay.empty() && replicator->lastCheckedDay == ent->d_name) |
|
continue; |
This condition looks incorrect and can never trigger, so the whole set of available log files will re-enqueue on each round. Was it supposed to be !replicator->lastCheckedDay.empty() && replicator->lastCheckedDay.compare(ent->d_name) >= 0 ?
Fragment 2:
|
if (!newLastCheckedDay.empty() || (!replicator->lastCheckedDay.empty() && replicator->lastCheckedDay.compare(newLastCheckedDay) < 0)) { |
|
if (unlikely(replicator->ctx->isTraceSet(Ctx::TRACE::ARCHIVE_LIST))) |
|
replicator->ctx->logTrace(Ctx::TRACE::ARCHIVE_LIST, "updating last checked day to: " + newLastCheckedDay); |
|
replicator->lastCheckedDay = newLastCheckedDay; |
Similar here, looks like it has to be !newLastCheckedDay.empty() && (replicator->lastCheckedDay.empty() || replicator->lastCheckedDay.compare(newLastCheckedDay) < 0) if it means to update to later day.
Fragment 3:
|
if (newLastCheckedDay.empty() || (newLastCheckedDay != ent->d_name)) |
|
newLastCheckedDay = ent->d_name; |
Does this assume
readdir iterates in ascending name order? This assumption may not always hold.
Fragment 1:
OpenLogReplicator/src/replicator/Replicator.cpp
Lines 486 to 488 in 6bc92bc
This condition looks incorrect and can never trigger, so the whole set of available log files will re-enqueue on each round. Was it supposed to be
!replicator->lastCheckedDay.empty() && replicator->lastCheckedDay.compare(ent->d_name) >= 0?Fragment 2:
OpenLogReplicator/src/replicator/Replicator.cpp
Lines 533 to 536 in 6bc92bc
Similar here, looks like it has to be
!newLastCheckedDay.empty() && (replicator->lastCheckedDay.empty() || replicator->lastCheckedDay.compare(newLastCheckedDay) < 0)if it means to update to later day.Fragment 3:
OpenLogReplicator/src/replicator/Replicator.cpp
Lines 528 to 529 in 6bc92bc
Does this assume
readdiriterates in ascending name order? This assumption may not always hold.