Skip to content

Commit

Permalink
Merge pull request #826 from ApptiveGrid/fix-journal-init-and-recover
Browse files Browse the repository at this point in the history
  • Loading branch information
noha authored Oct 3, 2024
2 parents 623ec54 + d151a26 commit 9eada56
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 9eada56

Please sign in to comment.