Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Availability store subsystem guide#1424

Merged
montekki merged 5 commits intoparitytech:masterfrom
montekki:fs-availability-store-subsystem-guide
Jul 27, 2020
Merged

Availability store subsystem guide#1424
montekki merged 5 commits intoparitytech:masterfrom
montekki:fs-availability-store-subsystem-guide

Conversation

@montekki
Copy link
Contributor

@montekki montekki commented Jul 16, 2020

This is based off #1401

@montekki montekki added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. labels Jul 16, 2020
@montekki montekki requested review from coriolinus and rphmeier July 16, 2020 19:33
@montekki montekki changed the title Fs availability store subsystem guide Availability store subsystem guide Jul 16, 2020
Copy link
Contributor

@coriolinus coriolinus left a comment

Choose a reason for hiding this comment

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

I'm only looking at 997f2ff because I believe that is the only commit unique to this PR. If I'm wrong, please let me know.

- Note any newly-included candidates backed in the block. Update pruning records for any stored availability chunks.

On block finality events:
On `OverseerSignal::BlockFinalized(_)` events:
Copy link
Contributor

Choose a reason for hiding this comment

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

If we take my suggestion for distributing block finality events, then we can revert this line of change.

fr3 -> fr4 [label = "No backing"]
fr3 -> occ4 [label = "Backing"]
occ3 -> occ4 [label = "(no change)"]
fr4 -> occ4 [label = "Availability Timeout"]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that arrow was accidentally backwards in the old diagram, but it should be the other way around.

Copy link
Contributor

@rphmeier rphmeier Jul 20, 2020

Choose a reason for hiding this comment

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

And actually i think it makes most sense to change it to occ3 -> fr3 now that i look closer. Since timeout occurs before backing.

| .. | .. | .. | .. |
| CandidateN_M Included | .. | Candidate1_K Included | Candidate2_L Included |

> TODO: It's likely we will have to have a way to go from block hash to `BlockNumber` to make this work.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the Chain API subsystem: #1415


These are used to update Chunk pruning and PoV pruning records upon finality:
When another block finality notification is received:
- For any record older than this block:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this O(n) in the difference in number between the last finalized block number and the new one?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am worried that, especially while syncing, we may have large gaps in finality. If the node is offline for a day, or something like that. Furthermore, the races against runtime APIs might get worse in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we really avoid linear time here? I think that this can optimize things a bit:

  1. Suppose we have to store this info on blocks [1000..2000].We could do two things here:
    • shrink the data kept in this one big blob to only keeping hashes and block numbers: [(hash1000, 1000)...(hash2000, 2000)] and query into single records by some key like cached_availability_info_key(hash: &Hash).
    • we can also keep this blob sorted at a cheap price since we are likely to only have to append new blocks to it.
  2. As soon as we get a new finality notification say about hash1500, we can find the exact place to chop off the recent blocks at O(log(n)) (I guess?)
  3. Chop it off, update the individual records.
  4. Now we have [(hash1501, 1501)..(hash2000, 2000)] array.

But in any case we are going to "touch" every one of them, but hopefully only once

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in any case, i have to give it another thought

Copy link
Contributor

@rphmeier rphmeier Jul 21, 2020

Choose a reason for hiding this comment

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

Yeah, that is a good point. I guess what I'd want to avoid is that the subsystem gets stuck in a millions-of-blocks loop. It seems better to me to only adjust pruning some number of blocks behind the head and accidentally leak data when doing larger synchronizations. Maybe there is some room for a behind-the-scenes cleanup that does not tie up the message-processing task as well. Although I would want to defer that to a later issue, as leaking data is not a big issue and we are not implementing pruning right now yet.

@rphmeier
Copy link
Contributor

Rebase on master?

@montekki montekki merged commit 677b28b into paritytech:master Jul 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments