You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2014/02/25 18:26:22 UTC
[1/2] git commit: ACCUMULO-2401 finish removing hacky
site-configuration manipulation
Repository: accumulo
Updated Branches:
refs/heads/1.6.0-SNAPSHOT 2ef2d8859 -> 840dba269
ACCUMULO-2401 finish removing hacky site-configuration manipulation
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/840dba26
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/840dba26
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/840dba26
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 840dba269266e4895a12ca2074d36e356076e656
Parents: f2de427
Author: Eric Newton <er...@gmail.com>
Authored: Tue Feb 25 12:17:46 2014 -0500
Committer: Eric Newton <er...@gmail.com>
Committed: Tue Feb 25 12:25:30 2014 -0500
----------------------------------------------------------------------
.../accumulo/core/file/rfile/RFileTest.java | 241 +++++++------------
.../iterators/user/IndexedDocIteratorTest.java | 3 +-
core/src/test/resources/log4j.properties | 2 +-
3 files changed, 85 insertions(+), 161 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/840dba26/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
index fb9658c..ccbefb2 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
@@ -33,12 +33,13 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Map.Entry;
import java.util.Random;
import java.util.Set;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.SiteConfiguration;
+import org.apache.accumulo.core.conf.ConfigurationCopy;
import org.apache.accumulo.core.data.ArrayByteSequence;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
@@ -171,14 +172,21 @@ public class RFileTest {
private FSDataOutputStream dos;
private SeekableByteArrayInputStream bais;
private FSDataInputStream in;
+ private AccumuloConfiguration accumuloConfiguration;
public Reader reader;
public SortedKeyValueIterator<Key,Value> iter;
+
+ public TestRFile(AccumuloConfiguration accumuloConfiguration) {
+ this.accumuloConfiguration = accumuloConfiguration;
+ if (this.accumuloConfiguration == null)
+ this.accumuloConfiguration = AccumuloConfiguration.getDefaultConfiguration();
+ }
public void openWriter(boolean startDLG) throws IOException {
baos = new ByteArrayOutputStream();
dos = new FSDataOutputStream(baos, new FileSystem.Statistics("a"));
- CachableBlockFile.Writer _cbw = new CachableBlockFile.Writer(dos, "gz", conf, AccumuloConfiguration.getDefaultConfiguration());
+ CachableBlockFile.Writer _cbw = new CachableBlockFile.Writer(dos, "gz", conf, accumuloConfiguration);
writer = new RFile.Writer(_cbw, 1000, 1000);
if (startDLG)
@@ -239,13 +247,15 @@ public class RFileTest {
static String nf(String prefix, int i) {
return String.format(prefix + "%06d", i);
}
+
+ public AccumuloConfiguration conf = null;
@Test
public void test1() throws IOException {
// test an empty file
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter();
trf.closeWriter();
@@ -264,7 +274,7 @@ public class RFileTest {
// test an rfile with one entry
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter();
trf.writer.append(nk("r1", "cf1", "cq1", "L1", 55), nv("foo"));
@@ -301,7 +311,7 @@ public class RFileTest {
// test an rfile with multiple rows having multiple columns
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter();
@@ -456,7 +466,7 @@ public class RFileTest {
@Test
public void test4() throws IOException {
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter();
@@ -500,7 +510,7 @@ public class RFileTest {
@Test
public void test5() throws IOException {
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter();
trf.writer.append(nk("r1", "cf1", "cq1", "L1", 55), nv("foo1"));
@@ -529,7 +539,7 @@ public class RFileTest {
@Test
public void test6() throws IOException {
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter();
for (int i = 0; i < 500; i++) {
@@ -563,7 +573,7 @@ public class RFileTest {
public void test7() throws IOException {
// these tests exercise setting the end key of a range
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter();
for (int i = 2; i < 50; i++) {
@@ -613,7 +623,7 @@ public class RFileTest {
@Test
public void test8() throws IOException {
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter();
@@ -648,7 +658,7 @@ public class RFileTest {
trf.closeReader();
// do same test with col fam
- trf = new TestRFile();
+ trf = new TestRFile(conf);
trf.openWriter();
@@ -683,7 +693,7 @@ public class RFileTest {
trf.closeReader();
// do same test with col qual
- trf = new TestRFile();
+ trf = new TestRFile(conf);
trf.openWriter();
@@ -730,7 +740,7 @@ public class RFileTest {
@Test
public void test9() throws IOException {
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter(false);
@@ -874,7 +884,7 @@ public class RFileTest {
public void test10() throws IOException {
// test empty locality groups
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter(false);
trf.writer.startNewLocalityGroup("lg1", ncfs("cf1", "cf2"));
@@ -889,7 +899,7 @@ public class RFileTest {
trf.closeReader();
// another empty locality group test
- trf = new TestRFile();
+ trf = new TestRFile(conf);
trf.openWriter(false);
trf.writer.startNewLocalityGroup("lg1", ncfs("cf1", "cf2"));
@@ -914,7 +924,7 @@ public class RFileTest {
trf.closeReader();
// another empty locality group test
- trf = new TestRFile();
+ trf = new TestRFile(conf);
trf.openWriter(false);
trf.writer.startNewLocalityGroup("lg1", ncfs("cf1", "cf2"));
@@ -939,7 +949,7 @@ public class RFileTest {
trf.closeReader();
// another empty locality group test
- trf = new TestRFile();
+ trf = new TestRFile(conf);
trf.openWriter(false);
trf.writer.startNewLocalityGroup("lg1", ncfs("cf1", "cf2"));
@@ -964,7 +974,7 @@ public class RFileTest {
trf.closeReader();
// another empty locality group test
- trf = new TestRFile();
+ trf = new TestRFile(conf);
trf.openWriter(false);
trf.writer.startNewLocalityGroup("lg1", ncfs("cf1", "cf2"));
@@ -1003,7 +1013,7 @@ public class RFileTest {
public void test11() throws IOException {
// test locality groups with more than two entries
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter(false);
trf.writer.startNewLocalityGroup("lg1", ncfs("3mod10"));
@@ -1108,7 +1118,7 @@ public class RFileTest {
public void test12() throws IOException {
// test inserting column fams not in locality groups
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter(false);
@@ -1141,7 +1151,7 @@ public class RFileTest {
// test inserting column fam in default loc group that was in
// previous locality group
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter(false);
@@ -1182,7 +1192,7 @@ public class RFileTest {
public void test14() throws IOException {
// test starting locality group after default locality group was started
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter(false);
@@ -1206,7 +1216,7 @@ public class RFileTest {
@Test
public void test16() throws IOException {
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter(false);
@@ -1229,7 +1239,7 @@ public class RFileTest {
// this should cause the keys in the index to be exactly the same...
// ensure seeks work correctly
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter(false);
@@ -1366,7 +1376,7 @@ public class RFileTest {
public void test18() throws IOException {
// test writing more column families to default LG than it will track
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter(false);
@@ -1417,7 +1427,7 @@ public class RFileTest {
@Test
public void test19() throws IOException {
// test RFile metastore
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter(false);
@@ -1469,7 +1479,7 @@ public class RFileTest {
@Test
public void testReseekUnconsumed() throws Exception {
- TestRFile trf = new TestRFile();
+ TestRFile trf = new TestRFile(conf);
trf.openWriter();
@@ -1546,8 +1556,7 @@ public class RFileTest {
byte data[] = baos.toByteArray();
SeekableByteArrayInputStream bais = new SeekableByteArrayInputStream(data);
FSDataInputStream in2 = new FSDataInputStream(bais);
- @SuppressWarnings("deprecation")
- AccumuloConfiguration aconf = AccumuloConfiguration.getSiteConfiguration();
+ AccumuloConfiguration aconf = AccumuloConfiguration.getDefaultConfiguration();
CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader(in2, data.length, CachedConfiguration.getInstance(), aconf);
Reader reader = new RFile.Reader(_cbr);
checkIndex(reader);
@@ -1592,210 +1601,141 @@ public class RFileTest {
}
private AccumuloConfiguration setAndGetAccumuloConfig(String cryptoConfSetting) {
- @SuppressWarnings("deprecation")
- AccumuloConfiguration conf = AccumuloConfiguration.getSiteConfiguration();
- System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, cryptoConfSetting);
- ((SiteConfiguration) conf).clearAndNull();
- return conf;
- }
-
- private void restoreOldConfiguration(String oldSiteConfigProperty, AccumuloConfiguration conf) {
- if (oldSiteConfigProperty != null) {
- System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, oldSiteConfigProperty);
- } else {
- System.clearProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
+ ConfigurationCopy result = new ConfigurationCopy(AccumuloConfiguration.getDefaultConfiguration());
+ Configuration conf = new Configuration(false);
+ conf.addResource(cryptoConfSetting);
+ for (Entry<String,String> e : conf) {
+ result.set(e.getKey(), e.getValue());
}
- ((SiteConfiguration) conf).clearAndNull();
+ return result;
}
@Test
public void testEncRFile1() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test1();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile2() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test2();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile3() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test3();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile4() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test4();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile5() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test5();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile6() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test6();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile7() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test7();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile8() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test8();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile9() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test9();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile10() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test10();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile11() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test11();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile12() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
test12();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile13() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test13();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile14() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test14();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile16() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test16();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
}
@Test
public void testEncRFile17() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test17();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
}
@Test
public void testEncRFile18() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test18();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncRFile19() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test19();
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
+ conf = null;
}
@Test
public void testEncryptedRFiles() throws Exception {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- @SuppressWarnings("deprecation")
- AccumuloConfiguration conf = AccumuloConfiguration.getSiteConfiguration();
- System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, CryptoTest.CRYPTO_ON_CONF);
- ((SiteConfiguration) conf).clearAndNull();
-
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test1();
test2();
test3();
@@ -1804,25 +1744,14 @@ public class RFileTest {
test6();
test7();
test8();
-
- if (oldSiteConfigProperty != null) {
- System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, oldSiteConfigProperty);
- } else {
- System.clearProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- }
- ((SiteConfiguration) conf).clearAndNull();
+ conf = null;
}
@Test
public void testRootTabletEncryption() throws Exception {
// This tests that the normal set of operations used to populate a root tablet
-
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- @SuppressWarnings("deprecation")
- AccumuloConfiguration conf = AccumuloConfiguration.getSiteConfiguration();
- System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, CryptoTest.CRYPTO_ON_CONF);
- ((SiteConfiguration) conf).clearAndNull();
+ conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
// populate the root tablet with info about the default tablet
// the root tablet contains the key extent and locations of all the
@@ -1831,7 +1760,7 @@ public class RFileTest {
// + FileOperations.getNewFileExtension(AccumuloConfiguration.getDefaultConfiguration());
// FileSKVWriter mfw = FileOperations.getInstance().openWriter(initRootTabFile, fs, conf, AccumuloConfiguration.getDefaultConfiguration());
- TestRFile testRfile = new TestRFile();
+ TestRFile testRfile = new TestRFile(conf);
testRfile.openWriter();
RFile.Writer mfw = testRfile.writer;
@@ -1892,12 +1821,6 @@ public class RFileTest {
testRfile.closeReader();
- if (oldSiteConfigProperty != null) {
- System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, oldSiteConfigProperty);
- } else {
- System.clearProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
- }
- ((SiteConfiguration) conf).clearAndNull();
-
+ conf = null;
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/840dba26/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
index 7a82249..ac0ab6b 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
@@ -27,6 +27,7 @@ import java.util.TreeMap;
import junit.framework.TestCase;
import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
@@ -131,7 +132,7 @@ public class IndexedDocIteratorTest extends TestCase {
return map;
}
- static TestRFile trf = new TestRFile();
+ static TestRFile trf = new TestRFile(AccumuloConfiguration.getDefaultConfiguration());
private SortedKeyValueIterator<Key,Value> createIteratorStack(float hitRatio, int numRows, int numDocsPerRow, Text[] columnFamilies,
Text[] otherColumnFamilies, HashSet<Text> docs) throws IOException {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/840dba26/core/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/core/src/test/resources/log4j.properties b/core/src/test/resources/log4j.properties
index cf5c2f0..dfc93bf 100644
--- a/core/src/test/resources/log4j.properties
+++ b/core/src/test/resources/log4j.properties
@@ -16,7 +16,7 @@
log4j.rootLogger=INFO, CA
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
-log4j.appender.CA.layout.ConversionPattern=[%t} %-5p %c %x - %m%n
+log4j.appender.CA.layout.ConversionPattern=[%t] %-5p %c %x - %m%n
log4j.logger.org.apache.accumulo.core.iterators.system.VisibilityFilter=FATAL
log4j.logger.org.apache.accumulo.core.iterators.user.TransformingIteratorTest$IllegalVisCompactionKeyTransformingIterator=FATAL
[2/2] git commit: ACCUMULO-2401 removed many calls to deprecated
AccumuloConfiguration.getSiteConfiguration() fixed hacky crypto tests that
messed with the site configuration
Posted by ec...@apache.org.
ACCUMULO-2401
removed many calls to deprecated AccumuloConfiguration.getSiteConfiguration()
fixed hacky crypto tests that messed with the site configuration
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/f2de427f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/f2de427f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/f2de427f
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: f2de427f74a8a6ffa05c6209e7161e7349458241
Parents: 2ef2d88
Author: Eric Newton <er...@gmail.com>
Authored: Tue Feb 25 11:18:34 2014 -0500
Committer: Eric Newton <er...@gmail.com>
Committed: Tue Feb 25 12:25:30 2014 -0500
----------------------------------------------------------------------
.../apache/accumulo/core/cli/ClientOpts.java | 2 +-
.../core/conf/DefaultConfiguration.java | 2 +-
.../file/blockfile/impl/CachableBlockFile.java | 45 +++++----
.../accumulo/core/file/rfile/PrintInfo.java | 5 +-
.../core/file/rfile/RFileOperations.java | 6 +-
.../accumulo/core/file/rfile/SplitLarge.java | 10 +-
.../accumulo/core/file/rfile/bcfile/BCFile.java | 15 +--
.../core/file/rfile/bcfile/PrintInfo.java | 9 +-
.../accumulo/core/security/SecurityUtil.java | 4 +-
.../apache/accumulo/core/util/shell/Shell.java | 2 +-
.../apache/accumulo/core/zookeeper/ZooUtil.java | 5 +-
.../mapred/AccumuloFileOutputFormatTest.java | 3 +
.../apache/accumulo/core/conf/PropertyTest.java | 2 +-
.../core/file/rfile/CreateCompatTestFile.java | 3 +-
.../core/file/rfile/MultiLevelIndexTest.java | 6 +-
.../accumulo/core/file/rfile/RFileTest.java | 8 +-
.../core/security/crypto/CryptoTest.java | 100 ++++++-------------
.../core/util/shell/ShellSetInstanceTest.java | 2 +-
.../apache/accumulo/server/ServerConstants.java | 2 +-
.../accumulo/server/client/HdfsZooInstance.java | 2 +-
.../accumulo/server/conf/ZooConfiguration.java | 2 +-
.../apache/accumulo/server/init/Initialize.java | 7 +-
.../accumulo/gc/SimpleGarbageCollector.java | 2 +-
.../java/org/apache/accumulo/master/Master.java | 2 +-
.../accumulo/master/state/SetGoalState.java | 3 +-
.../org/apache/accumulo/monitor/Monitor.java | 2 +-
.../org/apache/accumulo/tracer/TraceServer.java | 2 +-
.../apache/accumulo/tserver/TabletServer.java | 4 +-
.../accumulo/tserver/logger/LogReader.java | 5 +-
.../tserver/log/TestUpgradePathForWALogs.java | 8 +-
.../test/randomwalk/concurrent/BulkImport.java | 4 +-
31 files changed, 118 insertions(+), 156 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java b/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
index ca126e3..7573f69 100644
--- a/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
+++ b/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
@@ -258,7 +258,7 @@ public class ClientOpts extends Help {
};
this.zookeepers = config.get(Property.INSTANCE_ZK_HOST);
Path instanceDir = new Path(config.get(Property.INSTANCE_DFS_DIR), "instance_id");
- String instanceIDFromFile = ZooUtil.getInstanceIDFromHdfs(instanceDir);
+ String instanceIDFromFile = ZooUtil.getInstanceIDFromHdfs(instanceDir, config);
if (config.getBoolean(Property.INSTANCE_RPC_SSL_ENABLED))
clientConfig.setProperty(ClientProperty.INSTANCE_RPC_SSL_ENABLED, "true");
return cachedClientConfig = clientConfig.withInstance(UUID.fromString(instanceIDFromFile)).withZkHosts(zookeepers);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java b/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
index 6162bc5..cfd2f35 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
@@ -53,7 +53,7 @@ public class DefaultConfiguration extends AccumuloConfiguration {
// the following loop is super slow, it takes a few milliseconds, so cache it
resolvedProps = new HashMap<String,String>();
for (Property prop : Property.values())
- if (!prop.isExperimental() && !prop.getType().equals(PropertyType.PREFIX))
+ if (!prop.getType().equals(PropertyType.PREFIX))
resolvedProps.put(prop.getKey(), prop.getDefaultValue());
}
return resolvedProps;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/main/java/org/apache/accumulo/core/file/blockfile/impl/CachableBlockFile.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/impl/CachableBlockFile.java b/core/src/main/java/org/apache/accumulo/core/file/blockfile/impl/CachableBlockFile.java
index 5e46215..095a218 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/impl/CachableBlockFile.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/impl/CachableBlockFile.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.SoftReference;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.file.blockfile.ABlockReader;
import org.apache.accumulo.core.file.blockfile.ABlockWriter;
import org.apache.accumulo.core.file.blockfile.BlockFileReader;
@@ -55,18 +56,18 @@ public class CachableBlockFile {
private BlockWrite _bw;
private FSDataOutputStream fsout = null;
- public Writer(FileSystem fs, Path fName, String compressAlgor, Configuration conf) throws IOException {
+ public Writer(FileSystem fs, Path fName, String compressAlgor, Configuration conf, AccumuloConfiguration accumuloConfiguration) throws IOException {
this.fsout = fs.create(fName);
- init(fsout, compressAlgor, conf);
+ init(fsout, compressAlgor, conf, accumuloConfiguration);
}
- public Writer(FSDataOutputStream fsout, String compressAlgor, Configuration conf) throws IOException {
+ public Writer(FSDataOutputStream fsout, String compressAlgor, Configuration conf, AccumuloConfiguration accumuloConfiguration) throws IOException {
this.fsout = fsout;
- init(fsout, compressAlgor, conf);
+ init(fsout, compressAlgor, conf, accumuloConfiguration);
}
- private void init(FSDataOutputStream fsout, String compressAlgor, Configuration conf) throws IOException {
- _bc = new BCFile.Writer(fsout, compressAlgor, conf, false);
+ private void init(FSDataOutputStream fsout, String compressAlgor, Configuration conf, AccumuloConfiguration accumuloConfiguration) throws IOException {
+ _bc = new BCFile.Writer(fsout, compressAlgor, conf, false, accumuloConfiguration);
}
public ABlockWriter prepareMetaBlock(String name) throws IOException {
@@ -149,6 +150,7 @@ public class CachableBlockFile {
private FileSystem fs;
private Configuration conf;
private boolean closed = false;
+ private AccumuloConfiguration accumuloConfiguration = null;
private interface BlockLoader {
BlockReader get() throws IOException;
@@ -166,7 +168,7 @@ public class CachableBlockFile {
@Override
public BlockReader get() throws IOException {
- return getBCFile().getDataBlock(blockIndex);
+ return getBCFile(accumuloConfiguration).getDataBlock(blockIndex);
}
@Override
@@ -190,7 +192,7 @@ public class CachableBlockFile {
@Override
public BlockReader get() throws IOException {
- return getBCFile().getDataBlock(offset, compressedSize, rawSize);
+ return getBCFile(accumuloConfiguration).getDataBlock(offset, compressedSize, rawSize);
}
@Override
@@ -202,14 +204,16 @@ public class CachableBlockFile {
private class MetaBlockLoader implements BlockLoader {
private String name;
+ private AccumuloConfiguration accumuloConfiguration;
- MetaBlockLoader(String name) {
+ MetaBlockLoader(String name, AccumuloConfiguration accumuloConfiguration) {
this.name = name;
+ this.accumuloConfiguration = accumuloConfiguration;
}
@Override
public BlockReader get() throws IOException {
- return getBCFile().getMetaBlock(name);
+ return getBCFile(accumuloConfiguration).getMetaBlock(name);
}
@Override
@@ -218,7 +222,7 @@ public class CachableBlockFile {
}
}
- public Reader(FileSystem fs, Path dataFile, Configuration conf, BlockCache data, BlockCache index) throws IOException {
+ public Reader(FileSystem fs, Path dataFile, Configuration conf, BlockCache data, BlockCache index, AccumuloConfiguration accumuloConfiguration) throws IOException {
/*
* Grab path create input stream grab len create file
@@ -229,24 +233,25 @@ public class CachableBlockFile {
this._iCache = index;
this.fs = fs;
this.conf = conf;
+ this.accumuloConfiguration = accumuloConfiguration;
}
- public Reader(FSDataInputStream fsin, long len, Configuration conf, BlockCache data, BlockCache index) throws IOException {
+ public Reader(FSDataInputStream fsin, long len, Configuration conf, BlockCache data, BlockCache index, AccumuloConfiguration accumuloConfiguration) throws IOException {
this._dCache = data;
this._iCache = index;
- init(fsin, len, conf);
+ init(fsin, len, conf, accumuloConfiguration);
}
- public Reader(FSDataInputStream fsin, long len, Configuration conf) throws IOException {
+ public Reader(FSDataInputStream fsin, long len, Configuration conf, AccumuloConfiguration accumuloConfiguration) throws IOException {
// this.fin = fsin;
- init(fsin, len, conf);
+ init(fsin, len, conf, accumuloConfiguration);
}
- private void init(FSDataInputStream fsin, long len, Configuration conf) throws IOException {
- this._bc = new BCFile.Reader(this, fsin, len, conf);
+ private void init(FSDataInputStream fsin, long len, Configuration conf, AccumuloConfiguration accumuloConfiguration) throws IOException {
+ this._bc = new BCFile.Reader(this, fsin, len, conf, accumuloConfiguration);
}
- private synchronized BCFile.Reader getBCFile() throws IOException {
+ private synchronized BCFile.Reader getBCFile(AccumuloConfiguration accumuloConfiguration) throws IOException {
if (closed)
throw new IllegalStateException("File " + fileName + " is closed");
@@ -254,7 +259,7 @@ public class CachableBlockFile {
// lazily open file if needed
Path path = new Path(fileName);
fin = fs.open(path);
- init(fin, fs.getFileStatus(path).getLen(), conf);
+ init(fin, fs.getFileStatus(path).getLen(), conf, accumuloConfiguration);
}
return _bc;
@@ -364,7 +369,7 @@ public class CachableBlockFile {
*/
public BlockRead getMetaBlock(String blockName) throws IOException {
String _lookup = this.fileName + "M" + blockName;
- return getBlock(_lookup, _iCache, new MetaBlockLoader(blockName));
+ return getBlock(_lookup, _iCache, new MetaBlockLoader(blockName, accumuloConfiguration));
}
@Override
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java b/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
index 899a5cd..7cee0f9 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
@@ -49,7 +49,8 @@ public class PrintInfo {
Configuration conf = new Configuration();
@SuppressWarnings("deprecation")
- FileSystem hadoopFs = FileUtil.getFileSystem(conf, AccumuloConfiguration.getSiteConfiguration());
+ AccumuloConfiguration aconf = AccumuloConfiguration.getSiteConfiguration();
+ FileSystem hadoopFs = FileUtil.getFileSystem(conf, aconf);
FileSystem localFs = FileSystem.getLocal(conf);
Opts opts = new Opts();
opts.parseArgs(PrintInfo.class.getName(), args);
@@ -70,7 +71,7 @@ public class PrintInfo {
else
fs = hadoopFs.exists(path) ? hadoopFs : localFs; // fall back to local
- CachableBlockFile.Reader _rdr = new CachableBlockFile.Reader(fs, path, conf, null, null);
+ CachableBlockFile.Reader _rdr = new CachableBlockFile.Reader(fs, path, conf, null, null, aconf);
Reader iter = new RFile.Reader(_rdr);
iter.printInfo();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/main/java/org/apache/accumulo/core/file/rfile/RFileOperations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/RFileOperations.java b/core/src/main/java/org/apache/accumulo/core/file/rfile/RFileOperations.java
index 5374332..b361413 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/rfile/RFileOperations.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/RFileOperations.java
@@ -59,7 +59,7 @@ public class RFileOperations extends FileOperations {
// long len = fs.getFileStatus(path).getLen();
// FSDataInputStream in = fs.open(path);
// Reader reader = new RFile.Reader(in, len , conf);
- CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader(fs, path, conf, dataCache, indexCache);
+ CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader(fs, path, conf, dataCache, indexCache, acuconf);
final Reader reader = new RFile.Reader(_cbr);
return reader.getIndex();
@@ -75,7 +75,7 @@ public class RFileOperations extends FileOperations {
BlockCache dataCache, BlockCache indexCache) throws IOException {
Path path = new Path(file);
- CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader(fs, path, conf, dataCache, indexCache);
+ CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader(fs, path, conf, dataCache, indexCache, acuconf);
Reader iter = new RFile.Reader(_cbr);
if (seekToBeginning) {
@@ -121,7 +121,7 @@ public class RFileOperations extends FileOperations {
String compression = acuconf.get(Property.TABLE_FILE_COMPRESSION_TYPE);
- CachableBlockFile.Writer _cbw = new CachableBlockFile.Writer(fs.create(new Path(file), false, bufferSize, (short) rep, block), compression, conf);
+ CachableBlockFile.Writer _cbw = new CachableBlockFile.Writer(fs.create(new Path(file), false, bufferSize, (short) rep, block), compression, conf, acuconf);
Writer writer = new RFile.Writer(_cbw, (int) blockSize, (int) indexBlockSize);
return writer;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java b/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java
index e19e5f3..53e4aaa 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java
@@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.accumulo.core.cli.Help;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.DefaultConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.ByteSequence;
@@ -58,8 +59,9 @@ public class SplitLarge {
opts.parseArgs(SplitLarge.class.getName(), args);
for (String file : opts.files) {
+ AccumuloConfiguration aconf = DefaultConfiguration.getDefaultConfiguration();
Path path = new Path(file);
- CachableBlockFile.Reader rdr = new CachableBlockFile.Reader(fs, path, conf, null, null);
+ CachableBlockFile.Reader rdr = new CachableBlockFile.Reader(fs, path, conf, null, null, aconf);
Reader iter = new RFile.Reader(rdr);
if (!file.endsWith(".rf")) {
@@ -68,10 +70,10 @@ public class SplitLarge {
String smallName = file.substring(0, file.length() - 3) + "_small.rf";
String largeName = file.substring(0, file.length() - 3) + "_large.rf";
- int blockSize = (int) DefaultConfiguration.getDefaultConfiguration().getMemoryInBytes(Property.TABLE_FILE_BLOCK_SIZE);
- Writer small = new RFile.Writer(new CachableBlockFile.Writer(fs, new Path(smallName), "gz", conf), blockSize);
+ int blockSize = (int) aconf.getMemoryInBytes(Property.TABLE_FILE_BLOCK_SIZE);
+ Writer small = new RFile.Writer(new CachableBlockFile.Writer(fs, new Path(smallName), "gz", conf, aconf), blockSize);
small.startDefaultLocalityGroup();
- Writer large = new RFile.Writer(new CachableBlockFile.Writer(fs, new Path(largeName), "gz", conf), blockSize);
+ Writer large = new RFile.Writer(new CachableBlockFile.Writer(fs, new Path(largeName), "gz", conf, aconf), blockSize);
large.startDefaultLocalityGroup();
iter.seek(new Range(), new ArrayList<ByteSequence>(), false);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/BCFile.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/BCFile.java b/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/BCFile.java
index e8f45cc..6c3ea0d 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/BCFile.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/BCFile.java
@@ -346,7 +346,7 @@ public final class BCFile {
* @throws IOException
* @see Compression#getSupportedAlgorithms
*/
- public Writer(FSDataOutputStream fout, String compressionName, Configuration conf, boolean trackDataBlocks) throws IOException {
+ public Writer(FSDataOutputStream fout, String compressionName, Configuration conf, boolean trackDataBlocks, AccumuloConfiguration accumuloConfiguration) throws IOException {
if (fout.getPos() != 0) {
throw new IOException("Output file not at zero offset.");
}
@@ -360,9 +360,6 @@ public final class BCFile {
// Set up crypto-related detail, including secret key generation and encryption
- @SuppressWarnings("deprecation")
- AccumuloConfiguration accumuloConfiguration = AccumuloConfiguration.getSiteConfiguration();
-
this.cryptoModule = CryptoModuleFactory.getCryptoModule(accumuloConfiguration);
this.cryptoParams = new BCFileCryptoModuleParameters();
CryptoModuleFactory.fillParamsObjectFromConfiguration(cryptoParams, accumuloConfiguration);
@@ -739,7 +736,7 @@ public final class BCFile {
* Length of the corresponding file
* @throws IOException
*/
- public Reader(FSDataInputStream fin, long fileLength, Configuration conf) throws IOException {
+ public Reader(FSDataInputStream fin, long fileLength, Configuration conf, AccumuloConfiguration accumuloConfiguration) throws IOException {
this.in = fin;
this.conf = conf;
@@ -775,9 +772,6 @@ public final class BCFile {
// If they exist, read the crypto parameters
if (!version.equals(BCFile.API_VERSION_1)) {
- @SuppressWarnings("deprecation")
- AccumuloConfiguration accumuloConfiguration = AccumuloConfiguration.getSiteConfiguration();
-
// read crypto parameters
fin.seek(offsetCryptoParameters);
cryptoParams = new BCFileCryptoModuleParameters();
@@ -822,7 +816,7 @@ public final class BCFile {
}
}
- public Reader(CachableBlockFile.Reader cache, FSDataInputStream fin, long fileLength, Configuration conf) throws IOException {
+ public Reader(CachableBlockFile.Reader cache, FSDataInputStream fin, long fileLength, Configuration conf, AccumuloConfiguration accumuloConfiguration) throws IOException {
this.in = fin;
this.conf = conf;
@@ -864,9 +858,6 @@ public final class BCFile {
// If they exist, read the crypto parameters
if (!version.equals(BCFile.API_VERSION_1) && cachedCryptoParams == null) {
- @SuppressWarnings("deprecation")
- AccumuloConfiguration accumuloConfiguration = AccumuloConfiguration.getSiteConfiguration();
-
// read crypto parameters
fin.seek(offsetCryptoParameters);
cryptoParams = new BCFileCryptoModuleParameters();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java b/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java
index a7464c6..4809d80 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java
@@ -30,11 +30,11 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class PrintInfo {
- public static void printMetaBlockInfo(Configuration conf, FileSystem fs, Path path) throws IOException {
+ public static void printMetaBlockInfo(Configuration conf, FileSystem fs, Path path, AccumuloConfiguration accumuloConfiguration) throws IOException {
FSDataInputStream fsin = fs.open(path);
BCFile.Reader bcfr = null;
try {
- bcfr = new BCFile.Reader(fsin, fs.getFileStatus(path).getLen(), conf);
+ bcfr = new BCFile.Reader(fsin, fs.getFileStatus(path).getLen(), conf, accumuloConfiguration);
Set<Entry<String,MetaIndexEntry>> es = bcfr.metaIndex.index.entrySet();
@@ -56,7 +56,8 @@ public class PrintInfo {
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
@SuppressWarnings("deprecation")
- FileSystem hadoopFs = FileUtil.getFileSystem(conf, AccumuloConfiguration.getSiteConfiguration());
+ AccumuloConfiguration siteConf = AccumuloConfiguration.getSiteConfiguration();
+ FileSystem hadoopFs = FileUtil.getFileSystem(conf, siteConf);
FileSystem localFs = FileSystem.getLocal(conf);
Path path = new Path(args[0]);
FileSystem fs;
@@ -64,6 +65,6 @@ public class PrintInfo {
fs = path.getFileSystem(conf);
else
fs = hadoopFs.exists(path) ? hadoopFs : localFs; // fall back to local
- printMetaBlockInfo(conf, fs, path);
+ printMetaBlockInfo(conf, fs, path, siteConf);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/main/java/org/apache/accumulo/core/security/SecurityUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/security/SecurityUtil.java b/core/src/main/java/org/apache/accumulo/core/security/SecurityUtil.java
index 59c1974..43a2d46 100644
--- a/core/src/main/java/org/apache/accumulo/core/security/SecurityUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/security/SecurityUtil.java
@@ -35,9 +35,7 @@ public class SecurityUtil {
* This method is for logging a server in kerberos. If this is used in client code, it will fail unless run as the accumulo keytab's owner. Instead, use
* {@link #login(String, String)}
*/
- public static void serverLogin() {
- @SuppressWarnings("deprecation")
- AccumuloConfiguration acuConf = AccumuloConfiguration.getSiteConfiguration();
+ public static void serverLogin(AccumuloConfiguration acuConf) {
String keyTab = acuConf.getPath(Property.GENERAL_KERBEROS_KEYTAB);
if (keyTab == null || keyTab.length() == 0)
return;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java b/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
index 7f1b8dc..faded56 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
@@ -434,7 +434,7 @@ public class Shell extends ShellOptions {
AccumuloConfiguration conf = SiteConfiguration.getInstance(ServerConfigurationUtil.convertClientConfig(DefaultConfiguration.getInstance(), clientConfig));
if (instanceName == null) {
Path instanceDir = new Path(conf.get(Property.INSTANCE_DFS_DIR), "instance_id");
- instanceId = UUID.fromString(ZooUtil.getInstanceIDFromHdfs(instanceDir));
+ instanceId = UUID.fromString(ZooUtil.getInstanceIDFromHdfs(instanceDir, conf));
}
if (keepers == null) {
keepers = conf.get(Property.INSTANCE_ZK_HOST);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java b/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java
index fa0bdf6..a062602 100644
--- a/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java
@@ -46,11 +46,10 @@ public class ZooUtil extends org.apache.accumulo.fate.zookeeper.ZooUtil {
* Utility to support certain client side utilities to minimize command-line options.
*/
- public static String getInstanceIDFromHdfs(Path instanceDirectory) {
+ public static String getInstanceIDFromHdfs(Path instanceDirectory, AccumuloConfiguration conf) {
try {
- @SuppressWarnings("deprecation")
- FileSystem fs = FileUtil.getFileSystem(instanceDirectory.toString(), CachedConfiguration.getInstance(), AccumuloConfiguration.getSiteConfiguration());
+ FileSystem fs = FileUtil.getFileSystem(instanceDirectory.toString(), CachedConfiguration.getInstance(), conf);
FileStatus[] files = null;
try {
files = fs.listStatus(instanceDirectory);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java
index 565b618..aad544b 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java
@@ -46,6 +46,7 @@ import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.lib.IdentityMapper;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
+import org.apache.log4j.Logger;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
@@ -108,6 +109,7 @@ public class AccumuloFileOutputFormatTest {
if (index == 2)
fail();
} catch (Exception e) {
+ Logger.getLogger(this.getClass()).error(e, e);
assertEquals(2, index);
}
} catch (AssertionError e) {
@@ -191,6 +193,7 @@ public class AccumuloFileOutputFormatTest {
File f = folder.newFile("writeBadVisibility");
f.delete();
MRTester.main(new String[] {"root", "", BAD_TABLE, f.getAbsolutePath()});
+ Logger.getLogger(this.getClass()).error(e1, e1);
assertNull(e1);
assertNull(e2);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java
index 9609e02..600caab 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java
@@ -148,7 +148,7 @@ public class PropertyTest {
TreeSet<String> expected = new TreeSet<String>();
for (Entry<String,String> entry : conf) {
String key = entry.getKey();
- if (key.equals(Property.INSTANCE_SECRET.getKey()) || key.toLowerCase().contains("password") || key.toLowerCase().contains("secret")
+ if (key.equals(Property.INSTANCE_SECRET.getKey()) || key.toLowerCase().contains("password") || key.toLowerCase().endsWith("secret")
|| key.startsWith(Property.TRACE_TOKEN_PROPERTY_PREFIX.getKey()))
expected.add(key);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/test/java/org/apache/accumulo/core/file/rfile/CreateCompatTestFile.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/CreateCompatTestFile.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/CreateCompatTestFile.java
index e99b3f2..46c2f0e 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/CreateCompatTestFile.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/CreateCompatTestFile.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.core.file.rfile;
import java.util.HashSet;
import java.util.Set;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.data.ArrayByteSequence;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
@@ -55,7 +56,7 @@ public class CreateCompatTestFile {
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(conf);
- CachableBlockFile.Writer _cbw = new CachableBlockFile.Writer(fs, new Path(args[0]), "gz", conf);
+ CachableBlockFile.Writer _cbw = new CachableBlockFile.Writer(fs, new Path(args[0]), "gz", conf, AccumuloConfiguration.getDefaultConfiguration());
RFile.Writer writer = new RFile.Writer(_cbw, 1000);
writer.startNewLocalityGroup("lg1", ncfs(nf("cf_", 1), nf("cf_", 2)));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiLevelIndexTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiLevelIndexTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiLevelIndexTest.java
index 00405d1..0487495 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiLevelIndexTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiLevelIndexTest.java
@@ -22,6 +22,7 @@ import java.util.Random;
import junit.framework.TestCase;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.file.blockfile.ABlockWriter;
import org.apache.accumulo.core.file.blockfile.impl.CachableBlockFile;
@@ -51,9 +52,10 @@ public class MultiLevelIndexTest extends TestCase {
}
private void runTest(int maxBlockSize, int num) throws IOException {
+ AccumuloConfiguration aconf = AccumuloConfiguration.getDefaultConfiguration();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
FSDataOutputStream dos = new FSDataOutputStream(baos, new FileSystem.Statistics("a"));
- CachableBlockFile.Writer _cbw = new CachableBlockFile.Writer(dos, "gz", CachedConfiguration.getInstance());
+ CachableBlockFile.Writer _cbw = new CachableBlockFile.Writer(dos, "gz", CachedConfiguration.getInstance(), aconf);
BufferedWriter mliw = new BufferedWriter(new Writer(_cbw, maxBlockSize));
@@ -73,7 +75,7 @@ public class MultiLevelIndexTest extends TestCase {
byte[] data = baos.toByteArray();
SeekableByteArrayInputStream bais = new SeekableByteArrayInputStream(data);
FSDataInputStream in = new FSDataInputStream(bais);
- CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader(in, data.length, CachedConfiguration.getInstance());
+ CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader(in, data.length, CachedConfiguration.getInstance(), aconf);
Reader reader = new Reader(_cbr, RFile.RINDEX_VER_7);
BlockRead rootIn = _cbr.getMetaBlock("root");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
index cffe2cb..fb9658c 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
@@ -178,7 +178,7 @@ public class RFileTest {
baos = new ByteArrayOutputStream();
dos = new FSDataOutputStream(baos, new FileSystem.Statistics("a"));
- CachableBlockFile.Writer _cbw = new CachableBlockFile.Writer(dos, "gz", conf);
+ CachableBlockFile.Writer _cbw = new CachableBlockFile.Writer(dos, "gz", conf, AccumuloConfiguration.getDefaultConfiguration());
writer = new RFile.Writer(_cbw, 1000, 1000);
if (startDLG)
@@ -211,7 +211,7 @@ public class RFileTest {
LruBlockCache indexCache = new LruBlockCache(100000000, 100000);
LruBlockCache dataCache = new LruBlockCache(100000000, 100000);
- CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader(in, fileLength, conf, dataCache, indexCache);
+ CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader(in, fileLength, conf, dataCache, indexCache, AccumuloConfiguration.getDefaultConfiguration());
reader = new RFile.Reader(_cbr);
iter = new ColumnFamilySkippingIterator(reader);
@@ -1546,7 +1546,9 @@ public class RFileTest {
byte data[] = baos.toByteArray();
SeekableByteArrayInputStream bais = new SeekableByteArrayInputStream(data);
FSDataInputStream in2 = new FSDataInputStream(bais);
- CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader(in2, data.length, CachedConfiguration.getInstance());
+ @SuppressWarnings("deprecation")
+ AccumuloConfiguration aconf = AccumuloConfiguration.getSiteConfiguration();
+ CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader(in2, data.length, CachedConfiguration.getInstance(), aconf);
Reader reader = new RFile.Reader(_cbr);
checkIndex(reader);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/test/java/org/apache/accumulo/core/security/crypto/CryptoTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/security/crypto/CryptoTest.java b/core/src/test/java/org/apache/accumulo/core/security/crypto/CryptoTest.java
index 963f41c..605e43a 100644
--- a/core/src/test/java/org/apache/accumulo/core/security/crypto/CryptoTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/security/crypto/CryptoTest.java
@@ -34,6 +34,7 @@ import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.SecureRandom;
import java.util.Arrays;
+import java.util.Map.Entry;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
@@ -42,7 +43,8 @@ import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.SiteConfiguration;
+import org.apache.accumulo.core.conf.ConfigurationCopy;
+import org.apache.hadoop.conf.Configuration;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -61,7 +63,6 @@ public class CryptoTest {
@Test
public void testNoCryptoStream() throws IOException {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CRYPTO_OFF_CONF);
CryptoModuleParameters params = CryptoModuleFactory.createParamsObjectFromAccumuloConfiguration(conf);
@@ -82,14 +83,10 @@ public class CryptoTest {
params = cryptoModule.getEncryptingOutputStream(params);
assertNotNull(params.getEncryptedOutputStream());
assertEquals(out, params.getEncryptedOutputStream());
-
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
}
@Test
public void testCryptoModuleParamsParsing() {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CRYPTO_ON_CONF);
CryptoModuleParameters params = CryptoModuleFactory.createParamsObjectFromAccumuloConfiguration(conf);
@@ -102,48 +99,32 @@ public class CryptoTest {
assertEquals("SHA1PRNG", params.getRandomNumberGenerator());
assertEquals("SUN", params.getRandomNumberGeneratorProvider());
assertEquals("org.apache.accumulo.core.security.crypto.CachingHDFSSecretKeyEncryptionStrategy", params.getKeyEncryptionStrategyClass());
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
}
@Test
public void testCryptoModuleParamsValidation1() throws IOException {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CRYPTO_ON_CONF);
-
- try {
-
- CryptoModuleParameters params = CryptoModuleFactory.createParamsObjectFromAccumuloConfiguration(conf);
- CryptoModule cryptoModule = CryptoModuleFactory.getCryptoModule(conf);
-
- assertTrue(cryptoModule instanceof DefaultCryptoModule);
-
- exception.expect(RuntimeException.class);
- cryptoModule.getEncryptingOutputStream(params);
-
-
- } finally {
- restoreOldConfiguration(oldSiteConfigProperty, conf);
- }
+
+ CryptoModuleParameters params = CryptoModuleFactory.createParamsObjectFromAccumuloConfiguration(conf);
+ CryptoModule cryptoModule = CryptoModuleFactory.getCryptoModule(conf);
+
+ assertTrue(cryptoModule instanceof DefaultCryptoModule);
+
+ exception.expect(RuntimeException.class);
+ cryptoModule.getEncryptingOutputStream(params);
}
@Test
public void testCryptoModuleParamsValidation2() throws IOException {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CRYPTO_ON_CONF);
- try {
-
- CryptoModuleParameters params = CryptoModuleFactory.createParamsObjectFromAccumuloConfiguration(conf);
- CryptoModule cryptoModule = CryptoModuleFactory.getCryptoModule(conf);
-
- assertTrue(cryptoModule instanceof DefaultCryptoModule);
-
- exception.expect(RuntimeException.class);
- cryptoModule.getDecryptingInputStream(params);
- } finally {
- restoreOldConfiguration(oldSiteConfigProperty, conf);
- }
+ CryptoModuleParameters params = CryptoModuleFactory.createParamsObjectFromAccumuloConfiguration(conf);
+ CryptoModule cryptoModule = CryptoModuleFactory.getCryptoModule(conf);
+
+ assertTrue(cryptoModule instanceof DefaultCryptoModule);
+
+ exception.expect(RuntimeException.class);
+ cryptoModule.getDecryptingInputStream(params);
}
private String getStringifiedBytes(String s) throws IOException {
@@ -170,14 +151,12 @@ public class CryptoTest {
@Test
public void testCryptoModuleBasicReadWrite() throws IOException {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CRYPTO_ON_KEK_OFF_CONF);
CryptoModule cryptoModule = CryptoModuleFactory.getCryptoModule(conf);
CryptoModuleParameters params = CryptoModuleFactory.createParamsObjectFromAccumuloConfiguration(conf);
assertTrue(cryptoModule instanceof DefaultCryptoModule);
- assertTrue(params.getKeyEncryptionStrategyClass() == null || params.getKeyEncryptionStrategyClass().equals(""));
byte[] resultingBytes = setUpSampleEncryptedBytes(cryptoModule, params);
@@ -199,8 +178,6 @@ public class CryptoTest {
assertEquals(MARKER_STRING, markerString);
assertEquals(MARKER_INT, markerInt);
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
}
private byte[] setUpSampleEncryptedBytes(CryptoModule cryptoModule, CryptoModuleParameters params) throws IOException {
@@ -233,7 +210,6 @@ public class CryptoTest {
@Test
public void testKeyEncryptionAndCheckThatFileCannotBeReadWithoutKEK() throws IOException {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CRYPTO_ON_CONF);
CryptoModule cryptoModule = CryptoModuleFactory.getCryptoModule(conf);
@@ -259,19 +235,13 @@ public class CryptoTest {
assertNotNull(params.getPlaintextInputStream());
DataInputStream dataIn = new DataInputStream(params.getPlaintextInputStream());
// We expect the following operation to fail and throw an exception
- try {
- exception.expect(IOException.class);
- @SuppressWarnings("unused")
- String markerString = dataIn.readUTF();
- }
- finally {
- restoreOldConfiguration(oldSiteConfigProperty, conf);
- }
+ exception.expect(IOException.class);
+ @SuppressWarnings("unused")
+ String markerString = dataIn.readUTF();
}
@Test
public void testKeyEncryptionNormalPath() throws IOException {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CRYPTO_ON_CONF);
CryptoModule cryptoModule = CryptoModuleFactory.getCryptoModule(conf);
@@ -299,13 +269,10 @@ public class CryptoTest {
assertEquals(MARKER_STRING, markerString);
assertEquals(MARKER_INT, markerInt);
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
}
@Test
public void testChangingCryptoParamsAndCanStillDecryptPreviouslyEncryptedFiles() throws IOException {
- String oldSiteConfigProperty = System.getProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
AccumuloConfiguration conf = setAndGetAccumuloConfig(CRYPTO_ON_CONF);
CryptoModule cryptoModule = CryptoModuleFactory.getCryptoModule(conf);
@@ -336,27 +303,16 @@ public class CryptoTest {
assertEquals(MARKER_STRING, markerString);
assertEquals(MARKER_INT, markerInt);
-
- restoreOldConfiguration(oldSiteConfigProperty, conf);
}
- private void restoreOldConfiguration(String oldSiteConfigProperty, AccumuloConfiguration conf) {
- if (oldSiteConfigProperty != null) {
- System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, oldSiteConfigProperty);
- } else {
- System.clearProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP);
+ private AccumuloConfiguration setAndGetAccumuloConfig(String cryptoConfSetting) {
+ ConfigurationCopy result = new ConfigurationCopy(AccumuloConfiguration.getDefaultConfiguration());
+ Configuration conf = new Configuration(false);
+ conf.addResource(cryptoConfSetting);
+ for (Entry<String,String> e : conf) {
+ result.set(e.getKey(), e.getValue());
}
- ((SiteConfiguration)conf).clearAndNull();
- }
-
-
-
- private AccumuloConfiguration setAndGetAccumuloConfig(String cryptoConfSetting) {
- @SuppressWarnings("deprecation")
- AccumuloConfiguration conf = AccumuloConfiguration.getSiteConfiguration();
- System.setProperty(CryptoTest.CONFIG_FILE_SYSTEM_PROP, cryptoConfSetting);
- ((SiteConfiguration)conf).clearAndNull();
- return conf;
+ return result;
}
@Test
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/core/src/test/java/org/apache/accumulo/core/util/shell/ShellSetInstanceTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/util/shell/ShellSetInstanceTest.java b/core/src/test/java/org/apache/accumulo/core/util/shell/ShellSetInstanceTest.java
index 40b5cf0..af810ad 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/shell/ShellSetInstanceTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/shell/ShellSetInstanceTest.java
@@ -179,7 +179,7 @@ public class ShellSetInstanceTest {
if (!onlyInstance) {
mockStatic(ZooUtil.class);
randomUUID = UUID.randomUUID();
- expect(ZooUtil.getInstanceIDFromHdfs(anyObject(Path.class)))
+ expect(ZooUtil.getInstanceIDFromHdfs(anyObject(Path.class), anyObject(AccumuloConfiguration.class)))
.andReturn(randomUUID.toString());
replay(ZooUtil.class);
expect(clientConf.withInstance(randomUUID)).andReturn(clientConf);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/server/base/src/main/java/org/apache/accumulo/server/ServerConstants.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/ServerConstants.java b/server/base/src/main/java/org/apache/accumulo/server/ServerConstants.java
index eb928ba..ca5783b 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/ServerConstants.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/ServerConstants.java
@@ -136,7 +136,7 @@ public class ServerConstants {
String currentIid;
Integer currentVersion;
try {
- currentIid = ZooUtil.getInstanceIDFromHdfs(new Path(baseDir, INSTANCE_ID_DIR));
+ currentIid = ZooUtil.getInstanceIDFromHdfs(new Path(baseDir, INSTANCE_ID_DIR), ServerConfiguration.getSiteConfiguration());
Path vpath = new Path(baseDir, VERSION_DIR);
currentVersion = Accumulo.getAccumuloPersistentVersion(vpath.getFileSystem(CachedConfiguration.getInstance()), vpath);
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/server/base/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java b/server/base/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
index 54fb7e3..6993a0a 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
@@ -122,7 +122,7 @@ public class HdfsZooInstance implements Instance {
private static synchronized void _getInstanceID() {
if (instanceId == null) {
- String instanceIdFromFile = ZooUtil.getInstanceIDFromHdfs(ServerConstants.getInstanceIdLocation());
+ String instanceIdFromFile = ZooUtil.getInstanceIDFromHdfs(ServerConstants.getInstanceIdLocation(), ServerConfiguration.getSiteConfiguration());
instanceId = instanceIdFromFile;
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/server/base/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java b/server/base/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
index e790d0d..32f6126 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
@@ -57,7 +57,7 @@ public class ZooConfiguration extends AccumuloConfiguration {
if (instance == null) {
propCache = new ZooCache(parent.get(Property.INSTANCE_ZK_HOST), (int) parent.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT));
instance = new ZooConfiguration(parent);
- String deprecatedInstanceIdFromHdfs = ZooUtil.getInstanceIDFromHdfs(ServerConstants.getInstanceIdLocation());
+ String deprecatedInstanceIdFromHdfs = ZooUtil.getInstanceIDFromHdfs(ServerConstants.getInstanceIdLocation(), parent);
instanceId = deprecatedInstanceIdFromHdfs;
}
return instance;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
index a7e858c..8533484 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
@@ -573,7 +573,7 @@ public class Initialize {
Path iidPath = new Path(aBasePath, ServerConstants.INSTANCE_ID_DIR);
Path versionPath = new Path(aBasePath, ServerConstants.VERSION_DIR);
- UUID uuid = UUID.fromString(ZooUtil.getInstanceIDFromHdfs(iidPath));
+ UUID uuid = UUID.fromString(ZooUtil.getInstanceIDFromHdfs(iidPath, ServerConfiguration.getSiteConfiguration()));
if (ServerConstants.DATA_VERSION != Accumulo.getAccumuloPersistentVersion(versionPath.getFileSystem(CachedConfiguration.getInstance()), versionPath)) {
throw new IOException("Accumulo " + Constants.VERSION + " cannot initialize data version " + Accumulo.getAccumuloPersistentVersion(fs));
@@ -602,10 +602,11 @@ public class Initialize {
opts.parseArgs(Initialize.class.getName(), args);
try {
- SecurityUtil.serverLogin();
+ AccumuloConfiguration acuConf = ServerConfiguration.getSiteConfiguration();
+ SecurityUtil.serverLogin(acuConf);
Configuration conf = CachedConfiguration.getInstance();
- VolumeManager fs = VolumeManagerImpl.get(ServerConfiguration.getSiteConfiguration());
+ VolumeManager fs = VolumeManagerImpl.get(acuConf);
if (opts.resetSecurity) {
if (isInitialized(fs)) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
----------------------------------------------------------------------
diff --git a/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java b/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
index e6c8265..89925b4 100644
--- a/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
+++ b/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
@@ -134,7 +134,7 @@ public class SimpleGarbageCollector implements Iface {
private Instance instance;
public static void main(String[] args) throws UnknownHostException, IOException {
- SecurityUtil.serverLogin();
+ SecurityUtil.serverLogin(ServerConfiguration.getSiteConfiguration());
Instance instance = HdfsZooInstance.getInstance();
ServerConfiguration serverConf = new ServerConfiguration(instance);
final VolumeManager fs = VolumeManagerImpl.get();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/server/master/src/main/java/org/apache/accumulo/master/Master.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java
index 31469f1..a063377 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@ -1058,7 +1058,7 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
public static void main(String[] args) throws Exception {
try {
- SecurityUtil.serverLogin();
+ SecurityUtil.serverLogin(ServerConfiguration.getSiteConfiguration());
VolumeManager fs = VolumeManagerImpl.get();
ServerOpts opts = new ServerOpts();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/server/master/src/main/java/org/apache/accumulo/master/state/SetGoalState.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/state/SetGoalState.java b/server/master/src/main/java/org/apache/accumulo/master/state/SetGoalState.java
index e28dcad..f981bae 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/state/SetGoalState.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/state/SetGoalState.java
@@ -23,6 +23,7 @@ import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
import org.apache.accumulo.server.Accumulo;
import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.accumulo.server.fs.VolumeManager;
import org.apache.accumulo.server.fs.VolumeManagerImpl;
import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
@@ -37,7 +38,7 @@ public class SetGoalState {
System.err.println("Usage: accumulo " + SetGoalState.class.getName() + " [NORMAL|SAFE_MODE|CLEAN_STOP]");
System.exit(-1);
}
- SecurityUtil.serverLogin();
+ SecurityUtil.serverLogin(ServerConfiguration.getSiteConfiguration());
VolumeManager fs = VolumeManagerImpl.get();
Accumulo.waitForZookeeperAndHdfs(fs);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
index 90b65fe..0e6b37f 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
@@ -390,7 +390,7 @@ public class Monitor {
}
public static void main(String[] args) throws Exception {
- SecurityUtil.serverLogin();
+ SecurityUtil.serverLogin(ServerConfiguration.getSiteConfiguration());
VolumeManager fs = VolumeManagerImpl.get();
ServerOpts opts = new ServerOpts();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
----------------------------------------------------------------------
diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
index 0f4cd3a..30f1ae7 100644
--- a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
+++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
@@ -283,7 +283,7 @@ public class TraceServer implements Watcher {
}
public static void main(String[] args) throws Exception {
- SecurityUtil.serverLogin();
+ SecurityUtil.serverLogin(ServerConfiguration.getSiteConfiguration());
ServerOpts opts = new ServerOpts();
opts.parseArgs("tracer", args);
Instance instance = HdfsZooInstance.getInstance();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 4efcab1..1cce565 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -3153,7 +3153,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
// main loop listens for client requests
public void run() {
- SecurityUtil.serverLogin();
+ SecurityUtil.serverLogin(ServerConfiguration.getSiteConfiguration());
try {
clientAddress = startTabletClientService();
@@ -3646,7 +3646,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
public static void main(String[] args) throws IOException {
try {
- SecurityUtil.serverLogin();
+ SecurityUtil.serverLogin(ServerConfiguration.getSiteConfiguration());
VolumeManager fs = VolumeManagerImpl.get();
ServerOpts opts = new ServerOpts();
opts.parseArgs("tserver", args);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java
index b32ace9..25b8043 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java
@@ -28,9 +28,9 @@ import java.util.regex.Pattern;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.Help;
-import org.apache.accumulo.core.conf.SiteConfiguration;
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.accumulo.server.fs.VolumeManager;
import org.apache.accumulo.server.fs.VolumeManagerImpl;
import org.apache.accumulo.tserver.log.DfsLogger;
@@ -97,8 +97,7 @@ public class LogReader {
if (fs.isFile(path)) {
// read log entries from a simple hdfs file
- @SuppressWarnings("deprecation")
- DFSLoggerInputStreams streams = DfsLogger.readHeaderAndReturnStream(fs, path, SiteConfiguration.getSiteConfiguration());
+ DFSLoggerInputStreams streams = DfsLogger.readHeaderAndReturnStream(fs, path, ServerConfiguration.getSiteConfiguration());
DataInputStream input = streams.getDecryptingInputStream();
try {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/server/tserver/src/test/java/org/apache/accumulo/tserver/log/TestUpgradePathForWALogs.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/TestUpgradePathForWALogs.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/TestUpgradePathForWALogs.java
index f1ceb3b..af149fa 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/TestUpgradePathForWALogs.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/TestUpgradePathForWALogs.java
@@ -23,7 +23,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import org.apache.accumulo.core.conf.DefaultConfiguration;
+import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.accumulo.server.fs.VolumeManager;
import org.apache.accumulo.server.fs.VolumeManagerImpl;
import org.apache.commons.io.FileUtils;
@@ -84,8 +84,7 @@ public class TestUpgradePathForWALogs {
walogInHDFStream.close();
walogInHDFStream = null;
- @SuppressWarnings("deprecation")
- LogSorter logSorter = new LogSorter(null, fs, DefaultConfiguration.getSiteConfiguration());
+ LogSorter logSorter = new LogSorter(null, fs, ServerConfiguration.getSiteConfiguration());
LogSorter.LogProcessor logProcessor = logSorter.new LogProcessor();
logProcessor.sort(WALOG_FROM_15, new Path("file://" + root.getRoot().getAbsolutePath() + WALOG_FROM_15), "file://" + root.getRoot().getAbsolutePath()
@@ -119,8 +118,7 @@ public class TestUpgradePathForWALogs {
walogInHDFStream.close();
walogInHDFStream = null;
- @SuppressWarnings("deprecation")
- LogSorter logSorter = new LogSorter(null, fs, DefaultConfiguration.getSiteConfiguration());
+ LogSorter logSorter = new LogSorter(null, fs, ServerConfiguration.getSiteConfiguration());
LogSorter.LogProcessor logProcessor = logSorter.new LogProcessor();
logProcessor.sort(walogToTest, new Path("file://" + root.getRoot().getAbsolutePath() + walogToTest), "file://" + root.getRoot().getAbsolutePath()
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2de427f/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java
index d4d6838..4a4d5c8 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java
@@ -28,6 +28,7 @@ import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.MutationsRejectedException;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.TableOfflineException;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.data.ColumnUpdate;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
@@ -48,8 +49,9 @@ public class BulkImport extends Test {
RFile.Writer writer;
public RFileBatchWriter(Configuration conf, FileSystem fs, String file) throws IOException {
+ AccumuloConfiguration aconf = AccumuloConfiguration.getDefaultConfiguration();
CachableBlockFile.Writer cbw = new CachableBlockFile.Writer(fs.create(new Path(file), false, conf.getInt("io.file.buffer.size", 4096),
- (short) conf.getInt("dfs.replication", 3), conf.getLong("dfs.block.size", 1 << 26)), "gz", conf);
+ (short) conf.getInt("dfs.replication", 3), conf.getLong("dfs.block.size", 1 << 26)), "gz", conf, aconf);
writer = new RFile.Writer(cbw, 100000);
writer.startDefaultLocalityGroup();
}