Repository navigation
fix(rest): answer a snapshot create once the snapshot is listed - #284
Conversation
LINSTOR answers `POST .../snapshots` after the snapshot definition is
in its database, so the `s l` that follows lists it. blockstor wrote
the Snapshot to the apiserver and answered at once, while the list is
served from the informer cache, which sees the create only when the
watch event arrives. csi-snapshotter pages through ListSnapshots right
after creating, and a page that comes back short reads as the end of
the list; TestGroupJ/CSIListSnapshotsPagination caught exactly that
on a loaded CI runner ("page2: got 1 entries, want 2").
The create now waits, within the same budget the delete paths use,
until the local store returns the new snapshot. Running out of budget
still answers success, since the write committed.
Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 47 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
The wait uses the same Snapshots().Get(rd, snap.Name) key as the duplicate check above it, so a create that is visible returns right away and the 5 s budget only applies while the cache trails. Running out of budget still answers 201 because the write committed, which is right. The test hides the snapshot from both Get and List, so it fails without the wait.
| // | ||
| // The budget running out is not an error: the write committed, and the | ||
| // next read catches up as it did before this wait. | ||
| func (s *Server) waitForSnapshotCreateVisible(ctx context.Context, rdName, snapName string) { |
There was a problem hiding this comment.
Non-blocking. This waits on this replica's informer. With apiserver running as a 3-replica Deployment behind a Service, csi-snapshotter's next ListSnapshots page can land on a replica whose cache has not seen the create yet, so a short page is still possible in production. Fine for the integration flake this targets; it may deserve a line in the comment.
What this fixes
TestGroupJ/CSIListSnapshotsPaginationfailed on loaded CI runners withpage2: got 1 entries, want 2. The test creates four snapshots and pages throughGET /v1/view/snapshotstwo at a time right away, the way csi-snapshotter pages through ListSnapshots after CreateSnapshot. blockstor answered the snapshot create as soon as the Snapshot object reached the apiserver, while the list is served from the informer cache. When the cache had not yet seen the last create, the second page came back short, and a short page reads as the end of the list.LINSTOR answers the create after the snapshot definition is in its database, so the
s lthat follows lists it. The create now waits, within the same budget the delete paths already use to make their result visible, until the local store returns the new snapshot. Running out of budget still answers success, since the write committed.Changes
POST /v1/resource-definitions/{rd}/snapshotswaits until the created snapshot is readable from the local store before it answers.Other integration failures looked at
TestGroupFRToggleDiskful2DisklessReapsTieBreakerandTestGroupFRAutoPlace2ReachesUpToDate(diskful replica count never reaching 2) are not fixed here.rd clazily createsDfltRscGrp, and the RG reconciler then runs the placer on every definition in that group. When it gets to a fresh definition after its volume definition exists but before the test'sr c --auto-place 2 --storage-pool lvm-thin, it places one replica on any pool, for examplefile, and the explicit auto-place can no longer add an LVM_THIN replica next to it. LINSTOR places nothing on an RG event. fix(controller): keep rebalance from re-placing a definition whose replicas were deleted #280 makes the RG reconciler skip definitions with no UpToDate replica, which removes this; with it the test passed 30 runs out of 30, against 1 to 2 failures in 30 on main.