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

client/db: prune archived orders #2975

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

buck54321
Copy link
Member

Prune archived orders when there are more than 1000 (configurable).

Prune archived orders when there are more than 1000 (configurable).
Comment on lines +465 to +468
nOrds := uint64(archivedOB.Stats().BucketN - 1 /* BucketN includes top bucket */)
if nOrds <= archiveSizeLimit {
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

You could do this first and maybe avoid collecting the active orders sometimes.

Comment on lines +110 to +111

ArchiveSizeLimit uint64 `long:"archivesize" description:"the maximum number of orders to be archived before deleting the oldest"`
Copy link
Member

Choose a reason for hiding this comment

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

Could mention it cannot be zero, or error somewhere if it is.

Copy link
Contributor

@martonp martonp left a comment

Choose a reason for hiding this comment

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

I think there should be an option to only prune older orders with no matches.

@buck54321
Copy link
Member Author

I think there should be an option to only prune older orders with no matches.

That's a much bigger thing, since archived matches are not indexed on order ID. I do agree that we need a more sophisticated solution though with more knobs. The problem we have right now is that clients running mm bots are filling up their disks too quickly, and we need something for a patch release asap.

Comment on lines +485 to +487
if _, found := oidsWithActiveMatches[oid]; found {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What if instead of just not deleting the oids with active matches you don't delete them with any matches. I think the problem is that the archives get clogged up with orders that just get created and cancelled after the market moves. Orders that actually matched shouldn't get deleted because people need to keep records of those. You could even just check the swap fees here, and not delete any trade that has swap fees > 0.

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

Successfully merging this pull request may close these issues.

3 participants