-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[chore][fileconsumer/archive] - add signature methods for archive feature #35098
[chore][fileconsumer/archive] - add signature methods for archive feature #35098
Conversation
ef18bed
to
ab2fdcc
Compare
@djaglowski This is a draft PR which separates the reader creation and archiving module as per #32727 (comment) let me know which looks good. |
7496847
to
a12737f
Compare
a12737f
to
431ab41
Compare
|
||
type FileRecord struct { | ||
File *os.File | ||
Fingerprint *fingerprint.Fingerprint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djaglowski storing file handle is crucial for us because of the way we handle the archiving:
- We try to match files against
knownFiles
array. - If a match isn't found, we would accumulate the unmatched files (instead of finding in the archive straightaway). More about it was discussed here.
- Perform the archiving logic. Described here.
We need the file handle so that we can create a reader from it after the archiving is done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't make any sense to me. See my comments on the other PR. I think this is a fundamental point that needs to be resolved before bothering with the rest of the PR.
reader.Metadata
is sufficient and necessary for creating readers in all other circumstances except where we already have an open file handle, in which case we can do better.
I do not understand why we would or even could have open file handles at this point, since the archive should only be populated by elements which are discarded from knownFiles
, which only contains reader.Metadata
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djaglowski Thank you for the feedback. I realise now that I might have made things too complex with the initial PR, and we don’t actually need to keep files open while archiving.
3364229
to
b4190cf
Compare
@djaglowski please take a look at this PR. Appreciate your time reviewing this! Addressing your points below:
As I said, I made things too complex with the initial PR, and we don’t actually need to keep files open while archiving.
Agree. Keeping everything in tracker would make it more maintainable.
This makes sense to me. |
b4190cf
to
352e8e4
Compare
352e8e4
to
077ab35
Compare
@djaglowski Thanks for your time in reviewing this PR! We can ofcourse break it down in multiple PRs if necessary. |
if t.pollsToArchive <= 0 || t.persister == nil { | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to worry about these cases? Aren't we checking them and instantiating a NoStateTracker
when these would ever be relevant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NoStateTracker
will be created when WithNoTracking
option is selected.
We can create a normal tracker with archiving disabled, by setting pollsToArchive: 0
.
A tracker with archiving enabled will have pollsToArchive
> 0
.
The check t.persister == nil
is just a precautionary check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright. Maybe in another PR we can clean this up. IMO we have starting to have too many special cases to handle and the easiest solution to that is move to a pattern where the nils pieces are nops instead. Then the implementation doesn't need to worry about details so much.
33920e0
to
080bf7a
Compare
080bf7a
to
27cc4e1
Compare
This reverts commit 27cc4e1.
…ture (open-telemetry#35098) Description: This PR introduces the `archive` method to store files older than 3 poll cycles. The core logic for reading will be introduced in a follow up PR. Link to tracking Issue: open-telemetry#32727 Testing: To be included in future PRs Documentation: To be included in future PRs
This PR follows #35098. ### Description - This PR adds core logic for matching from archive. Check [this out](#32727 (comment)) for the core logic. ### Future PRs - As of now, we don't keep track of most recently written index across collector restarts. This is simple to accomplish and we can use of persister for this. I haven't implemented this in current PR, as I want to guide your focus solely towards reading part. We can address this in this PR (later) or in a separate PR, independently. - Testing and Enabling: Once we establish common ground on _**reading from archive**_ matter, we can proceed with testing and enabling the configuration.
…ture (open-telemetry#35098) Description: This PR introduces the `archive` method to store files older than 3 poll cycles. The core logic for reading will be introduced in a follow up PR. Link to tracking Issue: open-telemetry#32727 Testing: To be included in future PRs Documentation: To be included in future PRs
…y#35798) This PR follows open-telemetry#35098. ### Description - This PR adds core logic for matching from archive. Check [this out](open-telemetry#32727 (comment)) for the core logic. ### Future PRs - As of now, we don't keep track of most recently written index across collector restarts. This is simple to accomplish and we can use of persister for this. I haven't implemented this in current PR, as I want to guide your focus solely towards reading part. We can address this in this PR (later) or in a separate PR, independently. - Testing and Enabling: Once we establish common ground on _**reading from archive**_ matter, we can proceed with testing and enabling the configuration.
…y#35798) This PR follows open-telemetry#35098. ### Description - This PR adds core logic for matching from archive. Check [this out](open-telemetry#32727 (comment)) for the core logic. ### Future PRs - As of now, we don't keep track of most recently written index across collector restarts. This is simple to accomplish and we can use of persister for this. I haven't implemented this in current PR, as I want to guide your focus solely towards reading part. We can address this in this PR (later) or in a separate PR, independently. - Testing and Enabling: Once we establish common ground on _**reading from archive**_ matter, we can proceed with testing and enabling the configuration.
Description:
This PR introduces the
archive
method to store files older than 3 poll cycles.The core logic for reading will be introduced in a follow up PR.
Link to tracking Issue: #32727
Testing: To be included in future PRs
Documentation: To be included in future PRs