You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by vi...@apache.org on 2011/10/27 17:25:17 UTC
svn commit: r1189806 [41/46] - in /incubator/accumulo: branches/1.3/contrib/
branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/
branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/admin/
branches/1.3/src/core/src/main/...
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/PercentageType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/PercentageType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/PercentageType.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/PercentageType.java Thu Oct 27 15:24:51 2011
@@ -30,7 +30,8 @@ public class PercentageType extends Cell
@Override
public String format(Object obj) {
- if (obj == null) return "-";
+ if (obj == null)
+ return "-";
return String.format("%.0f%s", 100 * (Double) obj, "%");
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/ProgressChartType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/ProgressChartType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/ProgressChartType.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/ProgressChartType.java Thu Oct 27 15:24:51 2011
@@ -30,7 +30,8 @@ public class ProgressChartType extends N
@Override
public String format(Object obj) {
- if (obj == null) return "-";
+ if (obj == null)
+ return "-";
Double num = (Double) obj;
return getChart(num, max);
}
@@ -38,12 +39,16 @@ public class ProgressChartType extends N
public static String getChart(double num, double total) {
StringBuilder result = new StringBuilder();
double percent = 0;
- if (total != 0) percent = (num / total) * 100;
+ if (total != 0)
+ percent = (num / total) * 100;
int width = 0;
- if (percent < 1) width = 0;
- else if (percent > 100) width = 100;
- else width = (int) percent;
+ if (percent < 1)
+ width = 0;
+ else if (percent > 100)
+ width = 100;
+ else
+ width = (int) percent;
result.append("<div class='progress-chart'>");
result.append("<div style='width: ").append(width).append("%;'></div>");
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/StringType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/StringType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/StringType.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/StringType.java Thu Oct 27 15:24:51 2011
@@ -24,9 +24,12 @@ public class StringType<T> extends CellT
@Override
public int compare(T o1, T o2) {
- if (o1 == null && o2 == null) return 0;
- else if (o1 == null) return -1;
- else if (o2 == null) return 1;
+ if (o1 == null && o2 == null)
+ return 0;
+ else if (o1 == null)
+ return -1;
+ else if (o2 == null)
+ return 1;
return o1.toString().compareTo(o2.toString());
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TServerLinkType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TServerLinkType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TServerLinkType.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TServerLinkType.java Thu Oct 27 15:24:51 2011
@@ -25,7 +25,8 @@ public class TServerLinkType extends Cel
@Override
public String format(Object obj) {
- if (obj == null) return "-";
+ if (obj == null)
+ return "-";
TabletServerStatus status = (TabletServerStatus) obj;
return String.format("<a href='/tservers?s=%s'>%s</a>", status.name, displayName(status));
}
@@ -35,7 +36,8 @@ public class TServerLinkType extends Cel
}
public static String displayName(String address) {
- if (address == null) return "--Unknown--";
+ if (address == null)
+ return "--Unknown--";
InetSocketAddress inetAddress = AddressUtil.parseAddress(address, 0);
return inetAddress.getHostName() + ":" + inetAddress.getPort();
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableLinkType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableLinkType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableLinkType.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableLinkType.java Thu Oct 27 15:24:51 2011
@@ -31,13 +31,15 @@ public class TableLinkType extends CellT
@Override
public String format(Object obj) {
- if (obj == null) return "-";
+ if (obj == null)
+ return "-";
String tableId = (String) obj;
return String.format("<a href='/tables?t=%s'>%s</a>", tableId, displayName(tableId));
}
private String displayName(String tableId) {
- if (tableId == null) return "-";
+ if (tableId == null)
+ return "-";
return Tables.getPrintableTableNameFromId(tidToNameMap, tableId);
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableStateType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableStateType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableStateType.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableStateType.java Thu Oct 27 15:24:51 2011
@@ -47,8 +47,10 @@ public class TableStateType extends Cell
@Override
public int compare(TableState o1, TableState o2) {
- if (o1 == null && o2 == null) return 0;
- else if (o1 == null) return -1;
+ if (o1 == null && o2 == null)
+ return 0;
+ else if (o1 == null)
+ return -1;
return o1.compareTo(o2);
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java Thu Oct 27 15:24:51 2011
@@ -170,7 +170,8 @@ public class ProblemReports implements I
delMut.putDelete(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier());
}
- if (hasProblems) MetadataTable.getMetadataTable(SecurityConstants.getSystemCredentials()).update(delMut);
+ if (hasProblems)
+ MetadataTable.getMetadataTable(SecurityConstants.getSystemCredentials()).update(delMut);
}
public Iterator<ProblemReport> iterator(final String table) {
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java Thu Oct 27 15:24:51 2011
@@ -85,7 +85,8 @@ public class SecurityConstants {
* @return RESERVED if the passwords match, otherwise a state that describes the failure state
*/
public static TabletServerState compareSystemPassword(byte[] base64encodedPassword) {
- if (Arrays.equals(SYSTEM_PASSWORD, base64encodedPassword)) return TabletServerState.RESERVED;
+ if (Arrays.equals(SYSTEM_PASSWORD, base64encodedPassword))
+ return TabletServerState.RESERVED;
// parse to determine why
byte[] decodedPassword = Base64.decodeBase64(base64encodedPassword);
@@ -103,7 +104,8 @@ public class SecurityConstants {
buff = new byte[in.readInt()];
in.readFully(buff);
confFails = !Arrays.equals(buff, getSystemConfigChecksum());
- if (in.available() > 0) throw new IOException();
+ if (in.available() > 0)
+ throw new IOException();
} catch (IOException e) {
return TabletServerState.BAD_SYSTEM_PASSWORD;
} catch (NoSuchAlgorithmException e) {
@@ -114,10 +116,12 @@ public class SecurityConstants {
// nested ternary conditionals, but
// this is more readable; no fun :/
if (versionFails) {
- if (instanceFails) return confFails ? TabletServerState.BAD_VERSION_AND_INSTANCE_AND_CONFIG : TabletServerState.BAD_VERSION_AND_INSTANCE;
+ if (instanceFails)
+ return confFails ? TabletServerState.BAD_VERSION_AND_INSTANCE_AND_CONFIG : TabletServerState.BAD_VERSION_AND_INSTANCE;
return confFails ? TabletServerState.BAD_VERSION_AND_CONFIG : TabletServerState.BAD_VERSION;
}
- if (instanceFails) return confFails ? TabletServerState.BAD_INSTANCE_AND_CONFIG : TabletServerState.BAD_INSTANCE;
+ if (instanceFails)
+ return confFails ? TabletServerState.BAD_INSTANCE_AND_CONFIG : TabletServerState.BAD_INSTANCE;
return confFails ? TabletServerState.BAD_CONFIG : TabletServerState.BAD_SYSTEM_PASSWORD;
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java Thu Oct 27 15:24:51 2011
@@ -65,7 +65,8 @@ public final class ZKAuthenticator imple
private final ZooCache zooCache;
public static synchronized Authenticator getInstance() {
- if (zkAuthenticatorInstance == null) zkAuthenticatorInstance = new Auditor(new ZKAuthenticator());
+ if (zkAuthenticatorInstance == null)
+ zkAuthenticatorInstance = new Auditor(new ZKAuthenticator());
return zkAuthenticatorInstance;
}
@@ -85,10 +86,11 @@ public final class ZKAuthenticator imple
* @throws AccumuloSecurityException
*/
private boolean authenticate(AuthInfo credentials) throws AccumuloSecurityException {
- if (!credentials.instanceId.equals(HdfsZooInstance.getInstance().getInstanceID())) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.INVALID_INSTANCEID);
+ if (!credentials.instanceId.equals(HdfsZooInstance.getInstance().getInstanceID()))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.INVALID_INSTANCEID);
- if (credentials.user.equals(SecurityConstants.SYSTEM_USERNAME)) return credentials.equals(SecurityConstants.getSystemCredentials());
+ if (credentials.user.equals(SecurityConstants.SYSTEM_USERNAME))
+ return credentials.equals(SecurityConstants.getSystemCredentials());
byte[] pass;
String zpath = ZKUserPath + "/" + credentials.user;
@@ -106,8 +108,8 @@ public final class ZKAuthenticator imple
* Only SYSTEM user can call this method
*/
public void initializeSecurity(AuthInfo credentials, String rootuser, byte[] rootpass) throws AccumuloSecurityException {
- if (!credentials.user.equals(SecurityConstants.SYSTEM_USERNAME) || !authenticate(credentials)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (!credentials.user.equals(SecurityConstants.SYSTEM_USERNAME) || !authenticate(credentials))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
try {
// remove old settings from zookeeper first, if any
@@ -173,14 +175,16 @@ public final class ZKAuthenticator imple
}
public synchronized String getRootUsername() {
- if (rootUserName == null) rootUserName = new String(zooCache.get(ZKUserPath));
+ if (rootUserName == null)
+ rootUserName = new String(zooCache.get(ZKUserPath));
return rootUserName;
}
public boolean authenticateUser(AuthInfo credentials, String user, ByteBuffer pass) throws AccumuloSecurityException {
- if (!authenticate(credentials)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
- if (!credentials.user.equals(user) && !hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM)) throw new AccumuloSecurityException(
- credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+ if (!authenticate(credentials))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
+ if (!credentials.user.equals(user) && !hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
return authenticate(new AuthInfo(user, pass, credentials.instanceId));
}
@@ -191,7 +195,8 @@ public final class ZKAuthenticator imple
@Override
public Set<String> listUsers(AuthInfo credentials) throws AccumuloSecurityException {
- if (!authenticate(credentials)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
+ if (!authenticate(credentials))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
return new TreeSet<String>(zooCache.getChildren(ZKUserPath));
}
@@ -200,18 +205,20 @@ public final class ZKAuthenticator imple
* Creates a user with no permissions whatsoever
*/
public void createUser(AuthInfo credentials, String user, byte[] pass, Authorizations authorizations) throws AccumuloSecurityException {
- if (!hasSystemPermission(credentials, credentials.user, SystemPermission.CREATE_USER)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (!hasSystemPermission(credentials, credentials.user, SystemPermission.CREATE_USER))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// don't allow creating a user with the same name as system user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) throw new AccumuloSecurityException(user, SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ throw new AccumuloSecurityException(user, SecurityErrorCode.PERMISSION_DENIED);
try {
constructUser(user, Tool.createPass(pass), new TreeSet<SystemPermission>(), new HashMap<String,Set<TablePermission>>(), authorizations);
log.info("Created user " + user + " at the request of user " + credentials.user);
} catch (KeeperException e) {
log.error(e, e);
- if (e.code().equals(KeeperException.Code.NODEEXISTS)) throw new AccumuloSecurityException(user, SecurityErrorCode.USER_EXISTS, e);
+ if (e.code().equals(KeeperException.Code.NODEEXISTS))
+ throw new AccumuloSecurityException(user, SecurityErrorCode.USER_EXISTS, e);
throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
} catch (InterruptedException e) {
log.error(e, e);
@@ -223,12 +230,12 @@ public final class ZKAuthenticator imple
}
public void dropUser(AuthInfo credentials, String user) throws AccumuloSecurityException {
- if (!hasSystemPermission(credentials, credentials.user, SystemPermission.DROP_USER)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (!hasSystemPermission(credentials, credentials.user, SystemPermission.DROP_USER))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// can't delete root or system users
- if (user.equals(getRootUsername()) || user.equals(SecurityConstants.SYSTEM_USERNAME)) throw new AccumuloSecurityException(user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(getRootUsername()) || user.equals(SecurityConstants.SYSTEM_USERNAME))
+ throw new AccumuloSecurityException(user, SecurityErrorCode.PERMISSION_DENIED);
try {
synchronized (zooCache) {
@@ -241,17 +248,19 @@ public final class ZKAuthenticator imple
throw new RuntimeException(e);
} catch (KeeperException e) {
log.error(e, e);
- if (e.code().equals(KeeperException.Code.NONODE)) throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST, e);
+ if (e.code().equals(KeeperException.Code.NONODE))
+ throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST, e);
throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
}
}
public void changePassword(AuthInfo credentials, String user, byte[] pass) throws AccumuloSecurityException {
- if (!hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER) && !credentials.user.equals(user)) throw new AccumuloSecurityException(
- credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+ if (!hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER) && !credentials.user.equals(user))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// can't modify system user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) throw new AccumuloSecurityException(user, SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ throw new AccumuloSecurityException(user, SecurityErrorCode.PERMISSION_DENIED);
if (userExists(user)) {
try {
@@ -270,24 +279,27 @@ public final class ZKAuthenticator imple
log.error(e, e);
throw new AccumuloSecurityException(user, SecurityErrorCode.DEFAULT_SECURITY_ERROR, e);
}
- } else throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
+ } else
+ throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
}
/**
* Checks if a user exists
*/
private boolean userExists(String user) {
- if (zooCache.get(ZKUserPath + "/" + user) != null) return true;
+ if (zooCache.get(ZKUserPath + "/" + user) != null)
+ return true;
zooCache.clear(ZKUserPath + "/" + user);
return zooCache.get(ZKUserPath + "/" + user) != null;
}
public void changeAuthorizations(AuthInfo credentials, String user, Authorizations authorizations) throws AccumuloSecurityException {
- if (!hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (!hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// can't modify system user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
if (userExists(user)) {
try {
@@ -304,17 +316,20 @@ public final class ZKAuthenticator imple
log.error(e, e);
throw new RuntimeException(e);
}
- } else throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
+ } else
+ throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
}
public Authorizations getUserAuthorizations(AuthInfo credentials, String user) throws AccumuloSecurityException {
- if (!hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM) && !credentials.user.equals(user)) throw new AccumuloSecurityException(
- credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+ if (!hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM) && !credentials.user.equals(user))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// system user doesn't need record-level authorizations for the tables it reads (for now)
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) return Constants.NO_AUTHS;
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ return Constants.NO_AUTHS;
- if (userExists(user)) return Tool.convertAuthorizations(zooCache.get(ZKUserPath + "/" + user + ZKUserAuths));
+ if (userExists(user))
+ return Tool.convertAuthorizations(zooCache.get(ZKUserPath + "/" + user + ZKUserAuths));
throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
}
@@ -325,20 +340,23 @@ public final class ZKAuthenticator imple
*/
@Override
public boolean hasSystemPermission(AuthInfo credentials, String user, SystemPermission permission) throws AccumuloSecurityException {
- if (!authenticate(credentials)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
+ if (!authenticate(credentials))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
// some people just aren't allowed to ask about other users; here are those who can ask
if (!credentials.user.equals(user) && !hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM)
&& !hasSystemPermission(credentials, credentials.user, SystemPermission.CREATE_USER)
&& !hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER)
- && !hasSystemPermission(credentials, credentials.user, SystemPermission.DROP_USER)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ && !hasSystemPermission(credentials, credentials.user, SystemPermission.DROP_USER))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
- if (user.equals(getRootUsername()) || user.equals(SecurityConstants.SYSTEM_USERNAME)) return true;
+ if (user.equals(getRootUsername()) || user.equals(SecurityConstants.SYSTEM_USERNAME))
+ return true;
byte[] perms = zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms);
if (perms != null) {
- if (Tool.convertSystemPermissions(perms).contains(permission)) return true;
+ if (Tool.convertSystemPermissions(perms).contains(permission))
+ return true;
zooCache.clear(ZKUserPath + "/" + user + ZKUserSysPerms);
return Tool.convertSystemPermissions(zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms)).contains(permission);
}
@@ -356,23 +374,27 @@ public final class ZKAuthenticator imple
}
private boolean _hasTablePermission(AuthInfo credentials, String user, String table, TablePermission permission) throws AccumuloSecurityException {
- if (!authenticate(credentials)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
+ if (!authenticate(credentials))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
// some people just aren't allowed to ask about other users; here are those who can ask
if (!credentials.user.equals(user) && !hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM)
&& !hasSystemPermission(credentials, credentials.user, SystemPermission.CREATE_USER)
&& !hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER)
- && !hasSystemPermission(credentials, credentials.user, SystemPermission.DROP_USER)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ && !hasSystemPermission(credentials, credentials.user, SystemPermission.DROP_USER))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// always allow system user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) return true;
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ return true;
// Don't let nonexistant users scan
- if (!userExists(user)) throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
-
+ if (!userExists(user))
+ throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
+
// allow anybody to read the METADATA table
- if (table.equals(Constants.METADATA_TABLE_ID) && permission.equals(TablePermission.READ)) return true;
+ if (table.equals(Constants.METADATA_TABLE_ID) && permission.equals(TablePermission.READ))
+ return true;
byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
if (serializedPerms != null) {
@@ -383,13 +405,15 @@ public final class ZKAuthenticator imple
@Override
public void grantSystemPermission(AuthInfo credentials, String user, SystemPermission permission) throws AccumuloSecurityException {
- if (!hasSystemPermission(credentials, credentials.user, SystemPermission.GRANT)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (!hasSystemPermission(credentials, credentials.user, SystemPermission.GRANT))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// can't modify system user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
- if (permission.equals(SystemPermission.GRANT)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.GRANT_INVALID);
+ if (permission.equals(SystemPermission.GRANT))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.GRANT_INVALID);
if (userExists(user)) {
Set<SystemPermission> perms = Tool.convertSystemPermissions(zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms));
@@ -409,30 +433,34 @@ public final class ZKAuthenticator imple
log.error(e, e);
throw new RuntimeException(e);
}
- } else throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
+ } else
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
}
@Override
public void grantTablePermission(AuthInfo credentials, String user, String table, TablePermission permission) throws AccumuloSecurityException {
if (!hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER)
- && !hasTablePermission(credentials, credentials.user, table, TablePermission.GRANT)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ && !hasTablePermission(credentials, credentials.user, table, TablePermission.GRANT))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// can't modify system user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
if (userExists(user)) {
Set<TablePermission> tablePerms;
byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
- if (serializedPerms != null) tablePerms = Tool.convertTablePermissions(serializedPerms);
- else tablePerms = new TreeSet<TablePermission>();
+ if (serializedPerms != null)
+ tablePerms = Tool.convertTablePermissions(serializedPerms);
+ else
+ tablePerms = new TreeSet<TablePermission>();
try {
if (tablePerms.add(permission)) {
synchronized (zooCache) {
zooCache.clear();
- ZooReaderWriter.getRetryingInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, Tool.convertTablePermissions(tablePerms),
- NodeExistsPolicy.OVERWRITE);
+ ZooReaderWriter.getRetryingInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
+ Tool.convertTablePermissions(tablePerms), NodeExistsPolicy.OVERWRITE);
}
}
log.info("Granted table permission " + permission + " for user " + user + " on the table " + table + " at the request of user " + credentials.user);
@@ -443,19 +471,21 @@ public final class ZKAuthenticator imple
log.error(e, e);
throw new RuntimeException(e);
}
- } else throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
+ } else
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
}
@Override
public void revokeSystemPermission(AuthInfo credentials, String user, SystemPermission permission) throws AccumuloSecurityException {
- if (!hasSystemPermission(credentials, credentials.user, SystemPermission.GRANT)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (!hasSystemPermission(credentials, credentials.user, SystemPermission.GRANT))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// can't modify system user or revoke permissions from root user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME) || user.equals(getRootUsername())) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME) || user.equals(getRootUsername()))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
- if (permission.equals(SystemPermission.GRANT)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.GRANT_INVALID);
+ if (permission.equals(SystemPermission.GRANT))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.GRANT_INVALID);
if (userExists(user)) {
Set<SystemPermission> sysPerms = Tool.convertSystemPermissions(zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms));
@@ -475,30 +505,35 @@ public final class ZKAuthenticator imple
log.error(e, e);
throw new RuntimeException(e);
}
- } else throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST);
+ } else
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST);
}
@Override
public void revokeTablePermission(AuthInfo credentials, String user, String table, TablePermission permission) throws AccumuloSecurityException {
if (!hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER)
- && !hasTablePermission(credentials, credentials.user, table, TablePermission.GRANT)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ && !hasTablePermission(credentials, credentials.user, table, TablePermission.GRANT))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// can't modify system user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
if (userExists(user)) {
byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
- if (serializedPerms == null) return;
+ if (serializedPerms == null)
+ return;
Set<TablePermission> tablePerms = Tool.convertTablePermissions(serializedPerms);
try {
if (tablePerms.remove(permission)) {
zooCache.clear();
IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
- if (tablePerms.size() == 0) zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, NodeMissingPolicy.SKIP);
- else zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, Tool.convertTablePermissions(tablePerms),
- NodeExistsPolicy.OVERWRITE);
+ if (tablePerms.size() == 0)
+ zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, NodeMissingPolicy.SKIP);
+ else
+ zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, Tool.convertTablePermissions(tablePerms),
+ NodeExistsPolicy.OVERWRITE);
}
} catch (KeeperException e) {
log.error(e, e);
@@ -508,14 +543,15 @@ public final class ZKAuthenticator imple
throw new RuntimeException(e);
}
log.info("Revoked table permission " + permission + " for user " + user + " on the table " + table + " at the request of user " + credentials.user);
- } else throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST);
+ } else
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST);
}
@Override
public void deleteTable(AuthInfo credentials, String table) throws AccumuloSecurityException {
if (!hasSystemPermission(credentials, credentials.user, SystemPermission.DROP_TABLE)
- && !hasTablePermission(credentials, credentials.user, table, TablePermission.DROP_TABLE)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ && !hasTablePermission(credentials, credentials.user, table, TablePermission.DROP_TABLE))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
try {
synchronized (zooCache) {
@@ -556,7 +592,8 @@ public final class ZKAuthenticator imple
}
public static boolean checkPass(byte[] password, byte[] zkData) {
- if (zkData == null) return false;
+ if (zkData == null)
+ return false;
byte[] salt = new byte[SALT_LENGTH];
System.arraycopy(zkData, 0, salt, 0, SALT_LENGTH);
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/CompactionQueue.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/CompactionQueue.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/CompactionQueue.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/CompactionQueue.java Thu Oct 27 15:24:51 2011
@@ -32,7 +32,8 @@ public class CompactionQueue extends Abs
@Override
public synchronized Runnable poll() {
- if (task.size() == 0) return null;
+ if (task.size() == 0)
+ return null;
Comparable min = Collections.min(task);
task.remove(min);
@@ -41,7 +42,8 @@ public class CompactionQueue extends Abs
@Override
public synchronized Runnable peek() {
- if (task.size() == 0) return null;
+ if (task.size() == 0)
+ return null;
Comparable min = Collections.min(task);
return (Runnable) min;
@@ -82,7 +84,8 @@ public class CompactionQueue extends Abs
wait(unit.toMillis(timeout));
}
- if (task.size() == 0) return null;
+ if (task.size() == 0)
+ return null;
return poll();
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java Thu Oct 27 15:24:51 2011
@@ -172,7 +172,9 @@ public class Compactor implements Callab
mfw.close();
} finally {
Path path = new Path(outputFile);
- if (!fs.delete(path, true)) if (fs.exists(path)) log.error("Unable to delete " + outputFile);
+ if (!fs.delete(path, true))
+ if (fs.exists(path))
+ log.error("Unable to delete " + outputFile);
}
}
} catch (IOException e) {
@@ -222,7 +224,8 @@ public class Compactor implements Callab
readers.clear();
- if (e instanceof IOException) throw (IOException) e;
+ if (e instanceof IOException)
+ throw (IOException) e;
throw new IOException("Failed to open map data files", e);
}
}
@@ -248,9 +251,12 @@ public class Compactor implements Callab
// if(env.getIteratorScope() )
TabletIteratorEnvironment iterEnv;
- if (env.getIteratorScope() == IteratorScope.majc) iterEnv = new TabletIteratorEnvironment(IteratorScope.majc, !propogateDeletes, acuTableConf);
- else if (env.getIteratorScope() == IteratorScope.minc) iterEnv = new TabletIteratorEnvironment(IteratorScope.minc, acuTableConf);
- else throw new IllegalArgumentException();
+ if (env.getIteratorScope() == IteratorScope.majc)
+ iterEnv = new TabletIteratorEnvironment(IteratorScope.majc, !propogateDeletes, acuTableConf);
+ else if (env.getIteratorScope() == IteratorScope.minc)
+ iterEnv = new TabletIteratorEnvironment(IteratorScope.minc, acuTableConf);
+ else
+ throw new IllegalArgumentException();
SortedKeyValueIterator<Key,Value> itr = iterEnv.getTopLevelIterator(IteratorUtil.loadIterators(env.getIteratorScope(), delIter, extent, acuTableConf,
iterEnv));
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/EncodedBinaryTreePath.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/EncodedBinaryTreePath.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/EncodedBinaryTreePath.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/EncodedBinaryTreePath.java Thu Oct 27 15:24:51 2011
@@ -136,9 +136,10 @@ public class EncodedBinaryTreePath {
sb.append('-');
- if (len % 4 > 0 || len == 0) for (int i = 0; i < 4 - (len % 4); i++) {
- sb.append('.');
- }
+ if (len % 4 > 0 || len == 0)
+ for (int i = 0; i < 4 - (len % 4); i++) {
+ sb.append('.');
+ }
int startBit = ((len - 1) / 4) * 4;
for (int i = startBit; i < len; i++) {
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/FileManager.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/FileManager.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/FileManager.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/FileManager.java Thu Oct 27 15:24:51 2011
@@ -165,7 +165,8 @@ public class FileManager {
*/
FileManager(Configuration conf, FileSystem fs, int maxOpen, BlockCache dataCache, BlockCache indexCache) {
- if (maxOpen <= 0) throw new IllegalArgumentException("maxOpen <= 0");
+ if (maxOpen <= 0)
+ throw new IllegalArgumentException("maxOpen <= 0");
this.dataCache = dataCache;
this.indexCache = indexCache;
@@ -364,11 +365,13 @@ public class FileManager {
for (FileSKVIterator reader : readers) {
String fileName = reservedReaders.remove(reader);
- if (!sawIOException) getFileList(fileName, openFiles).add(new OpenReader(fileName, reader));
+ if (!sawIOException)
+ getFileList(fileName, openFiles).add(new OpenReader(fileName, reader));
}
}
- if (sawIOException) closeReaders(readers);
+ if (sawIOException)
+ closeReaders(readers);
// decrement the semaphore
filePermits.release(readers.size());
@@ -509,7 +512,8 @@ public class FileManager {
}
synchronized void reattach() throws IOException {
- if (tabletReservedReaders.size() != 0) throw new IllegalStateException();
+ if (tabletReservedReaders.size() != 0)
+ throw new IllegalStateException();
Collection<String> files = new ArrayList<String>();
for (FileDataSource fds : dataSources)
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/InMemoryMap.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/InMemoryMap.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/InMemoryMap.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/InMemoryMap.java Thu Oct 27 15:24:51 2011
@@ -69,9 +69,13 @@ class MemKeyComparator implements Compar
int cmp = k1.compareTo(k2);
if (cmp == 0) {
- if (k1 instanceof MemKey) if (k2 instanceof MemKey) cmp = ((MemKey) k2).mutationCount - ((MemKey) k1).mutationCount;
- else cmp = 1;
- else if (k2 instanceof MemKey) cmp = -1;
+ if (k1 instanceof MemKey)
+ if (k2 instanceof MemKey)
+ cmp = ((MemKey) k2).mutationCount - ((MemKey) k1).mutationCount;
+ else
+ cmp = 1;
+ else if (k2 instanceof MemKey)
+ cmp = -1;
}
return cmp;
@@ -159,7 +163,8 @@ public class InMemoryMap {
public void put(Key key, Value value) {
bytesInMemory.addAndGet(key.getLength());
bytesInMemory.addAndGet(value.getSize());
- if (map.put(key, value) == null) size.incrementAndGet();
+ if (map.put(key, value) == null)
+ size.incrementAndGet();
}
public Value get(Key key) {
@@ -177,7 +182,8 @@ public class InMemoryMap {
}
public synchronized InterruptibleIterator skvIterator() {
- if (map == null) throw new IllegalStateException();
+ if (map == null)
+ throw new IllegalStateException();
return new SortedMapIterator(map);
}
@@ -290,7 +296,8 @@ public class InMemoryMap {
* @return bytesInMemory
*/
public synchronized long estimatedSizeInBytes() {
- if (map == null) return 0;
+ if (map == null)
+ return 0;
return map.getMemoryUsed();
}
@@ -321,13 +328,16 @@ public class InMemoryMap {
@Override
public boolean isCurrent() {
- if (switched) return true;
- else return memDumpFile == null;
+ if (switched)
+ return true;
+ else
+ return memDumpFile == null;
}
@Override
public DataSource getNewDataSource() {
- if (switched) throw new IllegalStateException();
+ if (switched)
+ throw new IllegalStateException();
if (!isCurrent()) {
switched = true;
@@ -339,18 +349,20 @@ public class InMemoryMap {
@Override
public SortedKeyValueIterator<Key,Value> iterator() throws IOException {
- if (iter == null) if (!switched) iter = map.skvIterator();
- else {
-
- Configuration conf = CachedConfiguration.getInstance();
- FileSystem fs = TraceFileSystem.wrap(FileSystem.getLocal(conf));
-
- FileSKVIterator reader = new MapFileOperations.RangeIterator(new MyMapFile.Reader(fs, memDumpFile, conf));
-
- readers.add(reader);
-
- iter = reader;
- }
+ if (iter == null)
+ if (!switched)
+ iter = map.skvIterator();
+ else {
+
+ Configuration conf = CachedConfiguration.getInstance();
+ FileSystem fs = TraceFileSystem.wrap(FileSystem.getLocal(conf));
+
+ FileSKVIterator reader = new MapFileOperations.RangeIterator(new MyMapFile.Reader(fs, memDumpFile, conf));
+
+ readers.add(reader);
+
+ iter = reader;
+ }
return iter;
}
@@ -369,7 +381,8 @@ public class InMemoryMap {
private MemoryDataSource mds;
protected SortedKeyValueIterator<Key,Value> getSource() {
- if (closed.get()) throw new IllegalStateException("Memory iterator is closed");
+ if (closed.get())
+ throw new IllegalStateException("Memory iterator is closed");
return super.getSource();
}
@@ -405,7 +418,8 @@ public class InMemoryMap {
}
private synchronized boolean switchNow() throws IOException {
- if (closed.get()) return false;
+ if (closed.get())
+ return false;
ssi.switchNow();
return true;
@@ -427,9 +441,11 @@ public class InMemoryMap {
}
public synchronized MemoryIterator skvIterator() {
- if (map == null) throw new NullPointerException();
+ if (map == null)
+ throw new NullPointerException();
- if (deleted) throw new IllegalStateException("Can not obtain iterator after map deleted");
+ if (deleted)
+ throw new IllegalStateException("Can not obtain iterator after map deleted");
int mc = mutationCount.get();
MemoryDataSource mds = new MemoryDataSource();
@@ -443,8 +459,9 @@ public class InMemoryMap {
public SortedKeyValueIterator<Key,Value> compactionIterator() {
- if (nextMutationCount.get() - 1 != mutationCount.get()) throw new IllegalStateException("Memory map in unexpected state : nextMutationCount = "
- + nextMutationCount.get() + " mutationCount = " + mutationCount.get());
+ if (nextMutationCount.get() - 1 != mutationCount.get())
+ throw new IllegalStateException("Memory map in unexpected state : nextMutationCount = " + nextMutationCount.get() + " mutationCount = "
+ + mutationCount.get());
return new ColumnFamilySkippingIterator(map.skvIterator());
}
@@ -454,7 +471,8 @@ public class InMemoryMap {
public void delete(long waitTime) {
synchronized (this) {
- if (deleted) throw new IllegalStateException("Double delete");
+ if (deleted)
+ throw new IllegalStateException("Double delete");
deleted = true;
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java Thu Oct 27 15:24:51 2011
@@ -77,8 +77,10 @@ public class LargestFirstMemoryManager i
for (TabletState ts : tablets) {
mts = ts.getMemTableSize();
mcmts = ts.getMinorCompactingMemTableSize();
- if (ts.getLastCommitTime() > 0) idleTime = ct - ts.getLastCommitTime();
- else idleTime = ct - zerotime;
+ if (ts.getLastCommitTime() > 0)
+ idleTime = ct - ts.getLastCommitTime();
+ else
+ idleTime = ct - zerotime;
ingestMemory += mts;
tml = timeMemoryLoad(mts, idleTime);
if (mcmts == 0 && mts > 0) {
@@ -89,8 +91,8 @@ public class LargestFirstMemoryManager i
largestMemTableIdleTime = idleTime;
}
Text tableId = ts.getExtent().getTableId();
- if (!mincIdleThresholds.containsKey(tableId)) mincIdleThresholds.put(tableId, ServerConfiguration.getTableConfiguration(tableId.toString())
- .getTimeInMillis(Property.TABLE_MINC_COMPACT_IDLETIME));
+ if (!mincIdleThresholds.containsKey(tableId))
+ mincIdleThresholds.put(tableId, ServerConfiguration.getTableConfiguration(tableId.toString()).getTimeInMillis(Property.TABLE_MINC_COMPACT_IDLETIME));
if (idleTime > mincIdleThresholds.get(tableId) && tml > largestIdleMemTableLoad) {
largestIdleMemTableLoad = tml;
largestIdleMemTablet = ts.getExtent();
@@ -104,7 +106,8 @@ public class LargestFirstMemoryManager i
// }
compactionMemory += mcmts;
- if (mcmts > 0) numWaitingMincs++;
+ if (mcmts > 0)
+ numWaitingMincs++;
}
if (ingestMemory + compactionMemory > maxObserved) {
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/MinorCompactor.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/MinorCompactor.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/MinorCompactor.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/MinorCompactor.java Thu Oct 27 15:24:51 2011
@@ -42,7 +42,8 @@ public class MinorCompactor extends Comp
private static final Map<String,DataFileValue> EMPTY_MAP = Collections.emptyMap();
private static Map<String,DataFileValue> toFileMap(String mergeFile, DataFileValue dfv) {
- if (mergeFile == null) return EMPTY_MAP;
+ if (mergeFile == null)
+ return EMPTY_MAP;
return Collections.singletonMap(mergeFile, dfv);
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/MutationLog.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/MutationLog.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/MutationLog.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/MutationLog.java Thu Oct 27 15:24:51 2011
@@ -41,7 +41,8 @@ public class MutationLog {
Configuration conf = CachedConfiguration.getInstance();
FileSystem fs = TraceFileSystem.wrap(FileUtil.getFileSystem(conf, ServerConfiguration.getSiteConfiguration()));
- if (!fs.exists(logfile)) logout = fs.create(logfile);
+ if (!fs.exists(logfile))
+ logout = fs.create(logfile);
}
public void log(Mutation m) throws IOException {
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/NativeMap.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/NativeMap.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/NativeMap.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/NativeMap.java Thu Oct 27 15:24:51 2011
@@ -215,19 +215,22 @@ public class NativeMap implements Iterab
end = 0;
index = 0;
- if (source.hasNext()) source.doNextPreCheck();
+ if (source.hasNext())
+ source.doNextPreCheck();
int amountRead = 0;
// as we keep filling, increase the read ahead buffer
- if (nextEntries.length < MAX_READ_AHEAD_ENTRIES) nextEntries = new Entry[Math.min(nextEntries.length * 2, MAX_READ_AHEAD_ENTRIES)];
+ if (nextEntries.length < MAX_READ_AHEAD_ENTRIES)
+ nextEntries = new Entry[Math.min(nextEntries.length * 2, MAX_READ_AHEAD_ENTRIES)];
while (source.hasNext() && end < nextEntries.length) {
Entry<Key,Value> ne = source.next();
nextEntries[end++] = ne;
amountRead += ne.getKey().getSize() + ne.getValue().getSize();
- if (amountRead > READ_AHEAD_BYTES) break;
+ if (amountRead > READ_AHEAD_BYTES)
+ break;
}
}
@@ -615,8 +618,10 @@ public class NativeMap implements Iterab
this.map = map;
this.range = new Range();
iter = map.new ConcurrentIterator();
- if (iter.hasNext()) entry = iter.next();
- else entry = null;
+ if (iter.hasNext())
+ entry = iter.next();
+ else
+ entry = null;
this.interruptFlag = interruptFlag;
}
@@ -643,18 +648,21 @@ public class NativeMap implements Iterab
@Override
public void next() throws IOException {
- if (entry == null) throw new IllegalStateException();
+ if (entry == null)
+ throw new IllegalStateException();
// checking the interrupt flag for every call to next had bad a bad performance impact
// so check it every 100th time
- if (interruptFlag != null && interruptCheckCount++ % 100 == 0 && interruptFlag.get()) throw new IterationInterruptedException();
+ if (interruptFlag != null && interruptCheckCount++ % 100 == 0 && interruptFlag.get())
+ throw new IterationInterruptedException();
if (iter.hasNext()) {
entry = iter.next();
if (range.afterEndKey(entry.getKey())) {
entry = null;
}
- } else entry = null;
+ } else
+ entry = null;
}
@@ -665,7 +673,8 @@ public class NativeMap implements Iterab
throw new IllegalArgumentException("I do not know how to filter column families");
}
- if (interruptFlag != null && interruptFlag.get()) throw new IterationInterruptedException();
+ if (interruptFlag != null && interruptFlag.get())
+ throw new IterationInterruptedException();
iter.delete();
@@ -682,7 +691,8 @@ public class NativeMap implements Iterab
if (range.afterEndKey(entry.getKey())) {
entry = null;
}
- } else entry = null;
+ } else
+ entry = null;
while (hasTop() && range.beforeStartKey(getTopKey())) {
next();
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Rate.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Rate.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Rate.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Rate.java Thu Oct 27 15:24:51 2011
@@ -32,7 +32,8 @@ public class Rate {
* the rate at which each update influences the curve; must be (0., 1.0)
*/
public Rate(double ratio) {
- if (ratio <= 0. || ratio >= 1.0) throw new IllegalArgumentException("ratio must be > 0. and < 1.0");
+ if (ratio <= 0. || ratio >= 1.0)
+ throw new IllegalArgumentException("ratio must be > 0. and < 1.0");
this.ratio = ratio;
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TLevel.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TLevel.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TLevel.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TLevel.java Thu Oct 27 15:24:51 2011
@@ -28,7 +28,8 @@ public class TLevel extends Level {
}
static public Level toLevel(int val) {
- if (val == Level.DEBUG_INT + 100) return Level.DEBUG;
+ if (val == Level.DEBUG_INT + 100)
+ return Level.DEBUG;
return Level.toLevel(val);
}