From e9238f89ff4e720dd48f03ec464a4e1092392598 Mon Sep 17 00:00:00 2001 From: Saketh Kalaga <51327242+renormalize@users.noreply.github.com> Date: Fri, 16 Aug 2024 18:52:52 +0530 Subject: [PATCH] Enhance the example which showcases the snapshot maintenance operation. * Snapshot hash is sent after the first occurance of `r.remaining_bytes() == 0`. See https://github.com/etcd-io/etcd/pull/11896 for more information. * If the snapshot operation is performed as shown in the example previously, restarting the etcd on the stored data from this won't succeed unless etcd is started with `--skip-hash-check=true`. This isn't necessary anymore since the final `msg.message().await` fetches the snapshot hash information. --- examples/maintenance.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/maintenance.rs b/examples/maintenance.rs index f73c92d..7bfd3ae 100644 --- a/examples/maintenance.rs +++ b/examples/maintenance.rs @@ -43,6 +43,15 @@ async fn main() -> Result<(), Error> { } } } + let resp = msg.message().await?; + if let Some(r) = resp { + // snapshot hash is sent after r.remaining_bytes() == 0 + println!( + "Received snapshot hash {:?} of len {}", + r.blob(), + r.blob().len() + ); + } // Mover leader let resp = client.member_list().await?;