diff --git a/seaweed-block/core/host/master/workspace_lease_horizon_test.go b/seaweed-block/core/host/master/workspace_lease_horizon_test.go index 5910a0371c..45aabdfb6e 100644 --- a/seaweed-block/core/host/master/workspace_lease_horizon_test.go +++ b/seaweed-block/core/host/master/workspace_lease_horizon_test.go @@ -105,7 +105,7 @@ func TestWorkspaceLeaseGuardFencesByHorizonUnderStalledStore(t *testing.T) { // Control 6a and the reply clamp: through the services layer, QueryWorkspace // and RevokeWorkspace report the granted expiry, not the durable horizon; a // renewal during a held reservation write of the SAME volume (revoked and -// ACKed, so deletion is admitted) returns the revoking lease without waiting, +// ACKed, so deletion is admitted) returns typed FINAL without waiting, // and once the reservation is published renewals are refused. func TestWorkspaceRenewalRPCDuringHeldSameVolumeReservation(t *testing.T) { h, c, ctx := reviewBindingHost(t) @@ -129,6 +129,12 @@ func TestWorkspaceRenewalRPCDuringHeldSameVolumeReservation(t *testing.T) { if err != nil || !rv.Revoking || rv.ExpiresAtNs != first.ExpiresAtNs { t.Fatalf("RevokeWorkspace must report the grant %d, got %+v %v", first.ExpiresAtNs, rv, err) } + // Before the ACK is recorded, the holder must still receive the + // revoking grant so it can drain and acknowledge the stop. + beforeAck, err := svc.RenewWorkspaceLease(loopbackPeer(ctx), id) + if err != nil || beforeAck == nil || !beforeAck.Revoking || beforeAck.ExpiresAtNs != first.ExpiresAtNs { + t.Fatalf("renewal before the ACK: %+v %v; want the revoking lease with granted expiry", beforeAck, err) + } if _, err := svc.AckWorkspaceRevoked(loopbackPeer(ctx), &control.WorkspaceRevocationAck{Identity: id, HeadGen: 9}); err != nil { t.Fatal(err) } @@ -212,8 +218,9 @@ func TestWorkspaceRenewalRPCDuringHeldSameVolumeReservation(t *testing.T) { case f := <-renewed: err := <-renewErr renewErr <- err - if err != nil || !f.Revoking || f.ExpiresAtNs != first.ExpiresAtNs { - t.Fatalf("renewal during the held same-volume reservation: %+v %v; want the revoking lease with the granted expiry", f, err) + _, kind := refusalOf(t, "renewal during held same-volume reservation", err) + if f != nil || kind == nil || kind.GetKind() != control.WorkspaceLeaseRefusal_FINAL { + t.Fatalf("renewal after recorded ACK during the held reservation: %+v %v; want typed FINAL", f, err) } case <-time.After(2 * time.Second): t.Fatal("renewal waited on the held reservation write") diff --git a/seaweed-block/docs/upgrade-v1.0.1.md b/seaweed-block/docs/upgrade-v1.0.1.md index dfae8223b4..b872e475b9 100644 --- a/seaweed-block/docs/upgrade-v1.0.1.md +++ b/seaweed-block/docs/upgrade-v1.0.1.md @@ -65,7 +65,12 @@ no move are needed. The cut needs the volume's `--chunk-control-endpoint`; without it, skip this step. If the cut answers a retryable error or an unknown outcome, go on: the restart keeps every acknowledged write in the local WAL either way. -2. **Replace the binary**, once per host: stage it next to the old one, check it, then rename it over the old one. +2. **Update the unit, then replace the binary**, once per host. Before installing or switching to the new binary, + update each installed blockvolume unit from the matching v1.0.1 shipped unit (preserving local settings), then + run `sudo systemctl daemon-reload`. The added `79` in `RestartPreventExitStatus` also works with the old binary + (which never exits 79). Do this first so even an unplanned restart during the switch cannot run a new holder + under an old restart policy. Leaving an old unit installed restarts a new holder after a recorded revocation, + and the no-restart fix is not in effect. Then stage the binary next to the old one, check it, and rename it: A rename in the same directory is atomic, so a unit that starts at any moment finds either the old or the new binary, never a partial file: @@ -75,8 +80,6 @@ no move are needed. sudo mv /usr/local/bin/blockvolume.new /usr/local/bin/blockvolume ``` - Update the installed blockvolume unit file together with the binary and run `systemctl daemon-reload`: v1.0.1's units list `79` in `RestartPreventExitStatus`, so leaving an old unit installed restarts a new holder after a recorded revocation and the no-restart fix is not in effect. - The volumes still running keep their old process until they restart. From now on, any `blockvolume` on this host that starts again, planned or not (for example after a lease expiry, exit 75, or a crash), starts as v1.0.1. That is supported: it is the same restart.