Skip to content

Commit 7351ff8

Browse files
author
Lev Berman
committed
Clean up sync record false positives on chunk reads
1 parent cbb0b20 commit 7351ff8

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

apps/arweave/src/ar_data_sync.erl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,12 +1388,21 @@ read_chunk_with_metadata(
13881388
{error, chunk_not_found};
13891389
{ok, _, {AbsoluteOffset, _, _, _, _, _, ChunkSize}}
13901390
when AbsoluteOffset - SeekOffset >= ChunkSize ->
1391+
case ar_sync_record:delete(AbsoluteOffset - ChunkSize, SeekOffset - 1, ?MODULE,
1392+
StoreID) of
1393+
ok ->
1394+
?LOG_DEBUG([{event, clean_up_sync_record_false_positive},
1395+
{left, SeekOffset - 1}, {right, AbsoluteOffset - ChunkSize}]);
1396+
Err ->
1397+
?LOG_WARNING([{event, failed_to_clean_up_sync_record},
1398+
{error, io_lib:format("~p", [Err])}])
1399+
end,
13911400
{error, chunk_not_found};
13921401
{ok, _, {AbsoluteOffset, ChunkDataKey, TXRoot, _, TXPath, _, ChunkSize}} ->
13931402
case read_chunk(AbsoluteOffset, {chunk_data_db, StoreID}, ChunkDataKey, StoreID) of
13941403
not_found ->
1395-
invalidate_bad_data_record({SeekOffset - 1, AbsoluteOffset, {chunks_index, StoreID},
1396-
StoreID, 1}),
1404+
invalidate_bad_data_record({SeekOffset - 1, AbsoluteOffset,
1405+
{chunks_index, StoreID}, StoreID, 1}),
13971406
{error, chunk_not_found};
13981407
{error, Error} ->
13991408
?LOG_ERROR([{event, failed_to_read_chunk},

0 commit comments

Comments
 (0)