storcon: validate intent state before applying optimization (#12593)

## Problem

In the gap between picking an optimization and applying it, something
might insert a change to the intent state that makes it incompatible.
If the change is done via the `schedule()` method, we are covered by the
increased sequence number, but otherwise we can panic if we violate the
intent state invariants.

## Summary of Changes

Validate the optimization right before applying it. Since we hold the
service lock at that point, nothing else can sneak in.

Closes LKB-65
This commit is contained in:
Vlad Lazar
2025-07-16 15:37:40 +01:00
committed by GitHub
parent c71aea0223
commit 3e4cbaed67
2 changed files with 45 additions and 1 deletions

View File

@@ -73,6 +73,11 @@ def test_sharding_autosplit(neon_env_builder: NeonEnvBuilder, pg_bin: PgBin):
".*Local notification hook failed.*",
".*Marking shard.*for notification retry.*",
".*Failed to notify compute.*",
# As an optimization, the storage controller kicks the downloads on the secondary
# after the shard split. However, secondaries are created async, so it's possible
# that the intent state was modified, but the actual secondary hasn't been created,
# which results in an error.
".*Error calling secondary download after shard split.*",
]
)