Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-8808

CQLSSTableWriter: close does not work + more than one table throws ex

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Fix Version/s: 2.0.15, 2.1.5
    • Component/s: Legacy/CQL
    • Labels:
    • Severity:
      Normal
    • Since Version:

      Description

      I have encountered the following two issues:

      These issue can be reproduced with the following code:

      test.java
      import org.apache.cassandra.config.Config;
      import org.apache.cassandra.io.sstable.CQLSSTableWriter;
      
      public static void main(String[] args) {
        Config.setClientMode(true);
      
        CQLSSTableWriter w1 = CQLSSTableWriter.builder()
          .inDirectory("/tmp/kspc/t1")
          .forTable("CREATE TABLE kspc.t1 ( id  int, PRIMARY KEY (id));")
          .using("INSERT INTO kspc.t1 (id) VALUES ( ? );")
          .build();
      
        CQLSSTableWriter w2 = CQLSSTableWriter.builder()
          .inDirectory("/tmp/kspc/t2")
          .forTable("CREATE TABLE kspc.t2 ( id  int, PRIMARY KEY (id));")
          .using("INSERT INTO kspc.t2 (id) VALUES ( ? );")
          .build();
      
        try {
          w1.addRow(1);
          w2.addRow(1);
          w1.close();
          w2.close();
        } catch (Exception e) {
          System.out.println(e);
        }
      }
      
      The error
      Exception in thread "main" java.lang.ExceptionInInitializerError
              at org.apache.cassandra.db.Keyspace.initCf(Keyspace.java:324)
              at org.apache.cassandra.db.Keyspace.<init>(Keyspace.java:277)
              at org.apache.cassandra.db.Keyspace.open(Keyspace.java:119)
              at org.apache.cassandra.db.Keyspace.open(Keyspace.java:96)
              at org.apache.cassandra.cql3.statements.UpdateStatement.addUpdateForKey(UpdateStatement.java:101)
              at org.apache.cassandra.io.sstable.CQLSSTableWriter.rawAddRow(CQLSSTableWriter.java:226)
              at org.apache.cassandra.io.sstable.CQLSSTableWriter.addRow(CQLSSTableWriter.java:145)
              at org.apache.cassandra.io.sstable.CQLSSTableWriter.addRow(CQLSSTableWriter.java:120)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:606)
              at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSite.invoke(PojoMetaMethodSite.java:189)
              at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
              at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
              at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
              at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
              at com.allthingsmonitoring.utils.BulkDataLoader.main(BulkDataLoader.groovy:415)
      Caused by: java.lang.NullPointerException
              at org.apache.cassandra.config.DatabaseDescriptor.getFlushWriters(DatabaseDescriptor.java:1053)
              at org.apache.cassandra.db.ColumnFamilyStore.<clinit>(ColumnFamilyStore.java:85)
              ... 18 more
      

      I have just tested the in the cassandra-2.1 branch and the issue still persists.

        Attachments

        1. CASSANDRA-8808-trunk-V2.txt
          20 kB
          Benjamin Lerer
        2. CASSANDRA-8808-2.1-V2.txt
          16 kB
          Benjamin Lerer
        3. CASSANDRA-8808-2.0-V2.txt
          15 kB
          Benjamin Lerer
        4. CASSANDRA-8808-trunk.txt
          18 kB
          Benjamin Lerer
        5. CASSANDRA-8808-2.1.txt
          13 kB
          Benjamin Lerer
        6. CASSANDRA-8808-2.0.txt
          13 kB
          Benjamin Lerer

          Issue Links

            Activity

              People

              • Assignee:
                blerer Benjamin Lerer
                Reporter:
                syepes Sebastian YEPES FERNANDEZ
                Authors:
                Benjamin Lerer
                Reviewers:
                Yuki Morishita
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: