accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1325063 - in /accumulo/branches/1.4: src/server/src/main/java/org/apache/accumulo/server/test/functional/SparseColumnFamilyTest.java test/system/auto/simple/sparseColumnFamily.py
Date Wed, 11 Apr 2012 23:23:29 GMT
Author: kturner
Date: Wed Apr 11 23:23:29 2012
New Revision: 1325063

URL: http://svn.apache.org/viewvc?rev=1325063&view=rev
Log:
ACCUMULO-516 wrote test to reproduce bug identified in ticket

Added:
    accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/test/functional/SparseColumnFamilyTest.java
    accumulo/branches/1.4/test/system/auto/simple/sparseColumnFamily.py   (with props)

Added: accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/test/functional/SparseColumnFamilyTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/test/functional/SparseColumnFamilyTest.java?rev=1325063&view=auto
==============================================================================
--- accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/test/functional/SparseColumnFamilyTest.java
(added)
+++ accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/test/functional/SparseColumnFamilyTest.java
Wed Apr 11 23:23:29 2012
@@ -0,0 +1,115 @@
+/**
+ * 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.server.test.functional;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.data.Value;
+import org.apache.hadoop.io.Text;
+
+/**
+ * This test recreates issue ACCUMULO-516. Until that issue is fixed this test should time
out.
+ */
+public class SparseColumnFamilyTest extends FunctionalTest {
+  
+  @Override
+  public Map<String,String> getInitialConfig() {
+    return Collections.emptyMap();
+  }
+  
+  @Override
+  public List<TableSetup> getTablesToCreate() {
+    return Collections.emptyList();
+  }
+  
+  @Override
+  public void run() throws Exception {
+    getConnector().tableOperations().create("scftt");
+    
+    BatchWriter bw = getConnector().createBatchWriter("scftt", 10000000, 60000l, 3);
+    
+    // create file in the tablet that has mostly column family 0, with a few entries for
column family 1
+
+    bw.addMutation(nm(0, 1, 0));
+    for (int i = 1; i < 99999; i++) {
+      bw.addMutation(nm(i * 2, 0, i));
+    }
+    bw.addMutation(nm(99999 * 2, 1, 99999));
+    bw.flush();
+    
+    getConnector().tableOperations().flush("scftt", null, null, true);
+    
+    // create a file that has column family 1 and 0 interleaved
+    for (int i = 0; i < 100000; i++) {
+      bw.addMutation(nm(i * 2 + 1, i % 2 == 0 ? 0 : 1, i));
+    }
+    bw.close();
+    
+    getConnector().tableOperations().flush("scftt", null, null, true);
+    
+    Scanner scanner = getConnector().createScanner("scftt", Constants.NO_AUTHS);
+    
+    for (int i = 0; i < 200; i++) {
+      
+      // every time we search for column family 1, it will scan the entire file
+      // that has mostly column family 0 until the bug is fixed
+      scanner.setRange(new Range(String.format("%06d", i), null));
+      scanner.clearColumns();
+      scanner.setBatchSize(3);
+      scanner.fetchColumnFamily(new Text(String.format("%03d", 1)));
+      
+      long t1 = System.currentTimeMillis();
+      Iterator<Entry<Key,Value>> iter = scanner.iterator();
+      if (iter.hasNext()) {
+        Entry<Key,Value> entry = iter.next();
+      }
+      long t2 = System.currentTimeMillis();
+      
+      System.out.println("time " + (t2 - t1));
+      
+    }
+  }
+  
+  /**
+   * @param i
+   * @param j
+   * @param k
+   * @return
+   */
+  private Mutation nm(int row, int cf, int val) {
+    Mutation m = new Mutation(String.format("%06d", row));
+    m.put(String.format("%03d", cf), "", "" + val);
+    return m;
+  }
+
+  @Override
+  public void cleanup() throws Exception {
+    // TODO Auto-generated method stub
+    
+  }
+  
+}

Added: accumulo/branches/1.4/test/system/auto/simple/sparseColumnFamily.py
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/test/system/auto/simple/sparseColumnFamily.py?rev=1325063&view=auto
==============================================================================
--- accumulo/branches/1.4/test/system/auto/simple/sparseColumnFamily.py (added)
+++ accumulo/branches/1.4/test/system/auto/simple/sparseColumnFamily.py Wed Apr 11 23:23:29
2012
@@ -0,0 +1,30 @@
+# 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.
+
+from JavaTest import JavaTest
+
+import unittest
+
+class SparseColumnFamilyTest(JavaTest):
+    "Test sparse column familes"
+
+    order = 21
+    testClass="org.apache.accumulo.server.test.functional.SparseColumnFamilyTest"
+
+
+def suite():
+    result = unittest.TestSuite()
+    result.addTest(SparseColumnFamilyTest())
+    return result

Propchange: accumulo/branches/1.4/test/system/auto/simple/sparseColumnFamily.py
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message