Skip to content

Commit

Permalink
GEODE-10408: in case corrupted oplogs, use fullGII (apache#7834)
Browse files Browse the repository at this point in the history
  • Loading branch information
mivanac authored Aug 27, 2022
1 parent 1e6f850 commit cce1d7c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ public static boolean getBoolean(String sysProp, boolean def) {

private volatile Future<?> lastDelayedWrite;

private boolean dataCorrupted;

private static int calcCompactionThreshold(int ct) {
if (ct == DiskStoreFactory.DEFAULT_COMPACTION_THRESHOLD) {
// allow the old sys prop for backwards compat.
Expand Down Expand Up @@ -448,6 +450,8 @@ private static int calcCompactionThreshold(int ct) {

// start simple init

this.dataCorrupted = false;

isCompactionPossible = isOfflineCompacting() || (!isOffline()
&& (getAutoCompact() || getAllowForceCompaction() || ENABLE_NOTIFY_TO_ROLL));
maxAsyncItems = getQueueSize();
Expand Down Expand Up @@ -4739,4 +4743,12 @@ public float getDiskFreePercentage() {
}
return (100 - getDiskUsagePercentage());
}

public boolean isDataCorrupted() {
return dataCorrupted;
}

public void setDataCorrupted(boolean data) {
dataCorrupted = data;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,12 @@ GIIStatus getFromOne(Set<InternalDistributedMember> recipientSet, boolean target
MAXIMUM_UNFINISHED_OPERATIONS);
}
m.versionVector = null;

} else if (region.getDiskStore() != null && region.getDiskStore().isDataCorrupted()) {
if (isDebugEnabled) {
logger.debug("Data corrupted, do full GII instead");
}
m.versionVector = null;
} else {
if (recoveredRVV.isNewerThanOrCanFillExceptionsFor(remote_rvv)) {
m.versionVector = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,7 @@ private void readEndOfRecord(DataInput di) throws IOException {
int b = di.readByte();
if (b != END_OF_RECORD_ID) {
if (b == 0) {
parent.setDataCorrupted(true);
logger.warn(
"Detected a partial record in oplog file. Partial records can be caused by an abnormal shutdown in which case this warning can be safely ignored. They can also be caused by the oplog file being corrupted.");

Expand Down

0 comments on commit cce1d7c

Please sign in to comment.