Skip to content

Feat/ec recreation from multiple rules - #4210

Open
carpawell wants to merge 2 commits into
masterfrom
feat/ec-recreation-from-multiple-rules
Open

carpawell wants to merge 2 commits into
masterfrom
feat/ec-recreation-from-multiple-rules

Conversation

@carpawell

Copy link
Copy Markdown
Member

No description provided.

@codecov

codecov Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 4.20168% with 114 lines in your changes missing coverage. Please review.
✅ Project coverage is 31.28%. Comparing base (4c813ae) to head (4541aab).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
pkg/services/policer/ec.go 4.20% 114 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4210      +/-   ##
==========================================
- Coverage   31.45%   31.28%   -0.17%     
==========================================
  Files         677      677              
  Lines       41572    41599      +27     
==========================================
- Hits        13075    13016      -59     
- Misses      28497    28583      +86     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@carpawell

carpawell commented Oct 2, 2026 •

Copy link
Copy Markdown
Member Author

Checked with nspcc-dev/neofs-testcases#1467, but it required adding the last commit, since it drops the whole rule. It effectively means that any EC check is now forced to check any other rule, multiplying every EC check complexity by the number of EC rules.

@carpawell
carpawell force-pushed the feat/ec-recreation-from-multiple-rules branch from 4febb94 to 6752ff8 Compare October 2, 2026 23:01
Comment thread pkg/services/policer/ec.go Outdated
panic("trying to cross restore EC parts with single EC rule: missing parts number: %d, skip parts number: %d")
}
var (
shortage = int(rule.ParityPartNum) - (len(missingIdx) + len(skipIdx))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Likely to be negative.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this part was made based on my wrong assumptions about the code above, dropped

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

oh no, i now recall why it is done this way, returned it back, but fixed, no negative counters

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

but, interestingly, none of the cases in the python test found it. i need to improve local coverage

// Server may store the part. We consider it unavailable, but we don't attempt to recreate it.
// Once SN finishes maintenance, the part will likely become available.
if len(missingIdx)+len(skipIdx) >= int(rule.ParityPartNum) {
if len(missingIdx)+len(skipIdx) >= int(rule.ParityPartNum) && len(ecRules) == 1 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why >= btw? Let's say we have 8/3 split and 3 parts missing, 8 are sufficient.

@carpawell carpawell Oct 6, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it confused me too, but it is likely done this way to prevent redundant append below and to make fast error return. i dont like it either

shortage = int(rule.ParityPartNum) - (len(missingIdx) + len(skipIdx))
dataPartsToRestore = make([]int, 0, rule.DataPartNum)
)
for partIdx := range rule.DataPartNum {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But why data parts only? Parity can be missing as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

we are here to reconstruct data from other rules. other rules are only required to have the same data parts, parity parts are encoded according to different parity numbers, it is pointless to me to try to fetch other parity parts but the data parts are always there and always the same. code below will always recreate missing parity parts the same way it did before this PR, the only assumption from my side is that there is no need to fetch parity parts and try to play with them, trying to find out if they are suitable for this rule

@carpawell carpawell Oct 6, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it is kinda tricky in such cases if we are only fetching data parts, cause there not enough parts to restore the full chain as of 1 < 2 == true but that's nonsense, cause we have exactly the original data we want; it is just not enough to "recreate" (but making a new encoding is still possible) parity parts

if partLastByte <= off {
continue
}
for nodeIdx := range iec.NodeSequenceForPart(int(partIdx), totalParts, len(nodeLists)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can't you just request an object range from healthy nodes? Without thinking much about other rule parts?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

can be done i think, but it sounds strange to me: we are already deep there and know exactly what parts we have to fetch with what ranges, but instead we are trying other nodes (or even ourselves again) to do this job again and believe in it

If there are not enough EC parts for object recreation but more EC rules are
found, SN fetches minimum required missing data parts from these rules and
uses them for this rule restoration. Refs #3848.

Signed-off-by: Pavel Karpy <carpawell@nspcc.io>
If all objects for EC rule X are lost, SN can restore them using the non-X rules
(if any). It is done by forcing all EC rules rechecks for every EC object found
on any SN node. Closes #3848.

Signed-off-by: Pavel Karpy <carpawell@nspcc.io>
@carpawell
carpawell force-pushed the feat/ec-recreation-from-multiple-rules branch from 6752ff8 to 4541aab Compare October 6, 2026 15:42

This branch has not been deployed

No deployments
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.

2 participants