Search in sources :

Example 1 with QJournalProtocol

use of org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocol 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 QJournalProtocol

use of org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocol in project hadoop by apache.

the class TestIPCLoggerChannel method setupMock.

@Before
public void setupMock() {
    conf.setInt(DFSConfigKeys.DFS_QJOURNAL_QUEUE_SIZE_LIMIT_KEY, LIMIT_QUEUE_SIZE_MB);
    // Channel to the mock object instead of a real IPC proxy.
    ch = new IPCLoggerChannel(conf, FAKE_NSINFO, JID, FAKE_ADDR) {

        @Override
        protected QJournalProtocol getProxy() throws IOException {
            return mockProxy;
        }
    };
    ch.setEpoch(1);
}
Also used : QJournalProtocol(org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocol) IPCLoggerChannel(org.apache.hadoop.hdfs.qjournal.client.IPCLoggerChannel) IOException(java.io.IOException) Before(org.junit.Before)

Aggregations

IOException (java.io.IOException)2 QJournalProtocol (org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocol)2 Configuration (org.apache.hadoop.conf.Configuration)1 IPCLoggerChannel (org.apache.hadoop.hdfs.qjournal.client.IPCLoggerChannel)1 QJournalProtocolPB (org.apache.hadoop.hdfs.qjournal.protocolPB.QJournalProtocolPB)1 QJournalProtocolTranslatorPB (org.apache.hadoop.hdfs.qjournal.protocolPB.QJournalProtocolTranslatorPB)1 ProtobufRpcEngine (org.apache.hadoop.ipc.ProtobufRpcEngine)1 Before (org.junit.Before)1