hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jl...@apache.org
Subject svn commit: r1462632 - in /hadoop/common/trunk/hadoop-yarn-project: ./ hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/ hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-c...
Date Fri, 29 Mar 2013 20:20:19 GMT
Author: jlowe
Date: Fri Mar 29 20:20:19 2013
New Revision: 1462632

URL: http://svn.apache.org/r1462632
Log:
YARN-515. Node Manager not getting the master key. Contributed by Robert Joseph Evans

Added:
    hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/
    hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/api/
    hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/api/protocolrecords/
    hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/api/protocolrecords/TestRegisterNodeManagerResponse.java
Modified:
    hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt
    hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RegisterNodeManagerResponsePBImpl.java

Modified: hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt?rev=1462632&r1=1462631&r2=1462632&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt Fri Mar 29 20:20:19 2013
@@ -158,6 +158,9 @@ Release 2.0.5-beta - UNRELEASED
     YARN-24. Nodemanager fails to start if log aggregation enabled and 
     namenode unavailable. (sandyr via tucu)
 
+    YARN-515. Node Manager not getting the master key. (Robert Joseph Evans
+    via jlowe)
+
 Release 2.0.4-alpha - UNRELEASED
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RegisterNodeManagerResponsePBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RegisterNodeManagerResponsePBImpl.java?rev=1462632&r1=1462631&r2=1462632&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RegisterNodeManagerResponsePBImpl.java
(original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RegisterNodeManagerResponsePBImpl.java
Fri Mar 29 20:20:19 2013
@@ -98,6 +98,7 @@ public class RegisterNodeManagerResponse
     if (masterKey == null)
       builder.clearMasterKey();
     this.masterKey = masterKey;
+    rebuild = true;
   }
 
   @Override
@@ -114,9 +115,10 @@ public class RegisterNodeManagerResponse
     maybeInitBuilder();
     if (nodeAction == null) {
       builder.clearNodeAction();
-      return;
+    } else {
+      builder.setNodeAction(convertToProtoFormat(nodeAction));
     }
-    builder.setNodeAction(convertToProtoFormat(nodeAction));
+    rebuild = true;
   }
 
   private NodeAction convertFromProtoFormat(NodeActionProto p) {

Added: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/api/protocolrecords/TestRegisterNodeManagerResponse.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/api/protocolrecords/TestRegisterNodeManagerResponse.java?rev=1462632&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/api/protocolrecords/TestRegisterNodeManagerResponse.java
(added)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/api/protocolrecords/TestRegisterNodeManagerResponse.java
Fri Mar 29 20:20:19 2013
@@ -0,0 +1,75 @@
+/**
+ * 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.yarn.server.api.protocolrecords;
+
+import static org.junit.Assert.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.nio.ByteBuffer;
+
+import org.apache.hadoop.yarn.factories.RecordFactory;
+import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
+import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.RegisterNodeManagerResponsePBImpl;
+import org.apache.hadoop.yarn.server.api.records.MasterKey;
+import org.apache.hadoop.yarn.server.api.records.NodeAction;
+import org.junit.Test;
+
+import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.RegisterNodeManagerResponseProto;
+
+public class TestRegisterNodeManagerResponse {
+  private static final RecordFactory recordFactory = 
+    RecordFactoryProvider.getRecordFactory(null);
+  
+  @Test
+  public void testRoundTrip() throws Exception {
+    RegisterNodeManagerResponse resp = recordFactory
+    .newRecordInstance(RegisterNodeManagerResponse.class);
+    MasterKey mk = recordFactory.newRecordInstance(MasterKey.class);
+    mk.setKeyId(54321);
+    byte b [] = {0,1,2,3,4,5};
+    mk.setBytes(ByteBuffer.wrap(b));
+    resp.setMasterKey(mk);
+    resp.setNodeAction(NodeAction.NORMAL);
+    
+    assertEquals(NodeAction.NORMAL, resp.getNodeAction());
+    assertNotNull(resp.getMasterKey());
+    assertEquals(54321, resp.getMasterKey().getKeyId());
+    assertArrayEquals(b, resp.getMasterKey().getBytes().array());
+    
+    RegisterNodeManagerResponse respCopy = serDe(resp);
+    
+    assertEquals(NodeAction.NORMAL, respCopy.getNodeAction());
+    assertNotNull(respCopy.getMasterKey());
+    assertEquals(54321, respCopy.getMasterKey().getKeyId());
+    assertArrayEquals(b, respCopy.getMasterKey().getBytes().array());
+  }
+
+  public static RegisterNodeManagerResponse serDe(RegisterNodeManagerResponse orig) throws
Exception {
+    RegisterNodeManagerResponsePBImpl asPB = (RegisterNodeManagerResponsePBImpl)orig;
+    RegisterNodeManagerResponseProto proto = asPB.getProto();
+    ByteArrayOutputStream out = new ByteArrayOutputStream();
+    proto.writeTo(out);
+    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+    RegisterNodeManagerResponseProto.Builder cp = RegisterNodeManagerResponseProto.newBuilder();
+    cp.mergeFrom(in);
+    return new RegisterNodeManagerResponsePBImpl(cp.build());
+  }
+
+}



Mime
View raw message