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

[extension/storage/filestorage] Default fsync to true #31201

Closed
wants to merge 1 commit into from
Closed
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
27 changes: 27 additions & 0 deletions .chloggen/fsync-true.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: extension/filestorage

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Default fsync to true

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [31200]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
4 changes: 2 additions & 2 deletions extension/storage/filestorage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The default directory is `%ProgramData%\Otelcol\FileStorage` on Windows and `/va
`timeout` is the maximum time to wait for a file lock. This value does not need to be modified in most circumstances.
The default timeout is `1s`.

`fsync` when set, will force the database to perform an fsync after each write. This helps to ensure database integretity if there is an interruption to the database process, but at the cost of performance. See [DB.NoSync](https://pkg.go.dev/go.etcd.io/bbolt#DB) for more information.
`fsync` when set to false, will skip performing an fsync after each write. This is potentially faster but can lead to data corruption and should only be used if you know what you're doing. See [DB.NoSync](https://pkg.go.dev/go.etcd.io/bbolt#DB) for more information.

## Compaction
`compaction` defines how and when files should be compacted. There are two modes of compaction available (both of which can be set concurrently):
Expand Down Expand Up @@ -80,7 +80,7 @@ extensions:
on_start: true
directory: /tmp/
max_transaction_size: 65_536
fsync: false
fsync: true

service:
extensions: [file_storage, file_storage/all_settings]
Expand Down
2 changes: 1 addition & 1 deletion extension/storage/filestorage/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func createDefaultConfig() component.Config {
CheckInterval: defaultCompactionInterval,
},
Timeout: time.Second,
FSync: false,
FSync: true,
}
}

Expand Down
2 changes: 1 addition & 1 deletion extension/storage/filestorage/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestFactory(t *testing.T) {
require.Equal(t, expected, cfg.Directory)
}
require.Equal(t, time.Second, cfg.Timeout)
require.Equal(t, false, cfg.FSync)
require.Equal(t, true, cfg.FSync)

tests := []struct {
name string
Expand Down
Loading