Skip to content

Commit

Permalink
update sanity check
Browse files Browse the repository at this point in the history
  • Loading branch information
vazois committed Nov 18, 2024
1 parent 4697db9 commit fb098b6
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ public unsafe void ProcessPrimaryStream(byte* record, int recordLength, long pre

var tail = storeWrapper.appendOnlyFile.TailAddress;
var nextPageBeginAddress = ((tail >> pageSizeBits) + 1) << pageSizeBits;
if (tail + recordLength > nextPageBeginAddress && nextPageBeginAddress != currentAddress)
if ((tail + recordLength <= nextPageBeginAddress && tail != currentAddress) ||
(tail + recordLength > nextPageBeginAddress && nextPageBeginAddress != currentAddress))
{
logger?.LogError("Divergent AOF Stream recordLength:{recordLength}; previousAddress:{previousAddress}; currentAddress:{currentAddress}; nextAddress:{nextAddress}; tailAddress{tail}", recordLength, previousAddress, currentAddress, nextAddress, tail);
throw new GarnetException($"Divergent AOF Stream recordLength:{recordLength}; previousAddress:{previousAddress}; currentAddress:{currentAddress}; nextAddress:{nextAddress}; tailAddress{tail}", LogLevel.Warning, clientResponse: false);
logger?.LogError("Divergent AOF Stream recordLength:{recordLength}; previousAddress:{previousAddress}; currentAddress:{currentAddress}; nextAddress:{nextAddress}; tailAddress:{tail}", recordLength, previousAddress, currentAddress, nextAddress, tail);
throw new GarnetException($"Divergent AOF Stream recordLength:{recordLength}; previousAddress:{previousAddress}; currentAddress:{currentAddress}; nextAddress:{nextAddress}; tailAddress:{tail}", LogLevel.Warning, clientResponse: false);
}

// Address check only if synchronous replication is enabled
Expand Down

0 comments on commit fb098b6

Please sign in to comment.