Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip re-reading entries that were just written #361

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions trusted_applet/internal/storage/slots/journal.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,9 @@ func (j *Journal) Update(data []byte) error {
return fmt.Errorf("failed to write blocks: %v", err)
}

// Attempt to re-read the entry we just wrote to make sure that all is well...
br := newBlockReader(j.dev, j.nextBlock)
latest, err := unmarshalEntry(br)
if err != nil {
return fmt.Errorf("failed to re-scan written entry: %v", err)
}
if got, want := latest.Revision, e.Revision; got != want {
return fmt.Errorf("journal error, latest entry revision %d != written revision %d", got, want)
}

// Finally, update the journal state.
j.nextBlock += numBlocks
j.current = *latest
j.current = e

return nil
}
Expand Down