-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add History Retention Window of 7 days #139
Conversation
ledgerbucketwindow.DefaultEventLedgerRetentionWindow) | ||
var maxRetentionWindow uint32 | ||
|
||
if cfg.HistoryRetentionWindow > 0 { |
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 has a default, so this will basically always be the case unless someone explicitly sets it to zero, right?
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.
Yes correct, actually I can make it more explicit by removing default value but then client needs to pass it while running RPC. Assuming support of Txn from DB would work without this flag. What do you think?
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 becomes a breaking behavior change. I think we should be checking the old flags first, then using the new flag if those aren't set. We also have to be careful not to set it for events, since we can't fit 7 days into memory. So like
eventRetention = args.eventRetention
txRetention = args.txRetention == 0 ? args.txRetention : args.historyRetention
Actually maybe it's too early to introduce until we have events 🤔
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.
That's why I thought we wouldn't merge this branch until the whole DB backend was ready (@mollykarcher?).
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.
@Shaptic Agree that it is a breaking change. Maybe we can completely remove the txn-retention-window functionality in the code and just use the value for history-retention-window.
So in your pseudo-code,
eventRetention = args.eventRetention
txRetention = args.historyRetention
We just keep the flag as a deprecation warning but remove all configs for txn-retention-window
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.
Ah, like "this flag no longer has any effect"?
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.
yeah I like that, seems better option if we clean up all the logic related to Txn retention window and keep it just in options.go
I think we should be checking the old flags first, then using the new flag if those aren't set
This would not work right? because old flags has default values too so it is always going to run in that if branch
Also just a thought if we are going to release this in next protocol bump, can we not ship it as breaking change i.e New Txn DB support with history-retention-window? -- This message might be more clear to community instead of letting them worry about intermediate confusing retention flag situation
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.
Ah, like "this flag no longer has any effect"?
@Shaptic Yes, exactly this. I did a similar thing last year in Horizon when we removed the captive-core-use-db functionality but kept the flag as a deprecation warning.
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 would not work right? because old flags has default values too so it is always going to run in that if branch
I think what's being misunderstood/missed here, is that the default values shouldn't apply before we check for the actual explicit existence of the config value. And I would agree with @Shaptic that we want to release this in a backwards compatible way. If people are currently sending the 2 old flags, we need to continue to respect them until we hit a "breaking" API boundary.
In this particular case, (and if we're merging just transactions without events moved over) then I think this looks like:
- don't touch any logic related to
eventsRetentionWindow
right now - determine value for
historyRetentionWindow
as follows:- if
historyRetentionWindow
is being sent by the user, use that - elif
transactionRetentionWindow
is being sent by the user, use that - default to 7 days
- if
- in p22 we'll remove
transactionRetentionWindow
I will also say, that while I know there is precedence for this in other things we've done (ex. horizon rate limit=0), I really dislike the usage of 0
to indicate null/not present/disabled. Sure, 0
would be a silly thing to set historyRetentionCount
to, but it still has real semantic meaning that I think we should respect.
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.
the default values shouldn't apply before we check for the actual explicit existence of the config value
idk if we can do this in the code since we use a lib for args but I could be wrong
cmd/soroban-rpc/internal/ledgerbucketwindow/ledgerbucketwindow.go
Outdated
Show resolved
Hide resolved
Discussed offline: We are not introducing new common retention window !!
We no longer need this code change so closing this PR. |
Introduce new history retention window of 7 days - We are going to have only this single retention window, Txn and events retention window soon to be deprecated.
Context: #115
Design Doc: RPC DB Schema