Pruning data results - #667
Conversation
|
I still need to take a good look at the PR, but maybe good to already create a follow up issue for building a mapping that allows us to do this more efficiently in the future. Feels like the pruning isn't complete without that :) |
a143e6a to
90b2ef4
Compare
38e5257 to
00e8376
Compare
03acea4 to
87b427e
Compare
Prune batches and their associated data at every block based on two new module parameters NumBatchesToKeep and MaxBatchPrunePerBlock. For pruning data results and their batch assignment data, we resort to naive implementation because there is no mapping to data result objects from batch number or data result ID. In this implementation we go through `MaxDataResultsToCheckForPrune` items in the store starting from a random point and delete those whose associated batches have been pruned.
87b427e to
02918d8
Compare
|
This strategy has two problems:
An obvious solution would be to add new collections to store incoming data results separately. I'll see if there is a better alternative. |
While not ideal I do agree that this might make the most sense. This could also open up new pruning strategies. One stupid idea I just had:
Not a great solution since we have some temporary code for the transition period (although I think this is required for all workable solutions) and it doesn't address the size problem until some time beyond the upgrade. But maybe this sparks a good idea on your side :) |
|
Closing as PR #673 now supersedes this PR. |
Explanation of Changes
The challenge here is that there is no mapping to data result object from batch number or data result ID, which is only data available to us when we prune batches. Therefore, we simply go through
MaxDataResultsToCheckForPrune(a module parameter) items in the store and delete those whose associated batches have been pruned.To prevent checking similar set of data results over multiple blocks, we use the hash of last commit hash as the starting point of this iteration. The iteration direction is also switched at every block.
Note this PR also includes some logic change of batching EndBlock to ensure that pruning is executed at every block and to catch errors from pruning functions without halting the chain.
Testing
An integration test.
Planning to test with actual data exported from testnet or mainnet.
Related PRs and Issues
Closes #663