Skip to content

Commit

Permalink
chore: rename exist to exists
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Nov 27, 2023
1 parent a784d56 commit 2f8ad55
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/common/meta/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,20 @@ impl Display for RegionIdent {
/// The result of downgrade leader region.
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
pub struct DowngradeRegionReply {
/// Returns the `last_entry_id` if available.
pub last_entry_id: Option<u64>,
pub exist: bool,
/// Indicates whether the region exists.
pub exists: bool,
/// Return error if any during the operation.
pub error: Option<String>,
}

impl Display for DowngradeRegionReply {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(
f,
"(last_entry_id={:?}, exist={}, error={:?})",
self.last_entry_id, self.exist, self.error
"(last_entry_id={:?}, exists={}, error={:?})",
self.last_entry_id, self.exists, self.error
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl DowngradeLeaderRegion {
let reply = HeartbeatMailbox::json_reply(&msg)?;
let InstructionReply::DowngradeRegion(DowngradeRegionReply {
last_entry_id,
exist,
exists,
error,
}) = reply
else {
Expand All @@ -143,7 +143,7 @@ impl DowngradeLeaderRegion {
.fail();
}

if !exist {
if !exists {
warn!(
"Trying to downgrade the region {} on Datanode {}, but region doesn't exist!",
region_id, leader
Expand Down Expand Up @@ -239,7 +239,7 @@ mod tests {
payload: Some(Payload::Json(
serde_json::to_string(&InstructionReply::DowngradeRegion(DowngradeRegionReply {
last_entry_id,
exist,
exists: exist,
error,
}))
.unwrap(),
Expand Down

0 comments on commit 2f8ad55

Please sign in to comment.