Browse Source

Remove SetState version check to match Go behavior

Go's SetState unconditionally applies the state without any version
mismatch check. The Rust version had an extra optimistic concurrency
check that would reject valid requests from Go clients that don't
track versions.
rust-volume-server
Chris Lu 1 week ago
parent
commit
b4f4dc98b5
  1. 12
      seaweed-volume/src/server/grpc_server.rs

12
seaweed-volume/src/server/grpc_server.rs

@ -852,16 +852,8 @@ impl VolumeServer for VolumeGrpcService {
let req = request.into_inner();
if let Some(new_state) = &req.state {
// Check version matches (optimistic concurrency)
let current_version = self.state.state_version.load(Ordering::Relaxed);
if new_state.version != current_version {
return Err(Status::failed_precondition(format!(
"version mismatch: expected {}, got {}",
current_version, new_state.version
)));
}
// Apply state changes
// Match Go: simply apply the state without version checking.
// Go's SetState calls vs.store.State.Update(req.GetState()) unconditionally.
self.state
.maintenance
.store(new_state.maintenance, Ordering::Relaxed);

Loading…
Cancel
Save