cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r773730 - in /incubator/cassandra/trunk/test/unit/org/apache/cassandra: ServerTest.java db/ColumnFamilyStoreTest.java
Date Mon, 11 May 2009 23:52:23 GMT
Author: jbellis
Date: Mon May 11 23:52:23 2009
New Revision: 773730

URL: http://svn.apache.org/viewvc?rev=773730&view=rev
Log:
test different data sizes for namesort.  patch by jbellis

Modified:
    incubator/cassandra/trunk/test/unit/org/apache/cassandra/ServerTest.java
    incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java

Modified: incubator/cassandra/trunk/test/unit/org/apache/cassandra/ServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/unit/org/apache/cassandra/ServerTest.java?rev=773730&r1=773729&r2=773730&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/unit/org/apache/cassandra/ServerTest.java (original)
+++ incubator/cassandra/trunk/test/unit/org/apache/cassandra/ServerTest.java Mon May 11 23:52:23
2009
@@ -15,6 +15,10 @@
     @BeforeMethod
     public void cleanup()
     {
+        // we clean the fs twice, once to start with (so old data files don't get stored
by anything static if this is the first run)
+        // and once after flushing stuff (to try to clean things out if it is not.)  part
#2 seems to be less than perfect.
+        cleanUpFilesystem();
+
         Table table = Table.open("Table1");
         for (String cfName : table.getColumnFamilies())
         {
@@ -31,6 +35,11 @@
 
         CommitLog.reset();
 
+        cleanUpFilesystem();
+    }
+
+    private void cleanUpFilesystem()
+    {
         String[] directoryNames = {
                 DatabaseDescriptor.getBootstrapFileLocation(),
                 DatabaseDescriptor.getLogFileLocation(),

Modified: incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java?rev=773730&r1=773729&r2=773730&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
(original)
+++ incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
Mon May 11 23:52:23 2009
@@ -32,11 +32,32 @@
     }
 
     @Test
-    public void testNameSort() throws IOException, ExecutionException, InterruptedException
+    public void testNameSort1() throws IOException, ExecutionException, InterruptedException
+    {
+        // single key
+        testNameSort(1);
+    }
+
+    @Test
+    public void testNameSort10() throws IOException, ExecutionException, InterruptedException
+    {
+        // multiple keys, flushing concurrently w/ inserts
+        testNameSort(10);
+    }
+
+    @Test
+    public void testNameSort100() throws IOException, ExecutionException, InterruptedException
+    {
+        // enough keys to force compaction concurrently w/ inserts
+        testNameSort(100);
+    }
+
+
+    private void testNameSort(int N) throws IOException, ExecutionException, InterruptedException
     {
         Table table = Table.open("Table1");
 
-        for (int i = 900; i < 1000; ++i)
+        for (int i = 0; i < N; ++i)
         {
             String key = Integer.toString(i);
             RowMutation rm;
@@ -63,11 +84,11 @@
             }
         }
 
-        // validateNameSort(table);
+        validateNameSort(table, N);
 
         table.getColumnFamilyStore("Standard1").forceBlockingFlush();
         table.getColumnFamilyStore("Super1").forceBlockingFlush();
-        validateNameSort(table);
+        validateNameSort(table, N);
     }
 
     @Test
@@ -150,9 +171,9 @@
         }
     }
 
-    private void validateNameSort(Table table) throws IOException
+    private void validateNameSort(Table table, int N) throws IOException
     {
-        for (int i = 900; i < 1000; ++i)
+        for (int i = 0; i < N; ++i)
         {
             String key = Integer.toString(i);
             ColumnFamily cf;



Mime
View raw message