use of org.apache.accumulo.core.volume.VolumeImpl in project accumulo by apache.
the class VolumeManagerImpl method getLocalForTesting.
// for testing only
public static VolumeManager getLocalForTesting(String localBasePath) throws IOException {
AccumuloConfiguration accConf = DefaultConfiguration.getInstance();
Configuration hadoopConf = new Configuration();
FileSystem localFS = FileSystem.getLocal(hadoopConf);
Volume defaultLocalVolume = new VolumeImpl(localFS, localBasePath);
return new VolumeManagerImpl(Collections.singletonMap("", defaultLocalVolume), accConf, hadoopConf);
}
use of org.apache.accumulo.core.volume.VolumeImpl in project accumulo by apache.
the class TabletServerSyncCheckTest method testFailureOnExplicitAppendFalseConf.
@Test
public void testFailureOnExplicitAppendFalseConf() {
Configuration conf = new Configuration();
conf.set(DFS_SUPPORT_APPEND, "false");
FileSystem fs = new TestFileSystem(conf);
assertThrows(RuntimeException.class, () -> new TestVolumeManagerImpl(Map.of("foo", new VolumeImpl(fs, "/"))));
}
use of org.apache.accumulo.core.volume.VolumeImpl in project accumulo by apache.
the class VolumeManagerImpl method get.
public static VolumeManager get(AccumuloConfiguration conf, final Configuration hadoopConf) throws IOException {
final Map<String, Volume> volumes = new HashMap<>();
Set<String> volumeStrings = VolumeConfiguration.getVolumeUris(conf);
// The "default" Volume for Accumulo (in case no volumes are specified)
for (String volumeUriOrDir : volumeStrings) {
if (volumeUriOrDir.isBlank())
throw new IllegalArgumentException("Empty volume specified in configuration");
if (volumeUriOrDir.startsWith("viewfs"))
throw new IllegalArgumentException("Cannot use viewfs as a volume");
// We require a URI here, fail if it doesn't look like one
if (volumeUriOrDir.contains(":")) {
volumes.put(volumeUriOrDir, new VolumeImpl(new Path(volumeUriOrDir), hadoopConf));
} else {
throw new IllegalArgumentException("Expected fully qualified URI for " + Property.INSTANCE_VOLUMES.getKey() + " got " + volumeUriOrDir);
}
}
return new VolumeManagerImpl(volumes, conf, hadoopConf);
}
use of org.apache.accumulo.core.volume.VolumeImpl in project accumulo by apache.
the class Upgrader9to10Test method testDropSortedMapWALs.
@Test
public void testDropSortedMapWALs() throws IOException {
Configuration hadoopConf = new Configuration();
ConfigurationCopy conf = new ConfigurationCopy();
FileSystem fs = new Path("file:///").getFileSystem(hadoopConf);
List<String> volumes = Arrays.asList("/vol1/", "/vol2/");
Collection<Volume> vols = volumes.stream().map(s -> new VolumeImpl(fs, s)).collect(Collectors.toList());
Set<String> fullyQualifiedVols = Set.of("file://vol1/", "file://vol2/");
Set<String> recoveryDirs = Set.of("file://vol1/accumulo/recovery", "file://vol2/accumulo/recovery");
conf.set(Property.INSTANCE_VOLUMES, String.join(",", fullyQualifiedVols));
ServerContext context = createMock(ServerContext.class);
Path recoveryDir1 = new Path("file://vol1/accumulo/recovery");
Path recoveryDir2 = new Path("file://vol2/accumulo/recovery");
VolumeManager volumeManager = createMock(VolumeManager.class);
FileStatus[] dirs = new FileStatus[2];
dirs[0] = createMock(FileStatus.class);
Path dir0 = new Path("file://vol1/accumulo/recovery/A123456789");
FileStatus[] dir0Files = new FileStatus[1];
dir0Files[0] = createMock(FileStatus.class);
dirs[1] = createMock(FileStatus.class);
Path dir1 = new Path("file://vol1/accumulo/recovery/B123456789");
FileStatus[] dir1Files = new FileStatus[1];
dir1Files[0] = createMock(FileStatus.class);
Path part1Dir = new Path("file://vol1/accumulo/recovery/B123456789/part-r-0000");
expect(context.getVolumeManager()).andReturn(volumeManager).once();
expect(context.getConfiguration()).andReturn(conf).once();
expect(context.getHadoopConf()).andReturn(hadoopConf).once();
expect(context.getRecoveryDirs()).andReturn(recoveryDirs).once();
expect(volumeManager.getVolumes()).andReturn(vols).once();
expect(volumeManager.exists(recoveryDir1)).andReturn(true).once();
expect(volumeManager.exists(recoveryDir2)).andReturn(false).once();
expect(volumeManager.listStatus(recoveryDir1)).andReturn(dirs).once();
expect(dirs[0].getPath()).andReturn(dir0).once();
expect(volumeManager.listStatus(dir0)).andReturn(dir0Files).once();
expect(dir0Files[0].isDirectory()).andReturn(false).once();
expect(dirs[1].getPath()).andReturn(dir1).once();
expect(volumeManager.listStatus(dir1)).andReturn(dir1Files).once();
expect(dir1Files[0].isDirectory()).andReturn(true).once();
expect(dir1Files[0].getPath()).andReturn(part1Dir).once();
expect(volumeManager.deleteRecursively(dir1)).andReturn(true).once();
replay(context, volumeManager, dirs[0], dirs[1], dir0Files[0], dir1Files[0]);
Upgrader9to10.dropSortedMapWALFiles(context);
}
Aggregations