You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2013/06/17 23:29:53 UTC
svn commit: r1493947 - in /accumulo/trunk:
core/src/main/java/org/apache/accumulo/core/
core/src/main/java/org/apache/accumulo/core/client/impl/
core/src/main/java/org/apache/accumulo/core/data/
core/src/main/java/org/apache/accumulo/core/util/ server/...
Author: ctubbsii
Date: Mon Jun 17 21:29:52 2013
New Revision: 1493947
URL: http://svn.apache.org/r1493947
Log:
ACCUMULO-1516 remove old and unused/unneeded constants and moved server-related constants to server package
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/Constants.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/Value.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/TableDiskUsage.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/Accumulo.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/ServerConstants.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoveryManager.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ImportTable.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/TableRangeOp.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/LogSorter.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/ZooKeeperMain.java
accumulo/trunk/test/src/test/java/org/apache/accumulo/test/AuditMessageTest.java
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/Constants.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/Constants.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/Constants.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/Constants.java Mon Jun 17 21:29:52 2013
@@ -18,26 +18,18 @@ package org.apache.accumulo.core;
import java.nio.charset.Charset;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.PartialKey;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.ColumnFQ;
-import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
public class Constants {
public static final Charset UTF8 = Charset.forName("UTF-8");
public static final String VERSION = FilteredConstants.VERSION;
- // versions should never be negative
- public static final Integer WIRE_VERSION = 2;
- public static final int DATA_VERSION = 5;
- public static final int PREV_DATA_VERSION = 4;
-
// Zookeeper locations
public static final String ZROOT = "/accumulo";
public static final String ZINSTANCES = "/instances";
@@ -60,6 +52,7 @@ public class Constants {
public static final String ZMASTERS = "/masters";
public static final String ZMASTER_LOCK = ZMASTERS + "/lock";
public static final String ZMASTER_GOAL_STATE = ZMASTERS + "/goal_state";
+
public static final String ZGC = "/gc";
public static final String ZGC_LOCK = ZGC + "/lock";
@@ -68,12 +61,11 @@ public class Constants {
public static final String ZTSERVERS = "/tservers";
public static final String ZDEAD = "/dead";
- public static final String ZDEADTSERVERS = "/dead/tservers";
+ public static final String ZDEADTSERVERS = ZDEAD + "/tservers";
public static final String ZTRACERS = "/tracers";
public static final String ZPROBLEMS = "/problems";
- public static final String ZUSERS = "/users";
public static final String BULK_ARBITRATOR_TYPE = "bulkTx";
@@ -94,8 +86,6 @@ public class Constants {
// reserved keyspace is any row that begins with a tilde '~' character
public static final Key METADATA_RESERVED_KEYSPACE_START_KEY = new Key(new Text(new byte[] {'~'}));
- public static final Key METADATA_RESERVED_KEYSPACE_STOP_KEY = new Key(new Text(new byte[] {'~' + 1}));
- public static final Range METADATA_RESERVED_KEYSPACE = new Range(METADATA_RESERVED_KEYSPACE_START_KEY, true, METADATA_RESERVED_KEYSPACE_STOP_KEY, false);
public static final String METADATA_DELETE_FLAG_PREFIX = "~del";
public static final String METADATA_DELETE_FLAG_FOR_METADATA_PREFIX = "!!" + METADATA_DELETE_FLAG_PREFIX;
public static final Range METADATA_DELETES_KEYSPACE = new Range(new Key(new Text(METADATA_DELETE_FLAG_PREFIX)), true, new Key(new Text("~dem")), false);
@@ -139,19 +129,12 @@ public class Constants {
public static final Range METADATA_ROOT_TABLET_KEYSPACE = new Range(ROOT_TABLET_EXTENT.getMetadataEntry(), false, KeyExtent.getMetadataEntry(new Text(
METADATA_TABLE_ID), null), true);
- public static final String VALUE_ENCODING = "UTF-8";
-
public static final String BULK_PREFIX = "b-";
- public static final String OLD_BULK_PREFIX = "bulk_";
// note: all times are in milliseconds
public static final int SCAN_BATCH_SIZE = 1000; // this affects the table client caching of metadata
- public static final long MIN_MASTER_LOOP_TIME = 1000;
- public static final int MASTER_TABLETSERVER_CONNECTION_TIMEOUT = 3000;
- public static final long CLIENT_SLEEP_BEFORE_RECONNECT = 1000;
-
// Security configuration
public static final String PW_HASH_ALGORITHM = "SHA-256";
@@ -164,10 +147,8 @@ public class Constants {
public static final int DEFAULT_MINOR_COMPACTION_MAX_SLEEP_TIME = 60 * 3; // in seconds
public static final int MAX_DATA_TO_PRINT = 64;
- public static final int CLIENT_RETRIES = 5;
public static final int TSERV_MINC_MAXCONCURRENT_NUMWAITING_MULTIPLIER = 2;
public static final String CORE_PACKAGE_NAME = "org.apache.accumulo.core";
- public static final String OLD_PACKAGE_NAME = "cloudbase";
public static final String VALID_TABLE_NAME_REGEX = "^\\w+$";
public static final String MAPFILE_EXTENSION = "map";
public static final String GENERATED_TABLET_DIRECTORY_PREFIX = "t-";
@@ -177,37 +158,4 @@ public class Constants {
public static final String EXPORT_FILE = "exportMetadata.zip";
public static final String EXPORT_INFO_FILE = "accumulo_export_info.txt";
- public static String getBaseDir(final AccumuloConfiguration conf) {
- return conf.get(Property.INSTANCE_DFS_DIR);
- }
-
- public static String getTablesDir(final AccumuloConfiguration conf) {
- return getBaseDir(conf) + "/tables";
- }
-
- public static String getRecoveryDir(final AccumuloConfiguration conf) {
- return getBaseDir(conf) + "/recovery";
- }
-
- public static Path getDataVersionLocation(final AccumuloConfiguration conf) {
- return new Path(getBaseDir(conf) + "/version");
- }
-
- public static String getMetadataTableDir(final AccumuloConfiguration conf) {
- return getTablesDir(conf) + "/" + METADATA_TABLE_ID;
- }
-
- public static String getRootTabletDir(final AccumuloConfiguration conf) {
- return getMetadataTableDir(conf) + ZROOT_TABLET;
- }
-
- /**
- * @param conf
- * @return The write-ahead log directory.
- */
- public static String getWalDirectory(final AccumuloConfiguration conf) {
- return getBaseDir(conf) + "/wal";
- }
-
- public static final String AUDITLOG = "Audit";
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java Mon Jun 17 21:29:52 2013
@@ -230,7 +230,7 @@ class OfflineIterator implements Iterato
if (currentExtent != null && !extent.isPreviousExtent(currentExtent))
throw new AccumuloException(" " + currentExtent + " is not previous extent " + extent);
- String tablesDir = Constants.getTablesDir(instance.getConfiguration());
+ String tablesDir = instance.getConfiguration().get(Property.INSTANCE_DFS_DIR) + "/tables";
List<String> absFiles = new ArrayList<String>();
for (String relPath : relFiles) {
if (relPath.startsWith(".."))
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/Value.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/Value.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/Value.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/Value.java Mon Jun 17 21:29:52 2013
@@ -22,7 +22,6 @@ import static org.apache.accumulo.core.u
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.List;
@@ -30,7 +29,6 @@ import org.apache.accumulo.core.Constant
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;
-import org.apache.log4j.Logger;
/**
* A byte sequence that is usable as a key or value. Based on {@link org.apache.hadoop.io.BytesWritable} only this class is NOT resizable and DOES NOT
@@ -39,7 +37,6 @@ import org.apache.log4j.Logger;
*/
public class Value implements WritableComparable<Object> {
protected byte[] value;
- private static final Logger log = Logger.getLogger(Value.class);
/**
* Create a zero-size sequence.
@@ -142,12 +139,13 @@ public class Value implements WritableCo
return this.value.length;
}
+ @Override
public void readFields(final DataInput in) throws IOException {
this.value = new byte[in.readInt()];
in.readFully(this.value, 0, this.value.length);
}
- /** {@inheritDoc} */
+ @Override
public void write(final DataOutput out) throws IOException {
out.writeInt(this.value.length);
out.write(this.value, 0, this.value.length);
@@ -155,7 +153,6 @@ public class Value implements WritableCo
// Below methods copied from BytesWritable
- /** {@inheritDoc} */
@Override
public int hashCode() {
return WritableComparator.hashBytes(value, this.value.length);
@@ -168,6 +165,7 @@ public class Value implements WritableCo
* The other bytes writable
* @return Positive if left is bigger than right, 0 if they are equal, and negative if left is smaller than right.
*/
+ @Override
public int compareTo(Object right_obj) {
return compareTo(((Value) right_obj).get());
}
@@ -182,7 +180,6 @@ public class Value implements WritableCo
return (diff != 0) ? diff : WritableComparator.compareBytes(this.value, 0, this.value.length, that, 0, that.length);
}
- /** {@inheritDoc} */
@Override
public boolean equals(Object right_obj) {
if (right_obj instanceof byte[]) {
@@ -196,13 +193,7 @@ public class Value implements WritableCo
@Override
public String toString() {
- String retValue = "";
- try {
- retValue = new String(get(), Constants.VALUE_ENCODING);
- } catch (UnsupportedEncodingException e) {
- log.error(e.toString());
- }
- return retValue;
+ return new String(get(), Constants.UTF8);
}
/**
@@ -216,7 +207,6 @@ public class Value implements WritableCo
super(Value.class);
}
- /** {@inheritDoc} */
@Override
public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
return comparator.compare(b1, s1, l1, b2, s2, l2);
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/TableDiskUsage.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/TableDiskUsage.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/TableDiskUsage.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/TableDiskUsage.java Mon Jun 17 21:29:52 2013
@@ -36,6 +36,7 @@ import org.apache.accumulo.core.client.C
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Value;
@@ -165,7 +166,7 @@ public class TableDiskUsage {
}
for (String tableId : tablesReferenced) {
- FileStatus[] files = fs.globStatus(new Path(Constants.getTablesDir(acuConf) + "/" + tableId + "/*/*"));
+ FileStatus[] files = fs.globStatus(new Path(acuConf.get(Property.INSTANCE_DFS_DIR) + "/tables/" + tableId + "/*/*"));
for (FileStatus fileStatus : files) {
String dir = fileStatus.getPath().getParent().getName();
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/Accumulo.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/Accumulo.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/Accumulo.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/Accumulo.java Mon Jun 17 21:29:52 2013
@@ -50,9 +50,9 @@ public class Accumulo {
public static synchronized void updateAccumuloVersion(FileSystem fs) {
try {
- if (getAccumuloPersistentVersion(fs) == Constants.PREV_DATA_VERSION) {
- fs.create(new Path(ServerConstants.getDataVersionLocation() + "/" + Constants.DATA_VERSION));
- fs.delete(new Path(ServerConstants.getDataVersionLocation() + "/" + Constants.PREV_DATA_VERSION), false);
+ if (getAccumuloPersistentVersion(fs) == ServerConstants.PREV_DATA_VERSION) {
+ fs.create(new Path(ServerConstants.getDataVersionLocation() + "/" + ServerConstants.DATA_VERSION));
+ fs.delete(new Path(ServerConstants.getDataVersionLocation() + "/" + ServerConstants.PREV_DATA_VERSION), false);
}
} catch (IOException e) {
throw new RuntimeException("Unable to set accumulo version: an error occurred.", e);
@@ -123,7 +123,7 @@ public class Accumulo {
Accumulo.waitForZookeeperAndHdfs(fs);
Version codeVersion = new Version(Constants.VERSION);
- if (dataVersion != Constants.DATA_VERSION && dataVersion != Constants.PREV_DATA_VERSION) {
+ if (dataVersion != ServerConstants.DATA_VERSION && dataVersion != ServerConstants.PREV_DATA_VERSION) {
throw new RuntimeException("This version of accumulo (" + codeVersion + ") is not compatible with files stored using data version " + dataVersion);
}
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/ServerConstants.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/ServerConstants.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/ServerConstants.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/ServerConstants.java Mon Jun 17 21:29:52 2013
@@ -16,13 +16,20 @@
*/
package org.apache.accumulo.server;
+import static org.apache.accumulo.core.Constants.METADATA_TABLE_ID;
+import static org.apache.accumulo.core.Constants.ZROOT_TABLET;
+
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.hadoop.fs.Path;
-import static org.apache.accumulo.core.Constants.*;
-
public class ServerConstants {
+
+ // versions should never be negative
+ public static final Integer WIRE_VERSION = 2;
+ public static final int DATA_VERSION = 5;
+ public static final int PREV_DATA_VERSION = 4;
+
// these are functions to delay loading the Accumulo configuration unless we must
public static String getBaseDir() {
return ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_DFS_DIR);
@@ -36,6 +43,10 @@ public class ServerConstants {
return getBaseDir() + "/recovery";
}
+ public static String getWalDirectory() {
+ return getBaseDir() + "/wal";
+ }
+
public static Path getInstanceIdLocation() {
return new Path(getBaseDir() + "/instance_id");
}
@@ -48,8 +59,12 @@ public class ServerConstants {
return getTablesDir() + "/" + METADATA_TABLE_ID;
}
+ public static String getRootTableDir() {
+ return getTablesDir() + "/" + METADATA_TABLE_ID;
+ }
+
public static String getRootTabletDir() {
- return getMetadataTableDir() + ZROOT_TABLET;
+ return getRootTableDir() + ZROOT_TABLET;
}
}
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java Mon Jun 17 21:29:52 2013
@@ -38,6 +38,7 @@ import org.apache.accumulo.core.tabletse
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client;
import org.apache.accumulo.core.util.ThriftUtil;
import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.server.ServerConstants;
import org.apache.accumulo.server.security.SecurityConstants;
import org.apache.accumulo.server.util.AddressUtil;
import org.apache.accumulo.server.util.MetadataTable;
@@ -138,7 +139,7 @@ public class GarbageCollectWriteAheadLog
for (String filename : entry.getValue()) {
log.debug("Removing old-style WAL " + entry.getValue());
try {
- Path path = new Path(Constants.getWalDirectory(conf), filename);
+ Path path = new Path(ServerConstants.getWalDirectory(), filename);
if (trash == null || !trash.moveToTrash(path))
fs.delete(path, true);
status.currentLog.deleted++;
@@ -151,7 +152,7 @@ public class GarbageCollectWriteAheadLog
} else {
InetSocketAddress address = AddressUtil.parseAddress(entry.getKey());
if (!holdsLock(address)) {
- Path serverPath = new Path(Constants.getWalDirectory(conf), entry.getKey());
+ Path serverPath = new Path(ServerConstants.getWalDirectory(), entry.getKey());
for (String filename : entry.getValue()) {
log.debug("Removing WAL for offline server " + filename);
try {
@@ -183,7 +184,7 @@ public class GarbageCollectWriteAheadLog
}
}
- Path recoveryDir = new Path(Constants.getRecoveryDir(conf));
+ Path recoveryDir = new Path(ServerConstants.getRecoveryDir());
for (String sortedWALog : sortedWALogs) {
log.debug("Removing sorted WAL " + sortedWALog);
@@ -240,8 +241,7 @@ public class GarbageCollectWriteAheadLog
}
private int scanServers(Map<String,String> fileToServerMap) throws Exception {
- AccumuloConfiguration conf = instance.getConfiguration();
- Path walRoot = new Path(Constants.getWalDirectory(conf));
+ Path walRoot = new Path(ServerConstants.getWalDirectory());
for (FileStatus status : fs.listStatus(walRoot)) {
String name = status.getPath().getName();
if (status.isDir()) {
@@ -265,8 +265,7 @@ public class GarbageCollectWriteAheadLog
}
private Set<String> getSortedWALogs() throws IOException {
- AccumuloConfiguration conf = instance.getConfiguration();
- Path recoveryDir = new Path(Constants.getRecoveryDir(conf));
+ Path recoveryDir = new Path(ServerConstants.getRecoveryDir());
Set<String> sortedWALogs = new HashSet<String>();
@@ -283,10 +282,6 @@ public class GarbageCollectWriteAheadLog
return sortedWALogs;
}
- /**
- * @param name
- * @return
- */
static private boolean isUUID(String name) {
try {
UUID.fromString(name);
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java Mon Jun 17 21:29:52 2013
@@ -97,6 +97,7 @@ import org.apache.accumulo.fate.zookeepe
import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy;
import org.apache.accumulo.server.Accumulo;
+import org.apache.accumulo.server.ServerConstants;
import org.apache.accumulo.server.client.HdfsZooInstance;
import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.accumulo.server.master.LiveTServerSet.TServerConnection;
@@ -271,7 +272,7 @@ public class Master implements LiveTServ
}
private void upgradeZookeeper() {
- if (Accumulo.getAccumuloPersistentVersion(fs) == Constants.PREV_DATA_VERSION) {
+ if (Accumulo.getAccumuloPersistentVersion(fs) == ServerConstants.PREV_DATA_VERSION) {
try {
log.info("Upgrading zookeeper");
@@ -299,7 +300,7 @@ public class Master implements LiveTServ
private final ServerConfiguration serverConfig;
private void upgradeMetadata() {
- if (Accumulo.getAccumuloPersistentVersion(fs) == Constants.PREV_DATA_VERSION) {
+ if (Accumulo.getAccumuloPersistentVersion(fs) == ServerConstants.PREV_DATA_VERSION) {
if (upgradeMetadataRunning.compareAndSet(false, true)) {
Runnable upgradeTask = new Runnable() {
@Override
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoveryManager.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoveryManager.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoveryManager.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoveryManager.java Mon Jun 17 21:29:52 2013
@@ -34,6 +34,7 @@ import org.apache.accumulo.core.conf.Pro
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.util.NamingThreadFactory;
import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.server.ServerConstants;
import org.apache.accumulo.server.master.Master;
import org.apache.accumulo.server.trace.TraceFileSystem;
import org.apache.accumulo.server.zookeeper.DistributedWorkQueue;
@@ -65,7 +66,7 @@ public class RecoveryManager {
log.warn(e, e);
}
}
-
+
private class LogSortTask implements Runnable {
private String filename;
private String host;
@@ -76,7 +77,7 @@ public class RecoveryManager {
this.host = host;
this.filename = filename;
}
-
+
@Override
public void run() {
boolean rescheduled = false;
@@ -84,9 +85,9 @@ public class RecoveryManager {
FileSystem localFs = master.getFileSystem();
if (localFs instanceof TraceFileSystem)
localFs = ((TraceFileSystem) localFs).getImplementation();
-
+
long time = closer.close(master, localFs, getSource(host, filename));
-
+
if (time > 0) {
executor.schedule(this, time, TimeUnit.MILLISECONDS);
rescheduled = true;
@@ -115,20 +116,20 @@ public class RecoveryManager {
synchronized (this) {
sortsQueued.add(file);
}
-
+
final String path = ZooUtil.getRoot(master.getInstance()) + Constants.ZRECOVERY + "/" + file;
log.info("Created zookeeper entry " + path + " with data " + source);
}
private Path getSource(String server, String file) {
- String source = Constants.getWalDirectory(master.getSystemConfiguration()) + "/" + server + "/" + file;
+ String source = ServerConstants.getWalDirectory() + "/" + server + "/" + file;
if (server.contains(":")) {
// old-style logger log, copied from local file systems by tservers, unsorted into the wal base dir
- source = Constants.getWalDirectory(master.getSystemConfiguration()) + "/" + file;
+ source = ServerConstants.getWalDirectory() + "/" + file;
}
return new Path(source);
}
-
+
public boolean recoverLogs(KeyExtent extent, Collection<Collection<String>> walogs) throws IOException {
boolean recoveryNeeded = false;
for (Collection<String> logs : walogs) {
@@ -147,8 +148,8 @@ public class RecoveryManager {
sortsQueued.remove(filename);
}
}
-
- if (master.getFileSystem().exists(new Path(Constants.getRecoveryDir(master.getSystemConfiguration()) + "/" + filename + "/finished"))) {
+
+ if (master.getFileSystem().exists(new Path(ServerConstants.getRecoveryDir() + "/" + filename + "/finished"))) {
synchronized (this) {
closeTasksQueued.remove(filename);
recoveryDelay.remove(filename);
@@ -161,17 +162,16 @@ public class RecoveryManager {
synchronized (this) {
if (!closeTasksQueued.contains(filename) && !sortsQueued.contains(filename)) {
AccumuloConfiguration aconf = master.getConfiguration().getConfiguration();
- LogCloser closer = Master.createInstanceFromPropertyName(aconf, Property.MASTER_WALOG_CLOSER_IMPLEMETATION, LogCloser.class,
- new HadoopLogCloser());
+ LogCloser closer = Master.createInstanceFromPropertyName(aconf, Property.MASTER_WALOG_CLOSER_IMPLEMETATION, LogCloser.class, new HadoopLogCloser());
Long delay = recoveryDelay.get(filename);
if (delay == null) {
delay = master.getSystemConfiguration().getTimeInMillis(Property.MASTER_RECOVERY_DELAY);
} else {
delay = Math.min(2 * delay, 1000 * 60 * 5l);
}
-
+
log.info("Starting recovery of " + filename + " (in : " + (delay / 1000) + "s) created for " + host + ", tablet " + extent + " holds a reference");
-
+
executor.schedule(new LogSortTask(closer, host, filename), delay, TimeUnit.MILLISECONDS);
closeTasksQueued.add(filename);
recoveryDelay.put(filename, delay);
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java Mon Jun 17 21:29:52 2013
@@ -161,7 +161,7 @@ class WriteExportFiles extends MasterRep
osw.append("srcZookeepers:" + conn.getInstance().getZooKeepers() + "\n");
osw.append("srcTableName:" + tableName + "\n");
osw.append("srcTableID:" + tableID + "\n");
- osw.append(ExportTable.DATA_VERSION_PROP + ":" + Constants.DATA_VERSION + "\n");
+ osw.append(ExportTable.DATA_VERSION_PROP + ":" + ServerConstants.DATA_VERSION + "\n");
osw.append("srcCodeVersion:" + Constants.VERSION + "\n");
osw.flush();
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ImportTable.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ImportTable.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ImportTable.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ImportTable.java Mon Jun 17 21:29:52 2013
@@ -570,7 +570,7 @@ public class ImportTable extends MasterR
throw new ThriftTableOperationException(null, tableInfo.tableName, TableOperation.IMPORT, TableOperationExceptionType.OTHER,
"Incompatible export version " + exportVersion);
- if (dataVersion == null || dataVersion > Constants.DATA_VERSION)
+ if (dataVersion == null || dataVersion > ServerConstants.DATA_VERSION)
throw new ThriftTableOperationException(null, tableInfo.tableName, TableOperation.IMPORT, TableOperationExceptionType.OTHER,
"Incompatible data version " + exportVersion);
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/TableRangeOp.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/TableRangeOp.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/TableRangeOp.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/TableRangeOp.java Mon Jun 17 21:29:52 2013
@@ -26,6 +26,7 @@ import org.apache.accumulo.core.client.i
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.util.TextUtil;
import org.apache.accumulo.fate.Repo;
+import org.apache.accumulo.server.ServerConstants;
import org.apache.accumulo.server.master.Master;
import org.apache.accumulo.server.master.state.MergeInfo;
import org.apache.accumulo.server.master.state.MergeInfo.Operation;
@@ -58,7 +59,7 @@ class MakeDeleteEntries extends MasterRe
log.info("creating delete entries for merged metadata tablets");
Connector conn = master.getConnector();
BatchWriter bw = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
- String tableDir = Constants.getMetadataTableDir(master.getConfiguration().getConfiguration());
+ String tableDir = ServerConstants.getMetadataTableDir();
for (FileStatus fs : master.getFileSystem().listStatus(new Path(tableDir))) {
// TODO: add the entries only if there are no !METADATA table references - ACCUMULO-1308
if (fs.isDir() && fs.getPath().getName().matches("^" + Constants.GENERATED_TABLET_DIRECTORY_PREFIX + ".*")) {
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java Mon Jun 17 21:29:52 2013
@@ -50,7 +50,8 @@ import org.apache.log4j.Logger;
*/
public class AuditedSecurityOperation extends SecurityOperation {
- public static final Logger audit = Logger.getLogger(Constants.AUDITLOG);
+ public static final String AUDITLOG = "Audit";
+ public static final Logger audit = Logger.getLogger(AUDITLOG);
public AuditedSecurityOperation(Authorizor author, Authenticator authent, PermissionHandler pm, String instanceId) {
super(author, authent, pm, instanceId);
@@ -116,9 +117,9 @@ public class AuditedSecurityOperation ex
audit.info("operation: " + prefix + "; user: " + credentials.getPrincipal() + "; " + String.format(template, args));
}
}
-
+
public static final String CAN_SCAN_AUDIT_TEMPLATE = "action: scan; targetTable: %s; authorizations: %s; range: %s; columns: %s; iterators: %s; iteratorOptions: %s;";
-
+
@Override
public boolean canScan(TCredentials credentials, String tableId, TRange range, List<TColumn> columns, List<IterInfo> ssiList,
Map<String,Map<String,String>> ssio, List<ByteBuffer> authorizations) throws ThriftSecurityException {
@@ -140,8 +141,9 @@ public class AuditedSecurityOperation ex
return super.canScan(credentials, tableId);
}
}
+
public static final String CAN_SCAN_BATCH_AUDIT_TEMPLATE = "action: scan; targetTable: %s; authorizations: %s; range: %s; columns: %s; iterators: %s; iteratorOptions: %s;";
-
+
@Override
public boolean canScan(TCredentials credentials, String tableId, Map<TKeyExtent,List<TRange>> tbatch, List<TColumn> tcolumns, List<IterInfo> ssiList,
Map<String,Map<String,String>> ssio, List<ByteBuffer> authorizations) throws ThriftSecurityException {
@@ -165,8 +167,9 @@ public class AuditedSecurityOperation ex
return super.canScan(credentials, tableId);
}
}
+
public static final String CHANGE_AUTHORIZATIONS_AUDIT_TEMPLATE = "action: changeAuthorizations; targetUser: %s; authorizations: %s";
-
+
@Override
public void changeAuthorizations(TCredentials credentials, String user, Authorizations authorizations) throws ThriftSecurityException {
try {
@@ -177,8 +180,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String CHANGE_PASSWORD_AUDIT_TEMPLATE = "action: changePassword; targetUser: %s;";
-
+
@Override
public void changePassword(TCredentials credentials, TCredentials newInfo) throws ThriftSecurityException {
try {
@@ -189,8 +193,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String CREATE_USER_AUDIT_TEMPLATE = "action: createUser; targetUser: %s; Authorizations: %s;";
-
+
@Override
public void createUser(TCredentials credentials, TCredentials newUser, Authorizations authorizations) throws ThriftSecurityException {
try {
@@ -201,8 +206,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String CAN_CREATE_TABLE_AUDIT_TEMPLATE = "action: createTable; targetTable: %s;";
-
+
@Override
public boolean canCreateTable(TCredentials c, String tableName) throws ThriftSecurityException {
try {
@@ -214,8 +220,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String CAN_DELETE_TABLE_AUDIT_TEMPLATE = "action: deleteTable; targetTable: %s;";
-
+
@Override
public boolean canDeleteTable(TCredentials c, String tableId) throws ThriftSecurityException {
String tableName = getTableName(tableId);
@@ -228,8 +235,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String CAN_RENAME_TABLE_AUDIT_TEMPLATE = "action: renameTable; targetTable: %s; newTableName: %s;";
-
+
@Override
public boolean canRenameTable(TCredentials c, String tableId, String oldTableName, String newTableName) throws ThriftSecurityException {
try {
@@ -241,8 +249,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String CAN_CLONE_TABLE_AUDIT_TEMPLATE = "action: cloneTable; targetTable: %s; newTableName: %s";
-
+
@Override
public boolean canCloneTable(TCredentials c, String tableId, String tableName) throws ThriftSecurityException {
String oldTableName = getTableName(tableId);
@@ -255,8 +264,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String CAN_DELETE_RANGE_AUDIT_TEMPLATE = "action: deleteData; targetTable: %s; startRange: %s; endRange: %s;";
-
+
@Override
public boolean canDeleteRange(TCredentials c, String tableId, String tableName, Text startRow, Text endRow) throws ThriftSecurityException {
try {
@@ -268,8 +278,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String CAN_BULK_IMPORT_AUDIT_TEMPLATE = "action: bulkImport; targetTable: %s; dataDir: %s; failDir: %s;";
-
+
@Override
public boolean canBulkImport(TCredentials c, String tableId, String tableName, String dir, String failDir) throws ThriftSecurityException {
try {
@@ -281,8 +292,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String CAN_IMPORT_AUDIT_TEMPLATE = "action: import; targetTable: %s; dataDir: %s;";
-
+
@Override
public boolean canImport(TCredentials credentials, String tableName, String importDir) throws ThriftSecurityException {
@@ -295,8 +307,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String CAN_EXPORT_AUDIT_TEMPLATE = "action: export; targetTable: %s; dataDir: %s;";
-
+
@Override
public boolean canExport(TCredentials credentials, String tableId, String tableName, String exportDir) throws ThriftSecurityException {
@@ -309,8 +322,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String DROP_USER_AUDIT_TEMPLATE = "action: dropUser; targetUser: %s;";
-
+
@Override
public void dropUser(TCredentials credentials, String user) throws ThriftSecurityException {
try {
@@ -321,8 +335,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String GRANT_SYSTEM_PERMISSION_AUDIT_TEMPLATE = "action: grantSystemPermission; permission: %s; targetUser: %s;";
-
+
@Override
public void grantSystemPermission(TCredentials credentials, String user, SystemPermission permission) throws ThriftSecurityException {
try {
@@ -333,8 +348,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String GRANT_TABLE_PERMISSION_AUDIT_TEMPLATE = "action: grantTablePermission; permission: %s; targetTable: %s; targetUser: %s;";
-
+
@Override
public void grantTablePermission(TCredentials credentials, String user, String tableId, TablePermission permission) throws ThriftSecurityException {
String tableName = getTableName(tableId);
@@ -346,8 +362,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String REVOKE_SYSTEM_PERMISSION_AUDIT_TEMPLATE = "action: revokeSystemPermission; permission: %s; targetUser: %s;";
-
+
@Override
public void revokeSystemPermission(TCredentials credentials, String user, SystemPermission permission) throws ThriftSecurityException {
@@ -359,8 +376,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String REVOKE_TABLE_PERMISSION_AUDIT_TEMPLATE = "action: revokeTablePermission; permission: %s; targetTable: %s; targetUser: %s;";
-
+
@Override
public void revokeTablePermission(TCredentials credentials, String user, String tableId, TablePermission permission) throws ThriftSecurityException {
String tableName = getTableName(tableId);
@@ -372,8 +390,9 @@ public class AuditedSecurityOperation ex
throw ex;
}
}
+
public static final String CAN_ONLINE_OFFLINE_TABLE_AUDIT_TEMPLATE = "action: %s; targetTable: %s;";
-
+
@Override
public boolean canOnlineOfflineTable(TCredentials credentials, String tableId, TableOperation op) throws ThriftSecurityException {
String tableName = getTableName(tableId);
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java Mon Jun 17 21:29:52 2013
@@ -30,6 +30,7 @@ import org.apache.accumulo.core.client.s
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.security.CredentialHelper;
import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.server.ServerConstants;
import org.apache.accumulo.server.client.HdfsZooInstance;
import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.commons.codec.binary.Base64;
@@ -62,7 +63,7 @@ public class SecurityConstants {
}
private static AuthenticationToken makeSystemPassword() {
- int wireVersion = Constants.WIRE_VERSION;
+ int wireVersion = ServerConstants.WIRE_VERSION;
byte[] inst = HdfsZooInstance.getInstance().getInstanceID().getBytes(Constants.UTF8);
try {
confChecksum = getSystemConfigChecksum();
@@ -92,7 +93,7 @@ public class SecurityConstants {
// seed the config with the version and instance id, so at least
// it's not empty
- md.update(Constants.WIRE_VERSION.toString().getBytes(Constants.UTF8));
+ md.update(ServerConstants.WIRE_VERSION.toString().getBytes(Constants.UTF8));
md.update(HdfsZooInstance.getInstance().getInstanceID().getBytes(Constants.UTF8));
for (Entry<String,String> entry : ServerConfiguration.getSiteConfiguration()) {
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java Mon Jun 17 21:29:52 2013
@@ -2055,7 +2055,7 @@ public class TabletServer extends Abstra
public void removeLogs(TInfo tinfo, TCredentials credentials, List<String> filenames) throws TException {
String myname = getClientAddressString();
myname = myname.replace(':', '+');
- Path logDir = new Path(Constants.getWalDirectory(acuConf), myname);
+ Path logDir = new Path(ServerConstants.getWalDirectory(), myname);
Set<String> loggers = new HashSet<String>();
logger.getLoggers(loggers);
nextFile: for (String filename : filenames) {
@@ -2078,7 +2078,7 @@ public class TabletServer extends Abstra
try {
String source = logDir + "/" + filename;
if (acuConf.getBoolean(Property.TSERV_ARCHIVE_WALOGS)) {
- String walogArchive = Constants.getBaseDir(acuConf) + "/walogArchive";
+ String walogArchive = ServerConstants.getBaseDir() + "/walogArchive";
fs.mkdirs(new Path(walogArchive));
String dest = walogArchive + "/" + filename;
log.info("Archiving walog " + source + " to " + dest);
@@ -2090,7 +2090,7 @@ public class TabletServer extends Abstra
Path sourcePath = new Path(source);
if (!trash.moveToTrash(sourcePath) && !fs.delete(sourcePath, true))
log.warn("Failed to delete walog " + source);
- Path recoveryPath = new Path(Constants.getRecoveryDir(acuConf), filename);
+ Path recoveryPath = new Path(ServerConstants.getRecoveryDir(), filename);
try {
if (trash.moveToTrash(recoveryPath) || fs.delete(recoveryPath, true))
log.info("Deleted any recovery log " + filename);
@@ -3295,9 +3295,9 @@ public class TabletServer extends Abstra
}
LogFileKey key = new LogFileKey();
LogFileValue value = new LogFileValue();
- log.info("Openning local log " + file.getPath());
+ log.info("Opening local log " + file.getPath());
Reader reader = new SequenceFile.Reader(localfs, file.getPath(), localfs.getConf());
- Path tmp = new Path(Constants.getWalDirectory(conf) + "/" + name + ".copy");
+ Path tmp = new Path(ServerConstants.getWalDirectory() + "/" + name + ".copy");
FSDataOutputStream writer = fs.create(tmp);
while (reader.next(key, value)) {
try {
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java Mon Jun 17 21:29:52 2013
@@ -37,13 +37,13 @@ import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.util.Daemon;
import org.apache.accumulo.core.util.StringUtil;
+import org.apache.accumulo.server.ServerConstants;
import org.apache.accumulo.server.logger.LogFileKey;
import org.apache.accumulo.server.logger.LogFileValue;
import org.apache.accumulo.server.master.state.TServerInstance;
@@ -210,7 +210,7 @@ public class DfsLogger {
public DfsLogger(ServerResources conf, String logger, String filename) throws IOException {
this.conf = conf;
this.logger = logger;
- this.logPath = new Path(Constants.getWalDirectory(conf.getConfiguration()), filename);
+ this.logPath = new Path(ServerConstants.getWalDirectory(), filename);
}
public static FSDataInputStream readHeader(FileSystem fs, Path path, Map<String,String> opts) throws IOException {
@@ -243,7 +243,7 @@ public class DfsLogger {
log.debug("DfsLogger.open() begin");
- logPath = new Path(Constants.getWalDirectory(conf.getConfiguration()) + "/" + logger + "/" + filename);
+ logPath = new Path(ServerConstants.getWalDirectory() + "/" + logger + "/" + filename);
try {
FileSystem fs = conf.getFileSystem();
short replication = (short) conf.getConfiguration().getCount(Property.TSERV_WAL_REPLICATION);
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/LogSorter.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/LogSorter.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/LogSorter.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/LogSorter.java Mon Jun 17 21:29:52 2013
@@ -37,6 +37,7 @@ import org.apache.accumulo.core.master.t
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.core.util.SimpleThreadPool;
import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.server.ServerConstants;
import org.apache.accumulo.server.logger.LogFileKey;
import org.apache.accumulo.server.logger.LogFileValue;
import org.apache.accumulo.server.zookeeper.DistributedWorkQueue;
@@ -74,7 +75,7 @@ public class LogSorter {
@Override
public void process(String child, byte[] data) {
- String dest = Constants.getRecoveryDir(conf) + "/" + child;
+ String dest = ServerConstants.getRecoveryDir() + "/" + child;
String src = new String(data);
String name = new Path(src).getName();
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Initialize.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Initialize.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Initialize.java Mon Jun 17 21:29:52 2013
@@ -209,7 +209,7 @@ public class Initialize {
final Path metadataTableDir = new Path(ServerConstants.getMetadataTableDir());
- fs.mkdirs(new Path(ServerConstants.getDataVersionLocation(), "" + Constants.DATA_VERSION));
+ fs.mkdirs(new Path(ServerConstants.getDataVersionLocation(), "" + ServerConstants.DATA_VERSION));
// create an instance id
fs.mkdirs(ServerConstants.getInstanceIdLocation());
@@ -250,7 +250,7 @@ public class Initialize {
// populate the root tablet with info about the default tablet
// the root tablet contains the key extent and locations of all the
// metadata tablets
- String initRootTabFile = ServerConstants.getMetadataTableDir() + "/root_tablet/00000_00000."
+ String initRootTabFile = ServerConstants.getRootTabletDir() + "/00000_00000."
+ FileOperations.getNewFileExtension(AccumuloConfiguration.getDefaultConfiguration());
FileSKVWriter mfw = FileOperations.getInstance().openWriter(initRootTabFile, fs, conf, AccumuloConfiguration.getDefaultConfiguration());
mfw.startDefaultLocalityGroup();
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/ZooKeeperMain.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/ZooKeeperMain.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/ZooKeeperMain.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/ZooKeeperMain.java Mon Jun 17 21:29:52 2013
@@ -16,12 +16,11 @@
*/
package org.apache.accumulo.server.util;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.Help;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.util.CachedConfiguration;
+import org.apache.accumulo.server.ServerConstants;
import org.apache.accumulo.server.client.HdfsZooInstance;
-import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
@@ -42,7 +41,7 @@ public class ZooKeeperMain {
Opts opts = new Opts();
opts.parseArgs(ZooKeeperMain.class.getName(), args);
FileSystem fs = FileSystem.get(CachedConfiguration.getInstance());
- String baseDir = Constants.getBaseDir(ServerConfiguration.getSiteConfiguration());
+ String baseDir = ServerConstants.getBaseDir();
System.out.println("Using " + fs.makeQualified(new Path(baseDir + "/instance_id")) + " to lookup accumulo instance");
Instance instance = HdfsZooInstance.getInstance();
if (opts.servers == null) {
@@ -50,7 +49,7 @@ public class ZooKeeperMain {
}
System.out.println("The accumulo instance id is " + instance.getInstanceID());
if (!opts.servers.contains("/"))
- opts.servers += "/accumulo/"+instance.getInstanceID();
- org.apache.zookeeper.ZooKeeperMain.main(new String[]{"-server", opts.servers, "-timeout", "" + (opts.timeout * 1000)});
+ opts.servers += "/accumulo/" + instance.getInstanceID();
+ org.apache.zookeeper.ZooKeeperMain.main(new String[] {"-server", opts.servers, "-timeout", "" + (opts.timeout * 1000)});
}
}
Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/AuditMessageTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/AuditMessageTest.java?rev=1493947&r1=1493946&r2=1493947&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/AuditMessageTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/AuditMessageTest.java Mon Jun 17 21:29:52 2013
@@ -21,11 +21,22 @@ import static org.junit.Assert.assertTru
import java.io.File;
import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
-import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.client.*;
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.BatchScanner;
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.TableExistsException;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
@@ -66,8 +77,7 @@ public class AuditMessageTest {
private final String THIRD_TEST_TABLE_NAME = "pears";
private final Authorizations auths = new Authorizations("private", "public");
private static TemporaryFolder folder = new TemporaryFolder();
-
-
+
// Must be static to survive Junit re-initialising the class every time.
private static String lastAuditTimestamp;
private Connector auditConnector;
@@ -93,7 +103,6 @@ public class AuditMessageTest {
logWriters = accumulo.getLogWriters();
}
-
/**
* Returns a List of Audit messages that have been grep'd out of the MiniAccumuloCluster output.
*
@@ -118,7 +127,7 @@ public class AuditMessageTest {
try {
while (it.hasNext()) {
String line = it.nextLine();
- if (line.matches(".* \\[" + Constants.AUDITLOG + "\\s*\\].*")) {
+ if (line.matches(".* \\[" + AuditedSecurityOperation.AUDITLOG + "\\s*\\].*")) {
// Only include the message if startTimestamp is null. or the message occurred after the startTimestamp value
if ((lastAuditTimestamp == null) || (line.substring(0, 23).compareTo(lastAuditTimestamp) > 0))
result.add(line);
@@ -406,7 +415,8 @@ public class AuditMessageTest {
auditConnector.tableOperations().rename(OLD_TEST_TABLE_NAME, NEW_TEST_TABLE_NAME);
} catch (AccumuloSecurityException ex) {}
try {
- auditConnector.tableOperations().clone(OLD_TEST_TABLE_NAME, NEW_TEST_TABLE_NAME, true, Collections.<String,String>emptyMap(), Collections.<String>emptySet());
+ auditConnector.tableOperations().clone(OLD_TEST_TABLE_NAME, NEW_TEST_TABLE_NAME, true, Collections.<String,String> emptyMap(),
+ Collections.<String> emptySet());
} catch (AccumuloSecurityException ex) {}
try {
auditConnector.tableOperations().delete(OLD_TEST_TABLE_NAME);
@@ -480,11 +490,11 @@ public class AuditMessageTest {
assertEquals(1, findAuditMessage(auditMessages, String.format(AuditedSecurityOperation.CREATE_USER_AUDIT_TEMPLATE, "root", "")).size());
}
-
+
@AfterClass
public static void tearDownMiniCluster() throws Exception {
accumulo.stop();
-
+
// Comment this out to have a look at the logs, they will be in /tmp/junit*
folder.delete();
}