Search in sources :

Example 1 with GetLastFlushedSequenceIdRequest

use of org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.GetLastFlushedSequenceIdRequest in project hbase by apache.

the class TestWALFiltering method testFlushedSequenceIdsSentToHMaster.

@Test
public void testFlushedSequenceIdsSentToHMaster() throws IOException, InterruptedException, org.apache.hbase.thirdparty.com.google.protobuf.ServiceException, ServiceException {
    SortedMap<byte[], Long> allFlushedSequenceIds = new TreeMap<>(Bytes.BYTES_COMPARATOR);
    for (int i = 0; i < NUM_RS; ++i) {
        flushAllRegions(i);
    }
    Thread.sleep(10000);
    HMaster master = TEST_UTIL.getMiniHBaseCluster().getMaster();
    for (int i = 0; i < NUM_RS; ++i) {
        for (byte[] regionName : getRegionsByServer(i)) {
            if (allFlushedSequenceIds.containsKey(regionName)) {
                GetLastFlushedSequenceIdRequest req = RequestConverter.buildGetLastFlushedSequenceIdRequest(regionName);
                assertEquals((long) allFlushedSequenceIds.get(regionName), master.getMasterRpcServices().getLastFlushedSequenceId(null, req).getLastFlushedSequenceId());
            }
        }
    }
}
Also used : HMaster(org.apache.hadoop.hbase.master.HMaster) GetLastFlushedSequenceIdRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.GetLastFlushedSequenceIdRequest) TreeMap(java.util.TreeMap) Test(org.junit.Test)

Example 2 with GetLastFlushedSequenceIdRequest

use of org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.GetLastFlushedSequenceIdRequest in project hbase by apache.

the class HRegionServer method getLastSequenceId.

@Override
public RegionStoreSequenceIds getLastSequenceId(byte[] encodedRegionName) {
    try {
        GetLastFlushedSequenceIdRequest req = RequestConverter.buildGetLastFlushedSequenceIdRequest(encodedRegionName);
        RegionServerStatusService.BlockingInterface rss = rssStub;
        if (rss == null) {
            // Try to connect one more time
            createRegionServerStatusStub();
            rss = rssStub;
            if (rss == null) {
                // Still no luck, we tried
                LOG.warn("Unable to connect to the master to check " + "the last flushed sequence id");
                return RegionStoreSequenceIds.newBuilder().setLastFlushedSequenceId(HConstants.NO_SEQNUM).build();
            }
        }
        GetLastFlushedSequenceIdResponse resp = rss.getLastFlushedSequenceId(null, req);
        return RegionStoreSequenceIds.newBuilder().setLastFlushedSequenceId(resp.getLastFlushedSequenceId()).addAllStoreSequenceId(resp.getStoreLastFlushedSequenceIdList()).build();
    } catch (ServiceException e) {
        LOG.warn("Unable to connect to the master to check the last flushed sequence id", e);
        return RegionStoreSequenceIds.newBuilder().setLastFlushedSequenceId(HConstants.NO_SEQNUM).build();
    }
}
Also used : ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) GetLastFlushedSequenceIdResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.GetLastFlushedSequenceIdResponse) RegionServerStatusService(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionServerStatusService) GetLastFlushedSequenceIdRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.GetLastFlushedSequenceIdRequest)

Aggregations

GetLastFlushedSequenceIdRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.GetLastFlushedSequenceIdRequest)2 TreeMap (java.util.TreeMap)1 HMaster (org.apache.hadoop.hbase.master.HMaster)1 GetLastFlushedSequenceIdResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.GetLastFlushedSequenceIdResponse)1 RegionServerStatusService (org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionServerStatusService)1 ServiceException (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException)1 Test (org.junit.Test)1