Skip to content

Commit

Permalink
tools: handle short header read in offline_log_viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
jcsp committed Dec 15, 2022
1 parent 7f666f7 commit b492385
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/offline_log_viewer/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ def from_stream(f, index):
return None
assert len(data) == records_size
return Batch(index, header, data)
assert len(data) == 0

if len(data) < HEADER_SIZE:
# Short read, probably log being actively written or unclean shutdown
return None

def __len__(self):
return self.header.record_count
Expand Down

0 comments on commit b492385

Please sign in to comment.