-
Notifications
You must be signed in to change notification settings - Fork 40
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
StateDB cleanup #1890
StateDB cleanup #1890
Conversation
…che_current_state # Conflicts: # go/enclave/enclave.go
@@ -444,7 +447,7 @@ func (executor *batchExecutor) processTransactions( | |||
} else { | |||
// Exclude all errors | |||
excludedTransactions = append(excludedTransactions, tx.Tx) | |||
executor.logger.Info("Excluding transaction from batch", log.TxKey, tx.Tx.Hash(), log.BatchHashKey, batch.Hash(), "cause", result) | |||
executor.logger.Debug("Excluding transaction from batch", log.TxKey, tx.Tx.Hash(), log.BatchHashKey, batch.Hash(), "cause", result) |
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 is unrelated, but it has to be done because this entry is too verbose
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.
Maybe we need to prioritise the issues that leaves tx stuck in the mempool forever and then re-enable this. Because I think this failure has no feedback if it's got this far, so user will just see spinning forever waiting for receipt and this sometimes gave us visibility on them.
if err != nil { | ||
return nil, syserr.NewInternalError(fmt.Errorf("could not create state DB for %s. Cause: %w", batch.Header.Root, err)) | ||
return nil, fmt.Errorf("could not create state DB for %s. Cause: %w", batch.Header.Root, err) |
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 might not be a system error, depending on the rpc request
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.
Minor comments
|
||
func getBatchStateAtSeq(ctx context.Context, storage storage.Storage, seqNo uint64) (*state.StateDB, error) { | ||
// We retrieve the batch of interest. | ||
batch, err := storage.FetchBatchBySeqNo(ctx, seqNo) |
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.
Possible I'm missing something here, but it looks like both the places that call this already had the batch. If it's the batch hash we need rather than the seq number maybe they can pass that in to save the look up?
@@ -444,7 +447,7 @@ func (executor *batchExecutor) processTransactions( | |||
} else { | |||
// Exclude all errors | |||
excludedTransactions = append(excludedTransactions, tx.Tx) | |||
executor.logger.Info("Excluding transaction from batch", log.TxKey, tx.Tx.Hash(), log.BatchHashKey, batch.Hash(), "cause", result) | |||
executor.logger.Debug("Excluding transaction from batch", log.TxKey, tx.Tx.Hash(), log.BatchHashKey, batch.Hash(), "cause", result) |
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.
Maybe we need to prioritise the issues that leaves tx stuck in the mempool forever and then re-enable this. Because I think this failure has no feedback if it's got this far, so user will just see spinning forever waiting for receipt and this sometimes gave us visibility on them.
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.
lgtm
Why this change is needed
Under load, the enclave spends time creating StateDB instances.
This PR started as an attempt to cache the head statedb so it can be used by all requests, but that's not possible because of the internal implementation of the stated.
The PR also tweaks the setup of the stateDb, because the caching values passed in were too low.
What changes were made as part of this PR
PR checks pre-merging
Please indicate below by ticking the checkbox that you have read and performed the required
PR checks