Skip to content

Commit

Permalink
fixed creation of journal file and skip bogus recover
Browse files Browse the repository at this point in the history
  • Loading branch information
noha committed Oct 2, 2024
1 parent 623ec54 commit d151a26
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/Soil-Core/SoilDatabaseRecovery.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,16 @@ SoilDatabaseRecovery >> recover [
fragmentFile := journal openFragmentForLSN: lastCheckpoint.
"The log sequence number of a successful checkpoint points to the checkpoint
entry that was last written"
checkpointEntry := SoilJournalEntry readFrom: fragmentFile stream.
checkpointEntry := [ SoilJournalEntry readFrom: fragmentFile stream ]
on: Error
do: [ :error |
"in case of a bogus checkpoint position we cannot recover the file but
create a new one and continue"
journal
currentFragmentFile: fragmentFile;
cycleFragmentFile.
soil checkpoint.
^ self ].
"If the last checkpoint was successful we are at the end of the file and
can return because the database is in a sane state"
fragmentFile atEnd ifTrue: [ ^ self ].
Expand Down
2 changes: 1 addition & 1 deletion src/Soil-Core/SoilLogSequenceNumber.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ SoilLogSequenceNumber >> hexOffset [

{ #category : #testing }
SoilLogSequenceNumber >> isInitial [
^ value = 0
^ self fileOffset = 0
]

{ #category : #printing }
Expand Down

0 comments on commit d151a26

Please sign in to comment.