Search in sources :

Example 11 with LiveTServerSet

use of org.apache.accumulo.server.manager.LiveTServerSet in project accumulo by apache.

the class GarbageCollectWriteAheadLogsTest method replicationDelaysFileCollection.

@Test
public void replicationDelaysFileCollection() throws Exception {
    ServerContext context = EasyMock.createMock(ServerContext.class);
    VolumeManager fs = EasyMock.createMock(VolumeManager.class);
    WalStateManager marker = EasyMock.createMock(WalStateManager.class);
    LiveTServerSet tserverSet = EasyMock.createMock(LiveTServerSet.class);
    Scanner mscanner = EasyMock.createMock(Scanner.class);
    Scanner rscanner = EasyMock.createMock(Scanner.class);
    String row = ReplicationSection.getRowPrefix() + path;
    String colf = ReplicationSection.COLF.toString();
    String colq = "1";
    Map<Key, Value> replicationWork = Collections.singletonMap(new Key(row, colf, colq), new Value());
    GCStatus status = new GCStatus(null, null, null, new GcCycleStats());
    tserverSet.scanServers();
    EasyMock.expectLastCall();
    EasyMock.expect(tserverSet.getCurrentServers()).andReturn(Collections.singleton(server1));
    EasyMock.expect(marker.getAllMarkers()).andReturn(markers).once();
    EasyMock.expect(marker.state(server1, id)).andReturn(new Pair<>(WalState.UNREFERENCED, path));
    EasyMock.expect(context.createScanner(REPL_TABLE_NAME, Authorizations.EMPTY)).andReturn(rscanner);
    rscanner.fetchColumnFamily(STATUS_SECTION_NAME);
    EasyMock.expectLastCall().once();
    EasyMock.expect(rscanner.iterator()).andReturn(emptyKV);
    EasyMock.expect(context.createScanner(MetadataTable.NAME, Authorizations.EMPTY)).andReturn(mscanner);
    mscanner.fetchColumnFamily(ReplicationSection.COLF);
    EasyMock.expectLastCall().once();
    mscanner.setRange(ReplicationSection.getRange());
    EasyMock.expectLastCall().once();
    EasyMock.expect(mscanner.iterator()).andReturn(replicationWork.entrySet().iterator());
    EasyMock.replay(context, fs, marker, tserverSet, rscanner, mscanner);
    GarbageCollectWriteAheadLogs gc = new GarbageCollectWriteAheadLogs(context, fs, false, tserverSet, marker, tabletOnServer1List) {

        @Override
        protected Map<UUID, Path> getSortedWALogs() {
            return Collections.emptyMap();
        }
    };
    gc.collect(status);
    EasyMock.verify(context, fs, marker, tserverSet, rscanner, mscanner);
}
Also used : Path(org.apache.hadoop.fs.Path) VolumeManager(org.apache.accumulo.server.fs.VolumeManager) Scanner(org.apache.accumulo.core.client.Scanner) GcCycleStats(org.apache.accumulo.core.gc.thrift.GcCycleStats) GCStatus(org.apache.accumulo.core.gc.thrift.GCStatus) LiveTServerSet(org.apache.accumulo.server.manager.LiveTServerSet) ServerContext(org.apache.accumulo.server.ServerContext) WalStateManager(org.apache.accumulo.server.log.WalStateManager) Value(org.apache.accumulo.core.data.Value) UUID(java.util.UUID) Key(org.apache.accumulo.core.data.Key) Test(org.junit.Test)

Example 12 with LiveTServerSet

use of org.apache.accumulo.server.manager.LiveTServerSet in project accumulo by apache.

the class GarbageCollectWriteAheadLogsTest method ignoreReferenceLogOnDeadServer.

@Test
public void ignoreReferenceLogOnDeadServer() throws Exception {
    ServerContext context = EasyMock.createMock(ServerContext.class);
    VolumeManager fs = EasyMock.createMock(VolumeManager.class);
    WalStateManager marker = EasyMock.createMock(WalStateManager.class);
    LiveTServerSet tserverSet = EasyMock.createMock(LiveTServerSet.class);
    Scanner mscanner = EasyMock.createMock(Scanner.class);
    Scanner rscanner = EasyMock.createMock(Scanner.class);
    GCStatus status = new GCStatus(null, null, null, new GcCycleStats());
    tserverSet.scanServers();
    EasyMock.expectLastCall();
    EasyMock.expect(tserverSet.getCurrentServers()).andReturn(Collections.singleton(server1));
    EasyMock.expect(marker.getAllMarkers()).andReturn(markers2).once();
    EasyMock.expect(marker.state(server2, id)).andReturn(new Pair<>(WalState.OPEN, path));
    EasyMock.expect(context.createScanner(REPL_TABLE_NAME, Authorizations.EMPTY)).andReturn(rscanner);
    rscanner.fetchColumnFamily(STATUS_SECTION_NAME);
    EasyMock.expectLastCall().once();
    EasyMock.expect(rscanner.iterator()).andReturn(emptyKV);
    EasyMock.expect(context.createScanner(MetadataTable.NAME, Authorizations.EMPTY)).andReturn(mscanner);
    mscanner.fetchColumnFamily(ReplicationSection.COLF);
    EasyMock.expectLastCall().once();
    mscanner.setRange(ReplicationSection.getRange());
    EasyMock.expectLastCall().once();
    EasyMock.expect(mscanner.iterator()).andReturn(emptyKV);
    EasyMock.replay(context, fs, marker, tserverSet, rscanner, mscanner);
    GarbageCollectWriteAheadLogs gc = new GarbageCollectWriteAheadLogs(context, fs, false, tserverSet, marker, tabletOnServer2List) {

        @Override
        protected Map<UUID, Path> getSortedWALogs() {
            return Collections.emptyMap();
        }
    };
    gc.collect(status);
    EasyMock.verify(context, fs, marker, tserverSet, rscanner, mscanner);
}
Also used : Path(org.apache.hadoop.fs.Path) VolumeManager(org.apache.accumulo.server.fs.VolumeManager) Scanner(org.apache.accumulo.core.client.Scanner) ServerContext(org.apache.accumulo.server.ServerContext) WalStateManager(org.apache.accumulo.server.log.WalStateManager) GcCycleStats(org.apache.accumulo.core.gc.thrift.GcCycleStats) GCStatus(org.apache.accumulo.core.gc.thrift.GCStatus) UUID(java.util.UUID) LiveTServerSet(org.apache.accumulo.server.manager.LiveTServerSet) Test(org.junit.Test)

Example 13 with LiveTServerSet

use of org.apache.accumulo.server.manager.LiveTServerSet in project accumulo by apache.

the class GarbageCollectWriteAheadLogsTest method testKeepClosedLog.

@Test
public void testKeepClosedLog() throws Exception {
    ServerContext context = EasyMock.createMock(ServerContext.class);
    VolumeManager fs = EasyMock.createMock(VolumeManager.class);
    WalStateManager marker = EasyMock.createMock(WalStateManager.class);
    LiveTServerSet tserverSet = EasyMock.createMock(LiveTServerSet.class);
    GCStatus status = new GCStatus(null, null, null, new GcCycleStats());
    tserverSet.scanServers();
    EasyMock.expectLastCall();
    EasyMock.expect(tserverSet.getCurrentServers()).andReturn(Collections.singleton(server1));
    EasyMock.expect(marker.getAllMarkers()).andReturn(markers).once();
    EasyMock.expect(marker.state(server1, id)).andReturn(new Pair<>(WalState.CLOSED, path));
    EasyMock.replay(context, marker, tserverSet, fs);
    GarbageCollectWriteAheadLogs gc = new GarbageCollectWriteAheadLogs(context, fs, false, tserverSet, marker, tabletOnServer1List) {

        @Override
        @Deprecated
        protected int removeReplicationEntries(Map<UUID, TServerInstance> candidates) {
            return 0;
        }

        @Override
        protected Map<UUID, Path> getSortedWALogs() {
            return Collections.emptyMap();
        }
    };
    gc.collect(status);
    EasyMock.verify(context, marker, tserverSet, fs);
}
Also used : Path(org.apache.hadoop.fs.Path) VolumeManager(org.apache.accumulo.server.fs.VolumeManager) ServerContext(org.apache.accumulo.server.ServerContext) WalStateManager(org.apache.accumulo.server.log.WalStateManager) GcCycleStats(org.apache.accumulo.core.gc.thrift.GcCycleStats) GCStatus(org.apache.accumulo.core.gc.thrift.GCStatus) UUID(java.util.UUID) Map(java.util.Map) LiveTServerSet(org.apache.accumulo.server.manager.LiveTServerSet) Test(org.junit.Test)

Aggregations

LiveTServerSet (org.apache.accumulo.server.manager.LiveTServerSet)13 ServerContext (org.apache.accumulo.server.ServerContext)11 Test (org.junit.Test)11 HostAndPort (org.apache.accumulo.core.util.HostAndPort)7 AccumuloConfiguration (org.apache.accumulo.core.conf.AccumuloConfiguration)6 GcCycleStats (org.apache.accumulo.core.gc.thrift.GcCycleStats)6 TServerInstance (org.apache.accumulo.core.metadata.TServerInstance)6 TabletClientService (org.apache.accumulo.core.tabletserver.thrift.TabletClientService)6 Client (org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client)6 AbstractServer (org.apache.accumulo.server.AbstractServer)6 VolumeManager (org.apache.accumulo.server.fs.VolumeManager)6 ServerAddress (org.apache.accumulo.server.rpc.ServerAddress)6 AuditedSecurityOperation (org.apache.accumulo.server.security.AuditedSecurityOperation)6 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)6 ArrayList (java.util.ArrayList)5 UUID (java.util.UUID)5 GCStatus (org.apache.accumulo.core.gc.thrift.GCStatus)5 ThriftUtil (org.apache.accumulo.core.rpc.ThriftUtil)5 TCredentials (org.apache.accumulo.core.securityImpl.thrift.TCredentials)5 RunningCompaction (org.apache.accumulo.core.util.compaction.RunningCompaction)5