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/08/07 17:17:44 UTC
git commit: ACCUMULO-3010 include a test to ensure recovery doesn't
do a merge
Repository: accumulo
Updated Branches:
refs/heads/1.6.1-SNAPSHOT 20aecf7d6 -> 1b49f44d1
ACCUMULO-3010 include a test to ensure recovery doesn't do a merge
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1b49f44d
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1b49f44d
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1b49f44d
Branch: refs/heads/1.6.1-SNAPSHOT
Commit: 1b49f44d1ce993c720a367dcd71ce344c6d2a8c1
Parents: 20aecf7
Author: Eric C. Newton <er...@gmail.com>
Authored: Thu Aug 7 11:17:15 2014 -0400
Committer: Eric C. Newton <er...@gmail.com>
Committed: Thu Aug 7 11:17:40 2014 -0400
----------------------------------------------------------------------
.../apache/accumulo/tserver/TabletServer.java | 2 +-
.../org/apache/accumulo/test/Accumulo3010.java | 91 ++++++++++++++++++++
2 files changed, 92 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/1b49f44d/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 57415bd..d844cc8 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -2919,7 +2919,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
* the logs (the file will be in metadata, preventing replay of compacted data)... but do not want a majc to wipe the file out from metadata and then
* have another process failure... this could cause duplicate data to replay
*/
- if (tablet.getNumEntriesInMemory() > 0 && !tablet.minorCompactNow(MinorCompactionReason.SYSTEM)) {
+ if (tablet.getNumEntriesInMemory() > 0 && !tablet.minorCompactNow(MinorCompactionReason.RECOVERY)) {
throw new RuntimeException("Minor compaction after recovery fails for " + extent);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/1b49f44d/test/src/test/java/org/apache/accumulo/test/Accumulo3010.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/Accumulo3010.java b/test/src/test/java/org/apache/accumulo/test/Accumulo3010.java
new file mode 100644
index 0000000..2f6bb6f
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/Accumulo3010.java
@@ -0,0 +1,91 @@
+/*
+ * 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;
+
+import java.util.Map.Entry;
+
+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.conf.Property;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.minicluster.ServerType;
+import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
+import org.apache.accumulo.minicluster.impl.ProcessReference;
+import org.apache.accumulo.test.functional.ConfigurableMacIT;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.RawLocalFileSystem;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class Accumulo3010 extends ConfigurableMacIT {
+
+ @Override
+ public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+ cfg.setNumTservers(1);
+ cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "5s");
+ // file system supports recovery
+ hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
+ }
+
+ @Test(timeout = 60 * 1000)
+ public void test() throws Exception {
+ // create a table
+ String tableName = getUniqueNames(1)[0];
+ Connector c = getConnector();
+ c.tableOperations().create(tableName);
+ c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "100");
+ c.tableOperations().setProperty(tableName, Property.TABLE_FILE_MAX.getKey(), "3");
+ // create 3 flush files
+ BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
+ Mutation m = new Mutation("a");
+ m.put("b", "c", new Value("v".getBytes()));
+ for (int i = 0; i < 3; i++) {
+ bw.addMutation(m);
+ bw.flush();
+ c.tableOperations().flush(tableName, null, null, true);
+ }
+ // create an unsaved mutation
+ bw.addMutation(m);
+ bw.close();
+ // kill the tablet server
+ for (ProcessReference p : cluster.getProcesses().get(ServerType.TABLET_SERVER)) {
+ cluster.killProcess(ServerType.TABLET_SERVER, p);
+ }
+ // recover
+ cluster.start();
+ // ensure the table is readable
+ for (@SuppressWarnings("unused") Entry<Key,Value> entry : c.createScanner(tableName, Authorizations.EMPTY)) {
+ }
+ // ensure that the recovery was not a merging minor compaction
+ Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
+ s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+ for (Entry<Key, Value> entry : s) {
+ String filename = entry.getKey().getColumnQualifier().toString();
+ String parts[] = filename.split("/");
+ Assert.assertFalse(parts[parts.length-1].startsWith("M"));
+ }
+ }
+
+
+}