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

[pkg/stanze] The known files in the filelog have not been updated correctly #29491

Closed
xieyuguang opened this issue Nov 24, 2023 · 3 comments · Fixed by #29610
Closed

[pkg/stanze] The known files in the filelog have not been updated correctly #29491

xieyuguang opened this issue Nov 24, 2023 · 3 comments · Fixed by #29610
Labels

Comments

@xieyuguang
Copy link

Component(s)

pkg/stanza, receiver/filelog

What happened?

Description

During the initial run, the progress of scanned files cannot be saved. The source code[pkg/stanza/fileconsumer/file.go] shows that during the first poll, the initial value of m.previousPollFiles is empty, so after executing m.closePreviousFiles(), it will not be added to m.knownFiles. After the second poll, m.previousPollFiles will be removed in readers := m.makeReaders(paths), so it will still not be added to m.knownFiles in subsequent executions of m.closePreviousFiles().

Steps to Reproduce

Use filelogreceiver and enable storage configuration with file_storage, first delete the local storage file, and then start otelcol. After running, observe the local storage file and find that storage does not record the matched files.

Expected Result

m.knownFiles should record the currently matched files.

Actual Result

m.knownFiles is empty.

Collector version

v0.89.0

Environment information

No response

OpenTelemetry Collector configuration

No response

Log output

No response

Additional context

No response

@xieyuguang xieyuguang added bug Something isn't working needs triage New item requiring triage labels Nov 24, 2023
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@djaglowski
Copy link
Member

I have not been able to replicate the problem.

I agree that we are not pushing checkpoints to storage until they move to knownFiles. However, the behavior of the Stop function results in all files being closed and checkpointed.

After running, observe the local storage file and find that storage does not record the matched files.

Are you observing the contents of the storage while running, or after you've stopped it?

@xieyuguang
Copy link
Author

I observed it while running. I think the correct behavior should be consistent while running and after the stop, as there may be scenarios such as the host shutting down directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants