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

added log for elastic search response body parse #2413

Merged
merged 21 commits into from
Oct 29, 2020

Conversation

bogdan-rosianu
Copy link
Contributor

@bogdan-rosianu bogdan-rosianu commented Oct 28, 2020

  • added an additional log for displaying the body content if the parsing fails
  • made each indexer error be a not shippable one, so the indexer will try to re-index the failed data
  • treated error in elasticDefaultErrorResponseHandler function
  • added unit tests
  • changed the indexer so it can better output errors when failing to index a header
  • refactored the way receipts and smart contract results are indexed

@bogdan-rosianu bogdan-rosianu self-assigned this Oct 28, 2020
Copy link
Contributor

@iulianpascalau iulianpascalau left a comment

Choose a reason for hiding this comment

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

Good catch, code will need to be changed a little bit.

core/indexer/elasticClientCommon.go Outdated Show resolved Hide resolved
core/indexer/elasticClientCommon.go Outdated Show resolved Hide resolved
core/indexer/elasticClientCommon.go Outdated Show resolved Hide resolved
… try to re-index the failed data

- treated error in elasticDefaultErrorResponseHandler function
- added unit tests
sasurobert
sasurobert previously approved these changes Oct 28, 2020
@@ -136,6 +141,16 @@ func (tdp *txDatabaseProcessor) prepareTransactionsForDatabase(
return append(convertMapTxsToSlice(transactions), rewardsTxs...), alteredAddresses
}

func (tdp *txDatabaseProcessor) addScrsReceiverToAlteredAccounts(alteredAddress map[string]struct{}, scrs map[string]*smartContractResult.SmartContractResult) {
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to inject shardCoordinator, could have used the current shard ID and a range on the provided body. Miniblocks already contain destination/sender shard ID

Copy link
Contributor

Choose a reason for hiding this comment

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

It does not work as the intrashard miniblock holding smart contract results is not added in the body.

core/indexer/processTransactions_test.go Outdated Show resolved Hide resolved
core/indexer/processTransactions_test.go Outdated Show resolved Hide resolved
core/indexer/processTransactions_test.go Outdated Show resolved Hide resolved
core/indexer/processTransactions_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@iulianpascalau iulianpascalau left a comment

Choose a reason for hiding this comment

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

Not done yet

core/indexer/processTransactions.go Outdated Show resolved Hide resolved
core/indexer/processTransactions_test.go Show resolved Hide resolved
core/indexer/processTransactions_test.go Outdated Show resolved Hide resolved
ccorcoveanu
ccorcoveanu previously approved these changes Oct 29, 2020
iulianpascalau
iulianpascalau previously approved these changes Oct 29, 2020
Copy link
Contributor

@iulianpascalau iulianpascalau left a comment

Choose a reason for hiding this comment

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

Approve after self implementation and self review

sasurobert
sasurobert previously approved these changes Oct 29, 2020
@@ -22,7 +22,8 @@ type DataIndexerFactory interface {
// This could be an elastic search index, a MySql database or any other external services.
type Indexer interface {
SetTxLogsProcessor(txLogsProc process.TransactionLogProcessorDatabase)
SaveBlock(body data.BodyHandler, header data.HeaderHandler, txPool map[string]data.TransactionHandler, signersIndexes []uint64, notarizedHeadersHashes []string)
SaveBlock(body data.BodyHandler, header data.HeaderHandler, txPool map[string]data.TransactionHandler,
Copy link
Contributor

Choose a reason for hiding this comment

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

wouldn't it be better to have and argument structure here ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed, added TODO

@iulianpascalau iulianpascalau dismissed stale reviews from sasurobert, ccorcoveanu, and themself via 7162832 October 29, 2020 12:29
receipts := groupReceipts(body, txPool)
scResults := groupSmartContractResults(body, txPool)
tdp.addScrsReceiverToAlteredAccounts(body, alteredAddresses, scResults, selfShardID)
//we can not iterate smart contracts results directly on the miniblocks contained in the block body
Copy link
Contributor

Choose a reason for hiding this comment

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

"smart contracts" -> remove plural
"miniblocks" -> typo

Copy link
Contributor

Choose a reason for hiding this comment

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

done

sasurobert
sasurobert previously approved these changes Oct 29, 2020
iulianpascalau
iulianpascalau previously approved these changes Oct 29, 2020
iulianpascalau
iulianpascalau previously approved these changes Oct 29, 2020
sasurobert
sasurobert previously approved these changes Oct 29, 2020
iulianpascalau
iulianpascalau previously approved these changes Oct 29, 2020
@LucianMincu LucianMincu merged commit a7585da into feat/elastic-search-new-impl Oct 29, 2020
@LucianMincu LucianMincu deleted the add-log-es-parse-body branch October 29, 2020 22:12
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.

None yet

8 participants