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

Handle concurrency issues occurred with building hyperblock coordinates (using the fast-replay method) #2263

Merged
merged 16 commits into from
Sep 2, 2020

Conversation

andreibancioiu
Copy link
Collaborator

@andreibancioiu andreibancioiu commented Aug 31, 2020

By exploring the fastly-rebuilt database lookup extensions, we can confirm that some info is missing from the miniblocks metadata.

missing "destination" hyperblock coordinates: 27 miniblocks
missing "source and destination" hyperblock coordinates: 5 miniblocks (around changes of epochs)

(data in 3 shards)

Under the assumption of concurrent commits and "notarized" notifications, I've redesigned the way notifications are processed. All notifications are now added to a pending state, and consumed as soon as possible (both at commit and at notify).

Furthermore, historyRepository registers to a brand new, custom handler of the block tracker - by @SebastianMarian, in order to always receive "notarized" notifications, along with the metaBlock.

@andreibancioiu andreibancioiu self-assigned this Aug 31, 2020
@andreibancioiu andreibancioiu marked this pull request as ready for review August 31, 2020 21:51
@@ -645,7 +645,7 @@
PollingIntervalInMinutes = 65

[DbLookupExtensions]
Enabled = false
Enabled = true # TODO: Disable after tests
Copy link
Contributor

Choose a reason for hiding this comment

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

remember to disable after tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Disabled.

SebastianMarian
SebastianMarian previously approved these changes Sep 1, 2020

hr.notarizedAtSourceNotifications.Remove(string(miniblockHash))
hr.pendingNotarizedAtBothNotifications.Set(string(miniblockHash), &notarizedNotification{
metaNonce: blockHeader.GetNonce(),
Copy link
Contributor

Choose a reason for hiding this comment

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

blockHeader is always a meta block?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed as discussed (removed "simulated notification").

core/dblookupext/historyRepository.go Show resolved Hide resolved
core/dblookupext/historyRepository.go Outdated Show resolved Hide resolved
andreibancioiu and others added 3 commits September 1, 2020 20:40
…lock tracker. This notification works either from shard nodes or meta nodes.
}
}

func (hr *historyRepository) onNotarizedInMetaBlock(metaBlockNonce uint64, metaBlockHash []byte, shardData *block.ShardData) {
for _, miniblockHeader := range shardData.GetShardMiniBlockHeaders() {
hr.onNotarizedMiniblock(metaBlockNonce, metaBlockHash, shardData.GetShardID(), miniblockHeader)
if metaBlockNonce <= 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

< 1 instead <= 1. If meta misses some rounds it can include in nonce 1 a lot of shardData if the shards worked good

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

SebastianMarian
SebastianMarian previously approved these changes Sep 1, 2020
iDontCare := miniblockHeader.SenderShardID != hr.selfShardID && miniblockHeader.ReceiverShardID != hr.selfShardID
isNotarizedAtSource := miniblockHeader.SenderShardID == shardOfContainingBlock
isNotarizedAtDestination := miniblockHeader.ReceiverShardID == shardOfContainingBlock
isNotarizedAtBoth := isIntra || isToMeta || (isFromMeta && isNotarizedAtDestination)
Copy link
Contributor

@AdoAdoAdo AdoAdoAdo Sep 2, 2020

Choose a reason for hiding this comment

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

I suggested the last condition, but thinking a bit about it I don't think it is entirely correct.
isNotarizedAtBoth should cover the miniblocks that are notarized in a single metablock for both source and destination.

  • for isIntra this is true, as bot sender and destination solved
  • for isToMeta this is again true as when included in metablock it means that also destination (meta) was executed in adition to source notarization
  • for isFromMeta && notarized at destination, this is not true, as the sender notarizationi (metachain) is done in a different metablock, where metachain is the source. For the destination should follow the isNotarizedAtDestination logic.

Was there a problem maybe that the "from metachain" miniblocks were not reported on source?
Checking the function onNotarizedInMetablock only the shardData.ShardMiniblockHeaders (for every shard) are reported.
To cover also the from metachain miniblocks at source, also the metablock.MiniBlockHeaders should be reported.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes total sense, fixed & tested.

Copy link
Contributor

@LucianMincu LucianMincu left a comment

Choose a reason for hiding this comment

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

System tests passed.

@LucianMincu LucianMincu merged commit 0576f94 into development Sep 2, 2020
@LucianMincu LucianMincu deleted the hyperblock-coordinates-fixes branch September 2, 2020 10:34
@andreibancioiu andreibancioiu restored the hyperblock-coordinates-fixes branch October 16, 2023 11:40
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

4 participants