chore: add logs for setting the region to writable (#4044)

* chore: add logs for setting the region to writable

* fix: ignore redundant logs
This commit is contained in:
Weny Xu
2024-05-27 13:01:40 +09:00
committed by GitHub
parent af486ec0d0
commit 389ded93d1

View File

@@ -168,10 +168,24 @@ impl MitoRegion {
if writable {
// Only sets the region to writable if it is read only.
// This prevents others updating the manifest.
let _ = self
match self
.manifest_ctx
.state
.compare_exchange(RegionState::ReadOnly, RegionState::Writable);
.compare_exchange(RegionState::ReadOnly, RegionState::Writable)
{
Ok(state) => info!(
"Set region {} to writable, previous state: {:?}",
self.region_id, state
),
Err(state) => {
if state != RegionState::Writable {
warn!(
"Failed to set region {} to writable, current state: {:?}",
self.region_id, state
)
}
}
}
} else {
self.manifest_ctx.state.store(RegionState::ReadOnly);
}