Просмотр исходного кода

Remove UniqueId from get requests.

Jing Yang 3 лет назад
Родитель
Сommit
94a57113fc
2 измененных файлов с 3 добавлено и 11 удалено
  1. 3 9
      kvraft/src/client.rs
  2. 0 2
      kvraft/src/common.rs

+ 3 - 9
kvraft/src/client.rs

@@ -163,21 +163,14 @@ impl ClerkInner {
     /// This function returns None when
     /// This function returns None when
     /// 1. No KVServer can be reached, or
     /// 1. No KVServer can be reached, or
     /// 2. No KVServer claimed to be the leader, or
     /// 2. No KVServer claimed to be the leader, or
-    /// 3. When the KVServer committed the request but it was not passed
-    /// back to the clerk. We must retry with a new unique_id.
     ///
     ///
-    /// In all 3 cases the request can be retried.
-    ///
-    /// This function do not expect a Conflict request with the same unique_id.
+    /// In both cases the request can be retried.
     pub fn get(
     pub fn get(
         &mut self,
         &mut self,
         key: String,
         key: String,
         options: KVRaftOptions,
         options: KVRaftOptions,
     ) -> Option<Option<String>> {
     ) -> Option<Option<String>> {
-        let args = GetArgs {
-            key,
-            unique_id: self.unique_id.inc(),
-        };
+        let args = GetArgs { key };
         let reply: GetReply = self.retry_rpc(
         let reply: GetReply = self.retry_rpc(
             |remote, args| remote.get(args),
             |remote, args| remote.get(args),
             args,
             args,
@@ -185,6 +178,7 @@ impl ClerkInner {
         )?;
         )?;
         match reply.result {
         match reply.result {
             Ok(val) => Some(val),
             Ok(val) => Some(val),
+            Err(KVError::Expired) => panic!("Get requests do not expire."),
             Err(KVError::Conflict) => panic!("We should never see a conflict."),
             Err(KVError::Conflict) => panic!("We should never see a conflict."),
             _ => None,
             _ => None,
         }
         }

+ 0 - 2
kvraft/src/common.rs

@@ -75,8 +75,6 @@ pub struct PutAppendReply {
 #[derive(Clone, Debug, Serialize, Deserialize)]
 #[derive(Clone, Debug, Serialize, Deserialize)]
 pub struct GetArgs {
 pub struct GetArgs {
     pub key: String,
     pub key: String,
-
-    pub unique_id: UniqueId,
 }
 }
 
 
 #[derive(Clone, Debug, Serialize, Deserialize)]
 #[derive(Clone, Debug, Serialize, Deserialize)]