HDFS-13706. [SBN read] Rename client context to ClientGSIContext. Contributed 
by Konstantin Shvachko.

Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/0105d7f5
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0105d7f5
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0105d7f5

Branch: refs/heads/trunk
Commit: 0105d7f597f6c4d73382c9425a7a38fadaf8de88
Parents: 00e99c6
Author: Konstantin V Shvachko <[email protected]>
Authored: Fri Jun 29 15:50:37 2018 -0700
Committer: Konstantin V Shvachko <[email protected]>
Committed: Mon Dec 24 09:33:59 2018 -0800

----------------------------------------------------------------------
 .../apache/hadoop/hdfs/ClientGCIContext.java    | 77 -------------------
 .../apache/hadoop/hdfs/ClientGSIContext.java    | 79 ++++++++++++++++++++
 .../hdfs/TestStateAlignmentContextWithHA.java   | 28 +++----
 3 files changed, 93 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/0105d7f5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ClientGCIContext.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ClientGCIContext.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ClientGCIContext.java
deleted file mode 100644
index 0d0bd25..0000000
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ClientGCIContext.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hdfs;
-
-import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.classification.InterfaceStability;
-import org.apache.hadoop.ipc.AlignmentContext;
-import org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto;
-import org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto;
-
-import java.util.concurrent.atomic.LongAccumulator;
-
-/**
- * This is the client side implementation responsible for receiving
- * state alignment info from server(s).
- */
[email protected]
[email protected]
-class ClientGCIContext implements AlignmentContext {
-
-  private final LongAccumulator lastSeenStateId =
-      new LongAccumulator(Math::max, Long.MIN_VALUE);
-
-  long getLastSeenStateId() {
-    return lastSeenStateId.get();
-  }
-
-  /**
-   * Client side implementation only receives state alignment info.
-   * It does not provide state alignment info therefore this does nothing.
-   */
-  @Override
-  public void updateResponseState(RpcResponseHeaderProto.Builder header) {
-    // Do nothing.
-  }
-
-  /**
-   * Client side implementation for receiving state alignment info in 
responses.
-   */
-  @Override
-  public void receiveResponseState(RpcResponseHeaderProto header) {
-    lastSeenStateId.accumulate(header.getStateId());
-  }
-
-  /**
-   * Client side implementation for providing state alignment info in requests.
-   */
-  @Override
-  public void updateRequestState(RpcRequestHeaderProto.Builder header) {
-    header.setStateId(lastSeenStateId.longValue());
-  }
-
-  /**
-   * Client side implementation only provides state alignment info in requests.
-   * Client does not receive RPC requests therefore this does nothing.
-   */
-  @Override
-  public void receiveRequestState(RpcRequestHeaderProto header) {
-    // Do nothing.
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0105d7f5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ClientGSIContext.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ClientGSIContext.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ClientGSIContext.java
new file mode 100644
index 0000000..6f69eed
--- /dev/null
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ClientGSIContext.java
@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hdfs;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.ipc.AlignmentContext;
+import org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto;
+import org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto;
+
+import java.util.concurrent.atomic.LongAccumulator;
+
+/**
+ * Global State Id context for the client.
+ * <p/>
+ * This is the client side implementation responsible for receiving
+ * state alignment info from server(s).
+ */
[email protected]
[email protected]
+class ClientGSIContext implements AlignmentContext {
+
+  private final LongAccumulator lastSeenStateId =
+      new LongAccumulator(Math::max, Long.MIN_VALUE);
+
+  long getLastSeenStateId() {
+    return lastSeenStateId.get();
+  }
+
+  /**
+   * Client side implementation only receives state alignment info.
+   * It does not provide state alignment info therefore this does nothing.
+   */
+  @Override
+  public void updateResponseState(RpcResponseHeaderProto.Builder header) {
+    // Do nothing.
+  }
+
+  /**
+   * Client side implementation for receiving state alignment info in 
responses.
+   */
+  @Override
+  public void receiveResponseState(RpcResponseHeaderProto header) {
+    lastSeenStateId.accumulate(header.getStateId());
+  }
+
+  /**
+   * Client side implementation for providing state alignment info in requests.
+   */
+  @Override
+  public void updateRequestState(RpcRequestHeaderProto.Builder header) {
+    header.setStateId(lastSeenStateId.longValue());
+  }
+
+  /**
+   * Client side implementation only provides state alignment info in requests.
+   * Client does not receive RPC requests therefore this does nothing.
+   */
+  @Override
+  public void receiveRequestState(RpcRequestHeaderProto header) {
+    // Do nothing.
+  }
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0105d7f5/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestStateAlignmentContextWithHA.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestStateAlignmentContextWithHA.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestStateAlignmentContextWithHA.java
index 3437bb0..00ed6bc 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestStateAlignmentContextWithHA.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestStateAlignmentContextWithHA.java
@@ -67,11 +67,11 @@ public class TestStateAlignmentContextWithHA {
   private static final int NUMFILES = 300;
   private static final Configuration CONF = new HdfsConfiguration();
   private static final String NAMESERVICE = "nameservice";
-  private static final List<ClientGCIContext> AC_LIST = new ArrayList<>();
+  private static final List<ClientGSIContext> AC_LIST = new ArrayList<>();
 
   private static MiniDFSCluster cluster;
   private static List<Worker> clients;
-  private static ClientGCIContext spy;
+  private static ClientGSIContext spy;
 
   private DistributedFileSystem dfs;
   private int active = 0;
@@ -80,7 +80,7 @@ public class TestStateAlignmentContextWithHA {
   static class AlignmentContextProxyProvider<T>
       extends ConfiguredFailoverProxyProvider<T> {
 
-    private ClientGCIContext alignmentContext;
+    private ClientGSIContext alignmentContext;
 
     public AlignmentContextProxyProvider(
         Configuration conf, URI uri, Class<T> xface,
@@ -89,14 +89,14 @@ public class TestStateAlignmentContextWithHA {
 
       // Create and set AlignmentContext in HAProxyFactory.
       // All proxies by factory will now have AlignmentContext assigned.
-      this.alignmentContext = (spy != null ? spy : new ClientGCIContext());
+      this.alignmentContext = (spy != null ? spy : new ClientGSIContext());
       ((ClientHAProxyFactory) factory).setAlignmentContext(alignmentContext);
 
       AC_LIST.add(alignmentContext);
     }
 
     @Override // AbstractNNFailoverProxyProvider
-    public synchronized ClientGCIContext getAlignmentContext() {
+    public synchronized ClientGSIContext getAlignmentContext() {
       return this.alignmentContext;
     }
   }
@@ -104,7 +104,7 @@ public class TestStateAlignmentContextWithHA {
   static class SpyConfiguredContextProxyProvider<T>
       extends ConfiguredFailoverProxyProvider<T> {
 
-    private ClientGCIContext alignmentContext;
+    private ClientGSIContext alignmentContext;
 
     public SpyConfiguredContextProxyProvider(
         Configuration conf, URI uri, Class<T> xface,
@@ -112,7 +112,7 @@ public class TestStateAlignmentContextWithHA {
       super(conf, uri, xface, factory);
 
       // Create but DON'T set in HAProxyFactory.
-      this.alignmentContext = (spy != null ? spy : new ClientGCIContext());
+      this.alignmentContext = (spy != null ? spy : new ClientGSIContext());
 
       AC_LIST.add(alignmentContext);
     }
@@ -180,7 +180,7 @@ public class TestStateAlignmentContextWithHA {
 
     try (DistributedFileSystem clearDfs =
              (DistributedFileSystem) FileSystem.get(confCopy)) {
-      ClientGCIContext clientState = getContext(1);
+      ClientGSIContext clientState = getContext(1);
       assertThat(clientState.getLastSeenStateId(), is(Long.MIN_VALUE));
       DFSTestUtil.writeFile(clearDfs, new Path("/testFileNoState"), 
"no_state");
       assertThat(clientState.getLastSeenStateId(), is(Long.MIN_VALUE));
@@ -231,7 +231,7 @@ public class TestStateAlignmentContextWithHA {
         cluster.getNamesystem(active).getLastWrittenTransactionId();
     try (DistributedFileSystem clearDfs =
              (DistributedFileSystem) FileSystem.get(CONF)) {
-      ClientGCIContext clientState = getContext(1);
+      ClientGSIContext clientState = getContext(1);
       assertThat(clientState.getLastSeenStateId(), is(Long.MIN_VALUE));
       DFSTestUtil.readFile(clearDfs, new Path("/testFile3"));
       assertThat(clientState.getLastSeenStateId(), is(lastWrittenId));
@@ -244,8 +244,8 @@ public class TestStateAlignmentContextWithHA {
    */
   @Test
   public void testClientSendsState() throws Exception {
-    ClientGCIContext alignmentContext = new ClientGCIContext();
-    ClientGCIContext spiedAlignContext = Mockito.spy(alignmentContext);
+    ClientGSIContext alignmentContext = new ClientGSIContext();
+    ClientGSIContext spiedAlignContext = Mockito.spy(alignmentContext);
     spy = spiedAlignContext;
 
     try (DistributedFileSystem clearDfs =
@@ -286,8 +286,8 @@ public class TestStateAlignmentContextWithHA {
    */
   @Test
   public void testClientSendsGreaterState() throws Exception {
-    ClientGCIContext alignmentContext = new ClientGCIContext();
-    ClientGCIContext spiedAlignContext = Mockito.spy(alignmentContext);
+    ClientGSIContext alignmentContext = new ClientGSIContext();
+    ClientGSIContext spiedAlignContext = Mockito.spy(alignmentContext);
     spy = spiedAlignContext;
 
     try (DistributedFileSystem clearDfs =
@@ -377,7 +377,7 @@ public class TestStateAlignmentContextWithHA {
     }
   }
 
-  private ClientGCIContext getContext(int clientCreationIndex) {
+  private ClientGSIContext getContext(int clientCreationIndex) {
     return AC_LIST.get(clientCreationIndex);
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to