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

perf(store/sync): avoid syncing files #3693

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 1 addition & 6 deletions store/file/ods.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type ODS struct {

// CreateODS creates a new file under given FS path and
// writes the ODS into it out of given EDS.
// It ensures FS is synced after writing finishes.
// It may leave partially written file if any of the writes fail.
func CreateODS(
path string,
Expand All @@ -52,7 +51,7 @@ func CreateODS(
mod := os.O_RDWR | os.O_CREATE | os.O_EXCL // ensure we fail if already exist
f, err := os.OpenFile(path, mod, filePermissions)
if err != nil {
return fmt.Errorf("creating file: %w", err)
return fmt.Errorf("creating ODS file: %w", err)
}

hdr := &headerV0{
Expand Down Expand Up @@ -92,10 +91,6 @@ func writeODSFile(f *os.File, axisRoots *share.AxisRoots, eds *rsmt2d.ExtendedDa
return fmt.Errorf("flushing ODS file: %w", err)
}

if err := f.Sync(); err != nil {
return fmt.Errorf("syncing file: %w", err)
}

return nil
}

Expand Down
5 changes: 0 additions & 5 deletions store/file/q4.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ type Q4 struct {

// CreateQ4 creates a new file under given FS path and
// writes the Q4 into it out of given EDS.
// It ensures FS is synced after writing finishes.
// It may leave partially written file if any of the writes fail.
func CreateQ4(
path string,
Expand Down Expand Up @@ -74,10 +73,6 @@ func writeQ4File(f *os.File, eds *rsmt2d.ExtendedDataSquare, hdr *headerV0) erro
return fmt.Errorf("flushing Q4: %w", err)
}

if err := f.Sync(); err != nil {
return fmt.Errorf("syncing Q4 file: %w", err)
}

return nil
}

Expand Down
Loading