Search in sources :

Example 1 with TRANSACTION_INFO_KEY

use of org.apache.hadoop.ozone.OzoneConsts.TRANSACTION_INFO_KEY in project ozone by apache.

the class InterSCMGrpcService method download.

@Override
public void download(CopyDBCheckpointRequestProto request, StreamObserver<CopyDBCheckpointResponseProto> responseObserver) {
    try {
        scm.getScmHAManager().asSCMHADBTransactionBuffer().flush();
        Table<String, TransactionInfo> transactionInfoTable = Arrays.stream(new SCMDBDefinition().getColumnFamilies()).filter(t -> t.getValueType() == TransactionInfo.class).findFirst().get().getTable(scm.getScmMetadataStore().getStore());
        TransactionInfo transactionInfo = transactionInfoTable.get(TRANSACTION_INFO_KEY);
        Preconditions.checkNotNull(transactionInfo);
        SCMGrpcOutputStream outputStream = new SCMGrpcOutputStream(responseObserver, scm.getClusterId(), BUFFER_SIZE);
        provider.writeDBCheckPointToSream(outputStream, request.getFlush());
    } catch (IOException e) {
        LOG.error("Error streaming SCM DB checkpoint", e);
        responseObserver.onError(e);
    }
}
Also used : TransactionInfo(org.apache.hadoop.hdds.utils.TransactionInfo) CopyDBCheckpointRequestProto(org.apache.hadoop.hdds.protocol.scm.proto.InterSCMProtocolProtos.CopyDBCheckpointRequestProto) Arrays(java.util.Arrays) Logger(org.slf4j.Logger) TRANSACTION_INFO_KEY(org.apache.hadoop.ozone.OzoneConsts.TRANSACTION_INFO_KEY) InterSCMProtocolServiceGrpc(org.apache.hadoop.hdds.protocol.scm.proto.InterSCMProtocolServiceGrpc) LoggerFactory(org.slf4j.LoggerFactory) IOException(java.io.IOException) SCMDBDefinition(org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition) Table(org.apache.hadoop.hdds.utils.db.Table) Preconditions(com.google.common.base.Preconditions) StreamObserver(org.apache.ratis.thirdparty.io.grpc.stub.StreamObserver) CopyDBCheckpointResponseProto(org.apache.hadoop.hdds.protocol.scm.proto.InterSCMProtocolProtos.CopyDBCheckpointResponseProto) StorageContainerManager(org.apache.hadoop.hdds.scm.server.StorageContainerManager) SCMDBDefinition(org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition) TransactionInfo(org.apache.hadoop.hdds.utils.TransactionInfo) IOException(java.io.IOException)

Aggregations

Preconditions (com.google.common.base.Preconditions)1 IOException (java.io.IOException)1 Arrays (java.util.Arrays)1 CopyDBCheckpointRequestProto (org.apache.hadoop.hdds.protocol.scm.proto.InterSCMProtocolProtos.CopyDBCheckpointRequestProto)1 CopyDBCheckpointResponseProto (org.apache.hadoop.hdds.protocol.scm.proto.InterSCMProtocolProtos.CopyDBCheckpointResponseProto)1 InterSCMProtocolServiceGrpc (org.apache.hadoop.hdds.protocol.scm.proto.InterSCMProtocolServiceGrpc)1 SCMDBDefinition (org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition)1 StorageContainerManager (org.apache.hadoop.hdds.scm.server.StorageContainerManager)1 TransactionInfo (org.apache.hadoop.hdds.utils.TransactionInfo)1 Table (org.apache.hadoop.hdds.utils.db.Table)1 TRANSACTION_INFO_KEY (org.apache.hadoop.ozone.OzoneConsts.TRANSACTION_INFO_KEY)1 StreamObserver (org.apache.ratis.thirdparty.io.grpc.stub.StreamObserver)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1