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 2013/04/03 19:40:05 UTC
svn commit: r1464119 - in /accumulo/branches/1.5:
server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
test/src/main/resources/log4j.properties
test/src/test/java/org/apache/accumulo/test/TestAccumulo1235.java
Author: ecn
Date: Wed Apr 3 17:40:05 2013
New Revision: 1464119
URL: http://svn.apache.org/r1464119
Log:
ACCUMULO-1235 load properties if we're loading an unfinished split
Added:
accumulo/branches/1.5/test/src/test/java/org/apache/accumulo/test/TestAccumulo1235.java (with props)
Modified:
accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
accumulo/branches/1.5/test/src/main/resources/log4j.properties
Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java?rev=1464119&r1=1464118&r2=1464119&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java (original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java Wed Apr 3 17:40:05 2013
@@ -2460,9 +2460,6 @@ public class TabletServer extends Abstra
}
// If extent given is not the one to be opened, update
if (tabletsInRange.size() != 1 || !tabletsInRange.containsKey(extent)) {
-
- tabletsKeyValues.clear();
-
synchronized (openingTablets) {
openingTablets.remove(extent);
openingTablets.notifyAll();
@@ -2924,7 +2921,7 @@ public class TabletServer extends Abstra
return null;
}
- // ensure lst key in map is same as extent that was passed in
+ // ensure last key in map is same as extent that was passed in
if (!tabletEntries.lastKey().equals(extent.getMetadataEntry())) {
log.warn("Failed to find metadata entry for " + extent + " found " + tabletEntries.lastKey());
return null;
@@ -2980,7 +2977,7 @@ public class TabletServer extends Abstra
// reread and reverify metadata entries now that metadata
// entries were fixed
tabletsKeyValues.clear();
- return verifyTabletInformation(extent, instance, null, clientAddress, lock);
+ return verifyTabletInformation(extent, instance, tabletsKeyValues, clientAddress, lock);
}
SortedMap<KeyExtent,Text> children = new TreeMap<KeyExtent,Text>();
@@ -3016,7 +3013,6 @@ public class TabletServer extends Abstra
log.warn("For extent " + extent + " metadata entries " + children + " do not form a contiguous range.");
return null;
}
-
return children;
} catch (AccumuloException e) {
log.error("error verifying metadata information. retrying ...");
Modified: accumulo/branches/1.5/test/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/src/main/resources/log4j.properties?rev=1464119&r1=1464118&r2=1464119&view=diff
==============================================================================
--- accumulo/branches/1.5/test/src/main/resources/log4j.properties (original)
+++ accumulo/branches/1.5/test/src/main/resources/log4j.properties Wed Apr 3 17:40:05 2013
@@ -1,3 +1,6 @@
-log4j.rootLogger=INFO,A1
+log4j.rootLogger=DEBUG,A1
log4j.logger.org.apache.accumulo.core.util.shell.Shell.audit=WARN,A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
+log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} [%-8c{2}] %-5p: %m%n
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+
Added: accumulo/branches/1.5/test/src/test/java/org/apache/accumulo/test/TestAccumulo1235.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/src/test/java/org/apache/accumulo/test/TestAccumulo1235.java?rev=1464119&view=auto
==============================================================================
--- accumulo/branches/1.5/test/src/test/java/org/apache/accumulo/test/TestAccumulo1235.java (added)
+++ accumulo/branches/1.5/test/src/test/java/org/apache/accumulo/test/TestAccumulo1235.java Wed Apr 3 17:40:05 2013
@@ -0,0 +1,108 @@
+package org.apache.accumulo.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.Constants;
+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.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.KeyExtent;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.TablePermission;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.hadoop.io.Text;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+public class TestAccumulo1235 {
+
+ private static final String TABLE = "simple";
+ public static TemporaryFolder folder = new TemporaryFolder();
+ private MiniAccumuloCluster accumulo;
+ private String secret = "secret";
+
+ @Before
+ public void setUp() throws Exception {
+ folder.create();
+ accumulo = new MiniAccumuloCluster(folder.getRoot(), secret);
+ accumulo.start();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ accumulo.stop();
+ folder.delete();
+ }
+
+ private Mutation m(String row) {
+ Mutation result = new Mutation(row);
+ result.put("cf", "cq", new Value("value".getBytes()));
+ return result;
+ }
+
+ boolean isOffline(String tablename, Connector connector) throws TableNotFoundException {
+ String tableId = connector.tableOperations().tableIdMap().get(tablename);
+ Scanner scanner = connector.createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
+ scanner.setRange(new Range(new Text(tableId + ";"), new Text(tableId + "<")));
+ scanner.fetchColumnFamily(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY);
+ for (@SuppressWarnings("unused") Entry<Key,Value> entry : scanner) {
+ return false;
+ }
+ return true;
+ }
+
+ @Test
+ public void test() throws Exception {
+
+ ZooKeeperInstance instance = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
+ Connector connector = instance.getConnector("root", new PasswordToken(secret));
+ // create a table and put some data in it
+ connector.tableOperations().create(TABLE);
+ BatchWriter bw = connector.createBatchWriter(TABLE, new BatchWriterConfig());
+ bw.addMutation(m("a"));
+ bw.addMutation(m("b"));
+ bw.addMutation(m("c"));
+ bw.close();
+ // take the table offline
+ connector.tableOperations().offline(TABLE);
+ while (!isOffline(TABLE, connector))
+ UtilWaitThread.sleep(200);
+
+ // poke a partial split into the !METADATA table
+ connector.securityOperations().grantTablePermission("root", Constants.METADATA_TABLE_NAME, TablePermission.WRITE);
+ String tableId = connector.tableOperations().tableIdMap().get(TABLE);
+
+ KeyExtent extent = new KeyExtent(new Text(tableId), null, new Text("b"));
+ Mutation m = extent.getPrevRowUpdateMutation();
+
+ Constants.METADATA_SPLIT_RATIO_COLUMN.put(m, new Value(Double.toString(0.5).getBytes()));
+ Constants.METADATA_OLD_PREV_ROW_COLUMN.put(m, KeyExtent.encodePrevEndRow(null));
+ bw = connector.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
+ bw.addMutation(m);
+ bw.close();
+ // bring the table online
+ connector.tableOperations().online(TABLE);
+
+ // verify the tablets went online
+ Scanner scanner = connector.createScanner(TABLE, Constants.NO_AUTHS);
+ int i = 0;
+ String expected[] = { "a", "b", "c" };
+ for (Entry<Key,Value> entry: scanner) {
+ assertEquals(expected[i], entry.getKey().getRow().toString());
+ i++;
+ }
+ assertEquals(3, i);
+ }
+
+}
Propchange: accumulo/branches/1.5/test/src/test/java/org/apache/accumulo/test/TestAccumulo1235.java
------------------------------------------------------------------------------
svn:eol-style = native