You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2014/09/05 23:17:22 UTC
[06/18] git commit: ACCUMULO-1957 rat checks, whitespace,
removed debugging log statements
ACCUMULO-1957 rat checks, whitespace, removed debugging log statements
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/f5b598e9
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/f5b598e9
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/f5b598e9
Branch: refs/heads/master
Commit: f5b598e989cd7c0b2199bb10bc0fc89ea833757a
Parents: 1a2c8d5
Author: Eric C. Newton <er...@gmail.com>
Authored: Wed Sep 3 13:41:56 2014 -0400
Committer: Eric C. Newton <er...@gmail.com>
Committed: Fri Sep 5 17:16:59 2014 -0400
----------------------------------------------------------------------
.../apache/accumulo/core/client/Durability.java | 16 ++++++++++
.../org/apache/accumulo/tserver/Mutations.java | 16 ++++++++++
.../apache/accumulo/tserver/log/DfsLogger.java | 12 ++------
.../accumulo/test/functional/DurabilityIT.java | 10 +++---
.../test/functional/SessionDurabilityIT.java | 32 +++++++++++++++-----
5 files changed, 64 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f5b598e9/core/src/main/java/org/apache/accumulo/core/client/Durability.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/Durability.java b/core/src/main/java/org/apache/accumulo/core/client/Durability.java
index e1dbf4a..6de666d 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/Durability.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/Durability.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.accumulo.core.client;
import org.apache.accumulo.core.tabletserver.thrift.TDurability;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f5b598e9/server/tserver/src/main/java/org/apache/accumulo/tserver/Mutations.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/Mutations.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/Mutations.java
index aa4ec81..5ee1952 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/Mutations.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/Mutations.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.accumulo.tserver;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f5b598e9/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
index e166a60..d374492 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
@@ -146,7 +146,6 @@ public class DfsLogger {
}
workQueue.drainTo(work);
- String durability = null;
Method durabilityMethod = null;
loop:
for (LogWork logWork : work) {
@@ -161,12 +160,10 @@ public class DfsLogger {
break;
case SYNC:
durabilityMethod = sync;
- durability = logWork.durability.toString();
break loop;
case FLUSH:
if (durabilityMethod == null) {
durabilityMethod = flush;
- durability = logWork.durability.toString();
}
break;
}
@@ -174,10 +171,7 @@ public class DfsLogger {
try {
if (durabilityMethod != null) {
- log.debug("durability method " + durability);
durabilityMethod.invoke(logFile);
- } else {
- log.debug("skipping flush/sync");
}
} catch (Exception ex) {
log.warn("Exception syncing " + ex);
@@ -534,7 +528,7 @@ public class DfsLogger {
if (durability == Durability.LOG)
return null;
-
+
synchronized (closeLock) {
// use a different lock for close check so that adding to work queue does not need
// to wait on walog I/O operations
@@ -558,9 +552,9 @@ public class DfsLogger {
LogFileValue value = new LogFileValue();
value.mutations = tabletMutations.getMutations();
data.add(new Pair<LogFileKey,LogFileValue>(key, value));
- log.debug("Durability for " + tabletMutations.getDurability() + " (ordinal) " + tabletMutations.getDurability().ordinal() + " durability " + durability + " (ordinal) " + durability.ordinal());
- if (tabletMutations.getDurability().ordinal() > durability.ordinal())
+ if (tabletMutations.getDurability().ordinal() > durability.ordinal()) {
durability = tabletMutations.getDurability();
+ }
}
return logFileData(data, durability);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f5b598e9/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java b/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java
index 11f61c7..526f962 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java
@@ -63,14 +63,14 @@ public class DurabilityIT extends ConfigurableMacIT {
tableOps.setProperty(tableNames[3], Property.TABLE_DURABILITY.getKey(), "none");
return tableNames;
}
-
+
private void cleanup(String[] tableNames) throws Exception {
Connector c = getConnector();
for (String tableName : tableNames) {
c.tableOperations().delete(tableName);
}
}
-
+
private void createTable(String tableName) throws Exception {
TableOperations tableOps = getConnector().tableOperations();
tableOps.create(tableName);
@@ -130,7 +130,7 @@ public class DurabilityIT extends ConfigurableMacIT {
assertTrue(N > readSome(tableNames[3]));
cleanup(tableNames);
}
-
+
@Test(timeout = 4 * 60 * 1000)
public void testIncreaseDurability() throws Exception {
Connector c = getConnector();
@@ -146,7 +146,7 @@ public class DurabilityIT extends ConfigurableMacIT {
restartTServer();
assertTrue(N == readSome(tableName));
}
-
+
private static Map<String, String> map(Iterable<Entry<String, String>> entries) {
Map<String, String> result = new HashMap<String,String>();
for (Entry<String,String> entry : entries) {
@@ -165,7 +165,7 @@ public class DurabilityIT extends ConfigurableMacIT {
c.tableOperations().create(tableName);
props = map(c.tableOperations().getProperties(tableName));
assertEquals("none", props.get(Property.TABLE_DURABILITY.getKey()));
-
+
}
private long readSome(String table) throws Exception {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f5b598e9/test/src/test/java/org/apache/accumulo/test/functional/SessionDurabilityIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SessionDurabilityIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SessionDurabilityIT.java
index b0d0b23..58e6007 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/SessionDurabilityIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/SessionDurabilityIT.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.accumulo.test.functional;
import static org.junit.Assert.assertEquals;
@@ -23,14 +39,14 @@ import org.apache.hadoop.fs.RawLocalFileSystem;
import org.junit.Test;
public class SessionDurabilityIT extends ConfigurableMacIT {
-
+
@Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setNumTservers(1);
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "5s");
}
-
+
@Test(timeout = 3 * 60 * 1000)
public void nondurableTableHasDurableWrites() throws Exception {
Connector c = getConnector();
@@ -47,7 +63,7 @@ public class SessionDurabilityIT extends ConfigurableMacIT {
restartTServer();
assertEquals(10, count(tableName));
}
-
+
@Test(timeout = 3 * 60 * 1000)
public void durableTableLosesNonDurableWrites() throws Exception {
Connector c = getConnector();
@@ -63,7 +79,7 @@ public class SessionDurabilityIT extends ConfigurableMacIT {
restartTServer();
assertTrue(10 > count(tableName));
}
-
+
private int count(String tableName) throws Exception {
return FunctionalTestUtils.count(getConnector().createScanner(tableName, Authorizations.EMPTY));
}
@@ -78,7 +94,7 @@ public class SessionDurabilityIT extends ConfigurableMacIT {
}
bw.close();
}
-
+
@Test(timeout = 3 * 60 * 1000)
public void testConditionDurability() throws Exception {
Connector c = getConnector();
@@ -96,7 +112,7 @@ public class SessionDurabilityIT extends ConfigurableMacIT {
restartTServer();
assertEquals(0, count(tableName));
}
-
+
@Test(timeout = 3 * 60 * 1000)
public void testConditionDurability2() throws Exception {
Connector c = getConnector();
@@ -114,7 +130,7 @@ public class SessionDurabilityIT extends ConfigurableMacIT {
restartTServer();
assertEquals(10, count(tableName));
}
-
+
private void conditionWriteSome(String tableName, int n, ConditionalWriterConfig cfg) throws Exception {
Connector c = getConnector();
ConditionalWriter cw = c.createConditionalWriter(tableName, cfg);
@@ -124,7 +140,7 @@ public class SessionDurabilityIT extends ConfigurableMacIT {
assertEquals(Status.ACCEPTED, cw.write(m).getStatus());
}
}
-
+
private void restartTServer() throws Exception {
for (ProcessReference proc : cluster.getProcesses().get(ServerType.TABLET_SERVER)) {
cluster.killProcess(ServerType.TABLET_SERVER, proc);