Search in sources :

Example 1 with QJournalProtocolPB

use of org.apache.hadoop.hdfs.qjournal.protocolPB.QJournalProtocolPB in project hadoop by apache.

the class IPCLoggerChannel method createProxy.

protected QJournalProtocol createProxy() throws IOException {
    final Configuration confCopy = new Configuration(conf);
    // Need to set NODELAY or else batches larger than MTU can trigger 
    // 40ms nagling delays.
    confCopy.setBoolean(CommonConfigurationKeysPublic.IPC_CLIENT_TCPNODELAY_KEY, true);
    RPC.setProtocolEngine(confCopy, QJournalProtocolPB.class, ProtobufRpcEngine.class);
    return SecurityUtil.doAsLoginUser(new PrivilegedExceptionAction<QJournalProtocol>() {

        @Override
        public QJournalProtocol run() throws IOException {
            RPC.setProtocolEngine(confCopy, QJournalProtocolPB.class, ProtobufRpcEngine.class);
            QJournalProtocolPB pbproxy = RPC.getProxy(QJournalProtocolPB.class, RPC.getProtocolVersion(QJournalProtocolPB.class), addr, confCopy);
            return new QJournalProtocolTranslatorPB(pbproxy);
        }
    });
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) QJournalProtocolTranslatorPB(org.apache.hadoop.hdfs.qjournal.protocolPB.QJournalProtocolTranslatorPB) QJournalProtocol(org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocol) ProtobufRpcEngine(org.apache.hadoop.ipc.ProtobufRpcEngine) QJournalProtocolPB(org.apache.hadoop.hdfs.qjournal.protocolPB.QJournalProtocolPB) IOException(java.io.IOException)

Example 2 with QJournalProtocolPB

use of org.apache.hadoop.hdfs.qjournal.protocolPB.QJournalProtocolPB in project hadoop by apache.

the class JournalNodeSyncer method syncWithJournalAtIndex.

private void syncWithJournalAtIndex(int index) {
    LOG.info("Syncing Journal " + jn.getBoundIpcAddress().getAddress() + ":" + jn.getBoundIpcAddress().getPort() + " with " + otherJNProxies.get(index) + ", journal id: " + jid);
    final QJournalProtocolPB jnProxy = otherJNProxies.get(index).jnProxy;
    if (jnProxy == null) {
        LOG.error("JournalNode Proxy not found.");
        return;
    }
    List<RemoteEditLog> thisJournalEditLogs;
    try {
        thisJournalEditLogs = journal.getEditLogManifest(0, false).getLogs();
    } catch (IOException e) {
        LOG.error("Exception in getting local edit log manifest", e);
        return;
    }
    GetEditLogManifestResponseProto editLogManifest;
    try {
        editLogManifest = jnProxy.getEditLogManifest(null, GetEditLogManifestRequestProto.newBuilder().setJid(jidProto).setSinceTxId(0).setInProgressOk(false).build());
    } catch (ServiceException e) {
        LOG.error("Could not sync with Journal at " + otherJNProxies.get(journalNodeIndexForSync), e);
        return;
    }
    getMissingLogSegments(thisJournalEditLogs, editLogManifest, otherJNProxies.get(index));
}
Also used : GetEditLogManifestResponseProto(org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.GetEditLogManifestResponseProto) ServiceException(com.google.protobuf.ServiceException) QJournalProtocolPB(org.apache.hadoop.hdfs.qjournal.protocolPB.QJournalProtocolPB) RemoteEditLog(org.apache.hadoop.hdfs.server.protocol.RemoteEditLog) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)2 QJournalProtocolPB (org.apache.hadoop.hdfs.qjournal.protocolPB.QJournalProtocolPB)2 ServiceException (com.google.protobuf.ServiceException)1 Configuration (org.apache.hadoop.conf.Configuration)1 QJournalProtocol (org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocol)1 GetEditLogManifestResponseProto (org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.GetEditLogManifestResponseProto)1 QJournalProtocolTranslatorPB (org.apache.hadoop.hdfs.qjournal.protocolPB.QJournalProtocolTranslatorPB)1 RemoteEditLog (org.apache.hadoop.hdfs.server.protocol.RemoteEditLog)1 ProtobufRpcEngine (org.apache.hadoop.ipc.ProtobufRpcEngine)1