use of org.apache.accumulo.core.conf.Property in project accumulo by apache.
the class FileUtilTest method testCleanupIndexOpWithCommonParentVolume.
@Test
public void testCleanupIndexOpWithCommonParentVolume() throws IOException {
File volumeDir = new File(accumuloDir, "volumes");
assertTrue(volumeDir.mkdirs() || volumeDir.isDirectory());
// Make some directories to simulate multiple volumes
File v1 = new File(volumeDir, "v1"), v2 = new File(volumeDir, "v2");
assertTrue(v1.mkdirs() || v1.isDirectory());
assertTrue(v2.mkdirs() || v2.isDirectory());
// And a "unique" tmp directory for each volume
File tmp1 = new File(v1, "tmp"), tmp2 = new File(v2, "tmp");
assertTrue(tmp1.mkdirs() || tmp1.isDirectory());
assertTrue(tmp2.mkdirs() || tmp2.isDirectory());
Path tmpPath1 = new Path(tmp1.toURI()), tmpPath2 = new Path(tmp2.toURI());
HashMap<Property, String> testProps = new HashMap<>();
testProps.put(Property.INSTANCE_VOLUMES, v1.toURI().toString() + "," + v2.toURI().toString());
VolumeManager fs = VolumeManagerImpl.getLocal(accumuloDir.getAbsolutePath());
FileUtil.cleanupIndexOp(tmpPath1, fs, new ArrayList<>());
Assert.assertFalse("Expected " + tmp1 + " to be cleaned up but it wasn't", tmp1.exists());
FileUtil.cleanupIndexOp(tmpPath2, fs, new ArrayList<>());
Assert.assertFalse("Expected " + tmp2 + " to be cleaned up but it wasn't", tmp2.exists());
}
use of org.apache.accumulo.core.conf.Property in project accumulo by apache.
the class FileUtilTest method testCleanupIndexOpWithDfsDir.
@Test
public void testCleanupIndexOpWithDfsDir() throws IOException {
// And a "unique" tmp directory for each volume
File tmp1 = new File(accumuloDir, "tmp");
assertTrue(tmp1.mkdirs() || tmp1.isDirectory());
Path tmpPath1 = new Path(tmp1.toURI());
HashMap<Property, String> testProps = new HashMap<>();
testProps.put(INSTANCE_DFS_DIR, accumuloDir.getAbsolutePath());
VolumeManager fs = VolumeManagerImpl.getLocal(accumuloDir.getAbsolutePath());
FileUtil.cleanupIndexOp(tmpPath1, fs, new ArrayList<>());
Assert.assertFalse("Expected " + tmp1 + " to be cleaned up but it wasn't", tmp1.exists());
}
use of org.apache.accumulo.core.conf.Property in project accumulo by apache.
the class ThriftServerBindsBeforeZooKeeperLockIT method startProcess.
private Process startProcess(MiniAccumuloClusterImpl cluster, ServerType serverType, int port) throws IOException {
final Property property;
final Class<?> service;
switch(serverType) {
case MONITOR:
property = Property.MONITOR_PORT;
service = Monitor.class;
break;
case MASTER:
property = Property.MASTER_CLIENTPORT;
service = Master.class;
break;
case GARBAGE_COLLECTOR:
property = Property.GC_PORT;
service = SimpleGarbageCollector.class;
break;
default:
throw new IllegalArgumentException("Irrelevant server type for test");
}
return cluster._exec(service, serverType, ImmutableMap.of(property.getKey(), Integer.toString(port)));
}
use of org.apache.accumulo.core.conf.Property in project accumulo by apache.
the class MiniAccumuloClusterTest method testRandomPorts.
@Test
public void testRandomPorts() throws Exception {
File confDir = new File(testDir, "conf");
File accumuloSite = new File(confDir, "accumulo-site.xml");
Configuration conf = new Configuration(false);
conf.addResource(accumuloSite.toURI().toURL());
for (Property randomPortProp : new Property[] { Property.TSERV_CLIENTPORT, Property.MONITOR_PORT, Property.MONITOR_LOG4J_PORT, Property.MASTER_CLIENTPORT, Property.TRACE_PORT, Property.GC_PORT }) {
String value = conf.get(randomPortProp.getKey());
Assert.assertNotNull("Found no value for " + randomPortProp, value);
Assert.assertEquals("0", value);
}
}
use of org.apache.accumulo.core.conf.Property in project accumulo by apache.
the class MiniAccumuloConfigImpl method initialize.
/**
* Set directories and fully populate site config
*/
MiniAccumuloConfigImpl initialize() {
// Sanity checks
if (this.getDir().exists() && !this.getDir().isDirectory())
throw new IllegalArgumentException("Must pass in directory, " + this.getDir() + " is a file");
if (this.getDir().exists()) {
String[] children = this.getDir().list();
if (children != null && children.length != 0) {
throw new IllegalArgumentException("Directory " + this.getDir() + " is not empty");
}
}
if (!initialized) {
libDir = new File(dir, "lib");
libExtDir = new File(libDir, "ext");
confDir = new File(dir, "conf");
accumuloDir = new File(dir, "accumulo");
zooKeeperDir = new File(dir, "zookeeper");
logDir = new File(dir, "logs");
// Never want to override these if an existing instance, which may be using the defaults
if (existingInstance == null || !existingInstance) {
existingInstance = false;
// TODO ACCUMULO-XXXX replace usage of instance.dfs.{dir,uri} with instance.volumes
setInstanceLocation();
mergeProp(Property.INSTANCE_SECRET.getKey(), DEFAULT_INSTANCE_SECRET);
mergeProp(Property.TRACE_TOKEN_PROPERTY_PREFIX.getKey() + "password", getRootPassword());
}
mergeProp(Property.TSERV_PORTSEARCH.getKey(), "true");
mergeProp(Property.TSERV_DATACACHE_SIZE.getKey(), "10M");
mergeProp(Property.TSERV_INDEXCACHE_SIZE.getKey(), "10M");
mergeProp(Property.TSERV_SUMMARYCACHE_SIZE.getKey(), "10M");
mergeProp(Property.TSERV_MAXMEM.getKey(), "40M");
mergeProp(Property.TSERV_WALOG_MAX_SIZE.getKey(), "100M");
mergeProp(Property.TSERV_NATIVEMAP_ENABLED.getKey(), "false");
// since there is a small amount of memory, check more frequently for majc... setting may not be needed in 1.5
mergeProp(Property.TSERV_MAJC_DELAY.getKey(), "3");
@SuppressWarnings("deprecation") Property generalClasspaths = Property.GENERAL_CLASSPATHS;
mergeProp(generalClasspaths.getKey(), libDir.getAbsolutePath() + "/[^.].*[.]jar");
mergeProp(Property.GENERAL_DYNAMIC_CLASSPATHS.getKey(), libExtDir.getAbsolutePath() + "/[^.].*[.]jar");
mergeProp(Property.GC_CYCLE_DELAY.getKey(), "4s");
mergeProp(Property.GC_CYCLE_START.getKey(), "0s");
mergePropWithRandomPort(Property.MASTER_CLIENTPORT.getKey());
mergePropWithRandomPort(Property.TRACE_PORT.getKey());
mergePropWithRandomPort(Property.TSERV_CLIENTPORT.getKey());
mergePropWithRandomPort(Property.MONITOR_PORT.getKey());
mergePropWithRandomPort(Property.GC_PORT.getKey());
mergePropWithRandomPort(Property.MONITOR_LOG4J_PORT.getKey());
mergePropWithRandomPort(Property.REPLICATION_RECEIPT_SERVICE_PORT.getKey());
mergePropWithRandomPort(Property.MASTER_REPLICATION_COORDINATOR_PORT.getKey());
if (isUseCredentialProvider()) {
updateConfigForCredentialProvider();
}
if (existingInstance == null || !existingInstance) {
existingInstance = false;
String zkHost;
if (useExistingZooKeepers()) {
zkHost = existingZooKeepers;
} else {
// zookeeper port should be set explicitly in this class, not just on the site config
if (zooKeeperPort == 0)
zooKeeperPort = PortUtils.getRandomFreePort();
zkHost = "localhost:" + zooKeeperPort;
}
siteConfig.put(Property.INSTANCE_ZK_HOST.getKey(), zkHost);
}
initialized = true;
}
return this;
}
Aggregations