Pārlūkot izejas kodu

Reply on retry_rpc() to retry on transient errors.

Jing Yang 3 gadi atpakaļ
vecāks
revīzija
6efd08e757
2 mainītis faili ar 14 papildinājumiem un 7 dzēšanām
  1. 7 5
      kvraft/src/async_client.rs
  2. 7 2
      kvraft/src/client.rs

+ 7 - 5
kvraft/src/async_client.rs

@@ -92,7 +92,7 @@ impl AsyncClient {
                 .retry_rpc(
                     |remote, args| remote.commit_sentinel(args),
                     args,
-                    Some(1),
+                    None,
                 )
                 .await;
             if let Some(reply) = reply {
@@ -106,10 +106,12 @@ impl AsyncClient {
                         // committed more than just the sentinel.
                         // Do nothing.
                     }
-                    // Technically we do not need to create new unique ID
-                    // sequence if the error is TimeOut or NotLeader. But it
-                    // does not hurt to refresh anyway.
-                    Err(_) => {}
+                    Err(e) => {
+                        panic!(
+                            "Unexpected error with indefinite retry: {:?}",
+                            e
+                        );
+                    }
                 };
             };
         }

+ 7 - 2
kvraft/src/client.rs

@@ -95,7 +95,7 @@ impl ClerkInner {
             let reply: Option<CommitSentinelReply> = self.retry_rpc(
                 |remote, args| remote.commit_sentinel(args),
                 args,
-                Some(1),
+                None,
             );
             if let Some(reply) = reply {
                 match reply.result {
@@ -110,7 +110,12 @@ impl ClerkInner {
                         // committed more than just the sentinel.
                         self.unique_id = UniqueIdSequence::new();
                     }
-                    Err(_) => {}
+                    Err(e) => {
+                        panic!(
+                            "Unexpected error with indefinite retry: {:?}",
+                            e
+                        );
+                    }
                 };
             };
         }