HDFS-13073. Cleanup code in InterQJournalProtocol.proto. Contributed by Bharat Viswanadham.

This commit is contained in:
Hanisha Koneru 2018-02-02 16:28:03 -08:00
parent 50723889cc
commit 0ef639235b
6 changed files with 29 additions and 44 deletions

View File

@ -21,7 +21,7 @@ package org.apache.hadoop.hdfs.qjournal.protocol;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.qjournal.server.JournalNode;
import org.apache.hadoop.hdfs.qjournal.protocol.InterQJournalProtocolProtos.GetEditLogManifestFromJournalResponseProto;
import org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.GetEditLogManifestResponseProto;
import org.apache.hadoop.security.KerberosInfo;
import java.io.IOException;
@ -47,7 +47,7 @@ public interface InterQJournalProtocol {
* segment
* @return a list of edit log segments since the given transaction ID.
*/
GetEditLogManifestFromJournalResponseProto getEditLogManifestFromJournal(
GetEditLogManifestResponseProto getEditLogManifestFromJournal(
String jid, String nameServiceId, long sinceTxId, boolean inProgressOk)
throws IOException;

View File

@ -24,8 +24,8 @@ import com.google.protobuf.ServiceException;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.hdfs.qjournal.protocol.InterQJournalProtocol;
import org.apache.hadoop.hdfs.qjournal.protocol.InterQJournalProtocolProtos.GetEditLogManifestFromJournalRequestProto;
import org.apache.hadoop.hdfs.qjournal.protocol.InterQJournalProtocolProtos.GetEditLogManifestFromJournalResponseProto;
import org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.GetEditLogManifestRequestProto;
import org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.GetEditLogManifestResponseProto;
import java.io.IOException;
@ -47,10 +47,9 @@ public class InterQJournalProtocolServerSideTranslatorPB implements
}
@Override
public GetEditLogManifestFromJournalResponseProto
getEditLogManifestFromJournal(RpcController controller,
GetEditLogManifestFromJournalRequestProto
request) throws ServiceException {
public GetEditLogManifestResponseProto getEditLogManifestFromJournal(
RpcController controller, GetEditLogManifestRequestProto request)
throws ServiceException {
try {
return impl.getEditLogManifestFromJournal(
request.getJid().getIdentifier(),

View File

@ -24,8 +24,8 @@ import com.google.protobuf.ServiceException;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.hdfs.qjournal.protocol.InterQJournalProtocol;
import org.apache.hadoop.hdfs.qjournal.protocol.InterQJournalProtocolProtos.GetEditLogManifestFromJournalResponseProto;
import org.apache.hadoop.hdfs.qjournal.protocol.InterQJournalProtocolProtos.GetEditLogManifestFromJournalRequestProto;
import org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.GetEditLogManifestRequestProto;
import org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.GetEditLogManifestResponseProto;
import org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos;
import org.apache.hadoop.ipc.ProtobufHelper;
import org.apache.hadoop.ipc.ProtocolMetaInterface;
@ -60,13 +60,12 @@ public class InterQJournalProtocolTranslatorPB implements ProtocolMetaInterface,
@Override
public GetEditLogManifestFromJournalResponseProto
getEditLogManifestFromJournal(String jid, String nameServiceId,
long sinceTxId, boolean inProgressOk)
public GetEditLogManifestResponseProto getEditLogManifestFromJournal(
String jid, String nameServiceId, long sinceTxId, boolean inProgressOk)
throws IOException {
try {
GetEditLogManifestFromJournalRequestProto.Builder req;
req = GetEditLogManifestFromJournalRequestProto.newBuilder()
GetEditLogManifestRequestProto.Builder req;
req = GetEditLogManifestRequestProto.newBuilder()
.setJid(convertJournalId(jid))
.setSinceTxId(sinceTxId)
.setInProgressOk(inProgressOk);

View File

@ -17,10 +17,8 @@
*/
package org.apache.hadoop.hdfs.qjournal.server;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.URL;
import com.google.common.annotations.VisibleForTesting;
import com.google.protobuf.BlockingService;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeys;
@ -31,7 +29,6 @@ import org.apache.hadoop.hdfs.HDFSPolicyProvider;
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
import org.apache.hadoop.hdfs.qjournal.protocol.InterQJournalProtocol;
import org.apache.hadoop.hdfs.qjournal.protocol.InterQJournalProtocolProtos.InterQJournalProtocolService;
import org.apache.hadoop.hdfs.qjournal.protocol.InterQJournalProtocolProtos.GetEditLogManifestFromJournalResponseProto;
import org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocol;
import org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.GetEditLogManifestResponseProto;
import org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.GetJournalStateResponseProto;
@ -52,8 +49,9 @@ import org.apache.hadoop.ipc.RPC;
import org.apache.hadoop.ipc.RPC.Server;
import org.apache.hadoop.net.NetUtils;
import com.google.common.annotations.VisibleForTesting;
import com.google.protobuf.BlockingService;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.URL;
@InterfaceAudience.Private
@ -286,14 +284,15 @@ public class JournalNodeRpcServer implements QJournalProtocol,
@SuppressWarnings("deprecation")
@Override
public GetEditLogManifestFromJournalResponseProto
getEditLogManifestFromJournal(String jid, String nameServiceId,
long sinceTxId, boolean inProgressOk)
public GetEditLogManifestResponseProto getEditLogManifestFromJournal(
String jid, String nameServiceId,
long sinceTxId, boolean inProgressOk)
throws IOException {
RemoteEditLogManifest manifest = jn.getOrCreateJournal(jid, nameServiceId)
.getEditLogManifest(sinceTxId, inProgressOk);
return GetEditLogManifestFromJournalResponseProto.newBuilder()
return GetEditLogManifestResponseProto.newBuilder()
.setManifest(PBHelper.convert(manifest))
.setHttpPort(jn.getBoundHttpAddress().getPort())
.setFromURL(jn.getHttpServerURI())

View File

@ -28,7 +28,7 @@ import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.DFSUtilClient;
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
import org.apache.hadoop.hdfs.qjournal.protocol.InterQJournalProtocol;
import org.apache.hadoop.hdfs.qjournal.protocol.InterQJournalProtocolProtos.GetEditLogManifestFromJournalResponseProto;
import org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.GetEditLogManifestResponseProto;
import org.apache.hadoop.hdfs.qjournal.protocolPB.InterQJournalProtocolPB;
import org.apache.hadoop.hdfs.qjournal.protocolPB.InterQJournalProtocolTranslatorPB;
import org.apache.hadoop.hdfs.server.common.Util;
@ -245,7 +245,7 @@ public class JournalNodeSyncer {
return;
}
GetEditLogManifestFromJournalResponseProto editLogManifest;
GetEditLogManifestResponseProto editLogManifest;
try {
editLogManifest = jnProxy.getEditLogManifestFromJournal(jid,
nameServiceId, 0, false);
@ -318,8 +318,8 @@ public class JournalNodeSyncer {
}
private void getMissingLogSegments(List<RemoteEditLog> thisJournalEditLogs,
GetEditLogManifestFromJournalResponseProto response,
JournalNodeProxy remoteJNproxy) {
GetEditLogManifestResponseProto response,
JournalNodeProxy remoteJNproxy) {
List<RemoteEditLog> otherJournalEditLogs = PBHelper.convert(
response.getManifest()).getLogs();

View File

@ -31,20 +31,8 @@ package hadoop.hdfs.qjournal;
import "HdfsServer.proto";
import "QJournalProtocol.proto";
message GetEditLogManifestFromJournalRequestProto {
required JournalIdProto jid = 1;
required uint64 sinceTxId = 2; // Transaction ID
optional bool inProgressOk = 3 [default = false];
optional string nameServiceId = 4;
}
message GetEditLogManifestFromJournalResponseProto {
required RemoteEditLogManifestProto manifest = 1;
required uint32 httpPort = 2;
optional string fromURL = 3;
}
service InterQJournalProtocolService {
rpc getEditLogManifestFromJournal(GetEditLogManifestFromJournalRequestProto)
returns (GetEditLogManifestFromJournalResponseProto);
rpc getEditLogManifestFromJournal(GetEditLogManifestRequestProto)
returns (GetEditLogManifestResponseProto);
}