mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 11:07:31 +01:00
105 lines
6.5 KiB
Markdown
105 lines
6.5 KiB
Markdown
# Online create and placement command (v1.0.1 S1)
|
|
|
|
Draft implementation. This branch must not merge before v1.0.0 is cut.
|
|
S1 is the single-replica operations item: create a volume and record its
|
|
placement online, without restarting blockmaster. It composes existing RPCs;
|
|
it does not add a state, grant, promotion, host registration or kernel transition.
|
|
|
|
Operator interface:
|
|
|
|
```sh
|
|
sw-block ops volume create --master MASTER --size-bytes 268435456 \
|
|
--protocol nvme --transport tcp --server-id registered-host --replica-id r1 \
|
|
--data-addr 192.0.2.10:9201 --ctrl-addr 192.0.2.10:9202 \
|
|
--timeout 10s new-volume
|
|
```
|
|
|
|
The node must already be registered. Online host registration is outside S1.
|
|
The command validates all local arguments before any RPC, then invokes
|
|
LifecycleService.CreateVolume with RF1, waits for its store-ready answer,
|
|
registers the exact per-volume WorkspaceBinding, and calls PlaceWorkspace.
|
|
It uses the existing authenticated connection options. A successful answer
|
|
means placement recorded, not a lease issued or a target serving. Starting the
|
|
unit, assignment and guest connection remain separate operator steps.
|
|
|
|
CreateVolume owns the volume record and the store-ready gate. The existing
|
|
binding receiver owns endpoint reservations and registered-node checks.
|
|
PlaceWorkspace owns placement admission under workspaceMu and its publisher
|
|
guard. The command never writes these stores directly, mints an epoch, or
|
|
uses time to decide authority. Its one context deadline only bounds waiting.
|
|
|
|
| Last completed step | Refused next step | Unknown next outcome |
|
|
| --- | --- | --- |
|
|
| none | report refusal; do not call binding/placement | report unknown create; retry same name and geometry |
|
|
| store-ready create | leave volume created; do not place | report binding unknown; retry identical intent |
|
|
| binding | leave binding prepared; no success claim | report placement unknown; retry identical intent |
|
|
| placement | report placement recorded, never serving | no success without an acknowledged placement result |
|
|
|
|
There is no client journal, rollback or atomic three-record claim. Identical
|
|
retries use existing receiver idempotence. Changed geometry/identity, conflicting
|
|
bindings and an existing assignment must remain subject to receiver refusal;
|
|
the CLI must validate the returned create identity/geometry before proceeding.
|
|
No ordinary-create request ID is sent: that existing field denotes restore.
|
|
|
|
The first red test, TestOpsVolumeCreateAndPlaceWithoutMasterRestart, invokes
|
|
the real CLI dispatcher against public gRPC receivers. It requires exactly
|
|
create -> bind -> place with the stated RF1 intent while one endpoint remains
|
|
running. Before implementation it failed because only volume resolve existed.
|
|
Additional CLI tests cover refusal/unknown outcomes at each step, argument
|
|
admission, matching reply identity and readiness. The real-master test checks
|
|
identical retries and conflicting placement without restarting the master.
|
|
These are control-plane tests, not guest-I/O acceptance.
|
|
|
|
The default protocol is `nvme` with `tcp`, the supported guest path.
|
|
Success prints one JSON object with `status: "placement_recorded"`, `volume`,
|
|
`layout_id`, `server_id` and `replica_id`. Exit 2 means invalid arguments or
|
|
connection configuration, 78 means a definite refusal, and 75 means an unknown
|
|
RPC outcome or a not-ready store. On an error, the command stops before the
|
|
next step. Earlier acknowledged steps remain recorded; retry the same name,
|
|
geometry and placement. There is no automatic retry or rollback.
|
|
|
|
The complete command requires ADMIN; all three calls use strict audit admission.
|
|
A retry with a different placement
|
|
cannot overwrite the existing intent: the master's conflicting-placement
|
|
refusal remains the owner of that decision.
|
|
When the master has its product loop off, new CreateVolume records and first
|
|
PlaceWorkspace intents for a volume absent from its static topology are refused with FailedPrecondition naming
|
|
`--lifecycle-product-loop-interval` as the cure. The first door writes no record
|
|
or store. This checks immutable startup configuration at the receiver, under
|
|
workspaceMu; it is not a preflight RPC or a client claim about the configuration.
|
|
Turning the loop off later does not stop volumes already assigned; the admission
|
|
only prevents new records or first placements, and recorded retries keep their
|
|
existing identity and conflict rules.
|
|
If assignment has already happened before a retry, the master may refuse
|
|
placement with `volume already assigned; use move` (exit 78). This is a safe
|
|
refusal, not a rollback: inspect `ops workspace show` before further action.
|
|
|
|
To abandon a created or prepared-but-unplaced volume, use `ops chunk
|
|
volume-delete` as documented for a volume that never served. It removes the
|
|
store and commits master deletion, including prepared bindings and their two
|
|
endpoint reservations. Do not erase a binding file or the master record by
|
|
hand. An already placed volume may have acquired a line or lease; follow the
|
|
documented delete admission and printed lease horizon, or the running
|
|
holder's seal/revoke/ACK procedure if it served. Deleted names are not reused.
|
|
|
|
Existing contracts relied on: M2 authority/assignment in invariants.md;
|
|
INV-AUTH-HOLDER-IDENTITY-001 and INV-VOL-ID-NO-REUSE-001;
|
|
core/host/master/services.go CreateVolume;
|
|
core/host/master/workspace_binding.go RegisterWorkspaceBinding/PlaceWorkspace;
|
|
core/rpc/proto/control.proto and workspace.proto.
|
|
|
|
### T5 upgrade compatibility
|
|
|
|
Run these v1.0.0 procedures alongside the S1 admission matrix; do not enable a
|
|
new scheduler to make them pass. The shared handoff binary arguments retain no
|
|
`--lifecycle-product-loop-interval`. The move and lease fixtures already invoke
|
|
`runProductLoop` and `tickAfterProcessReports` themselves; their Config boolean
|
|
declares that existing producer rather than adding one.
|
|
|
|
| Procedure | Existing witness | Assignment producer |
|
|
| --- | --- | --- |
|
|
| Planned handoff and restore | `TestStandalonePlannedHandoffToTheSameHost`, `TestStandaloneCleanMoveWithoutTheACKIsRefused`, `TestCutoverWriteSnapshotKillRestartRestore`, `TestCutoverCreateFromSnapshot` | Static topology, including the declared restore target; binary loop flag off |
|
|
| Layout move | `TestIntegrationWorkspaceLayoutMove` | Existing fixture product ticks, with the same assertions |
|
|
| Workspace lease | `TestBinaryWorkspaceLeaseOptInOwnsCLEANShutdown` | Existing fixture product ticks; the early-line negative control still bypasses them |
|
|
| Restart with the loop off | `TestRecordedDynamicIntentRetriesAfterRestartWithTheLoopOff` | Persisted record and placement; no new tick after restart, both before and after an issued line |
|