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/filestorage] use correct bbolt options for compaction #9134

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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

### 🧰 Bug fixes 🧰

- `filestorageextension`: use correct bbolt options for compaction (#9134)
- `hostmetricsreceiver`: Use cpu times for time delta in cpu.utilization calculation (#8857)
- `dynatraceexporter`: Remove overly verbose stacktrace from certain logs (#8989)
- `googlecloudexporter`: fix the `exporter.googlecloud.OTLPDirect` fature-gate, which was not applied when the flag was provided (#9116)
Expand Down Expand Up @@ -2007,4 +2008,4 @@ First release of OpenTelemetry Collector Contrib.
[v0.2.7]: https://github.com/open-telemetry/opentelemetry-collector-contrib/compare/v0.2.6...v0.2.7
[v0.2.6]: https://github.com/open-telemetry/opentelemetry-collector-contrib/compare/v0.0.5...v0.2.6
[v0.0.5]: https://github.com/open-telemetry/opentelemetry-collector-contrib/compare/v0.0.1...v0.0.5
[v0.0.1]: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.0.1
[v0.0.1]: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.0.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, saw the same thing in some other PR, realized there seems to be a trailing space added by #8548

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not blocking this PR because of this :-) Merging.

13 changes: 7 additions & 6 deletions extension/storage/filestorage/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ type fileStorageClient struct {
db *bbolt.DB
}

func newClient(filePath string, timeout time.Duration) (*fileStorageClient, error) {
options := &bbolt.Options{
func bboltOptions(timeout time.Duration) *bbolt.Options {
return &bbolt.Options{
Timeout: timeout,
NoSync: true,
NoFreelistSync: true,
FreelistType: bbolt.FreelistMapType,
}
}

func newClient(filePath string, timeout time.Duration) (*fileStorageClient, error) {
options := bboltOptions(timeout)
db, err := bbolt.Open(filePath, 0600, options)
if err != nil {
return nil, err
Expand Down Expand Up @@ -121,10 +125,7 @@ func (c *fileStorageClient) Compact(ctx context.Context, compactionDirectory str
}

// use temporary file as compaction target
options := &bbolt.Options{
Timeout: timeout,
NoSync: true,
}
options := bboltOptions(timeout)

// cannot reuse newClient as db shouldn't contain any bucket
db, err := bbolt.Open(file.Name(), 0600, options)
Expand Down