[jira] [Updated] (CASSANDRA-4496) NPE on creating secondary index from Hector
[ https://issues.apache.org/jira/browse/CASSANDRA-4496?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] David Semeria updated CASSANDRA-4496: - Description: The following code has been working fine up to and including 1.0.x public static String createIndexedColumnFamily(String cf){ Cluster cluster = HectorConfig.cluster; ComparatorType ctName = ComparatorType.getByClassName(JNameComparator.class.getName()); try{ cluster.dropColumnFamily(HectorConfig.dfltKeyspaceName, cf ); } catch (Exception e){} ListColumnDefinition cdL = new ArrayListColumnDefinition(); BasicColumnDefinition cd; cd = new BasicColumnDefinition(); cd.setName(ss.toByteBuffer(id)); cd.setIndexName(id); cd.setIndexType(ColumnIndexType.KEYS); cd.setValidationClass(JValueComparator.class.getName()); cdL.add(cd); ThriftCfDef cfd= new ThriftCfDef(HectorConfig.dfltKeyspaceName, cf, ctName, cdL); cfd.setKeyValidationClass(ComparatorType.UTF8TYPE.getClassName()); cfd.setDefaultValidationClass(JValueComparator.class.getName()); cluster.addColumnFamily(cfd); return created: + cf; } } I'm inclined to exclude the presence of the custom comparator since: (1) there is no issue using it if the cf doesn't have a secondary index (2) the stack trace (see below) doesn't include the comparator With 1.1.3, the above code cassandra throws the following error: david@vlap1:~/opt/cassandra$ sudo bin/cassandra -f xss = -ea -javaagent:/usr/share/cassandra/lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms128M -Xmx128M -Xmn32M -XX:+HeapDumpOnOutOfMemoryError -Xss160k INFO 23:15:31,333 Logging initialized INFO 23:15:31,337 JVM vendor/version: Java HotSpot(TM) 64-Bit Server VM/1.7.0 INFO 23:15:31,338 Heap size: 130875392/130875392 INFO 23:15:31,338 Classpath: /etc/cassandra:/usr/share/cassandra/lib/antlr-3.2.jar:/usr/share/cassandra/lib/avro-1.4.0-fixes.jar:/usr/share/cassandra/lib/avro-1.4.0-sources-fixes.jar:/usr/share/cassandra/lib/commons-cli-1.1.jar:/usr/share/cassandra/lib/commons-codec-1.2.jar:/usr/share/cassandra/lib/commons-lang-2.4.jar:/usr/share/cassandra/lib/compress-lzf-0.8.4.jar:/usr/share/cassandra/lib/concurrentlinkedhashmap-lru-1.3.jar:/usr/share/cassandra/lib/guava-r08.jar:/usr/share/cassandra/lib/hector-core-1.0-3.jar:/usr/share/cassandra/lib/high-scale-lib-1.1.2.jar:/usr/share/cassandra/lib/jackson-core-asl-1.9.2.jar:/usr/share/cassandra/lib/jackson-mapper-asl-1.9.2.jar:/usr/share/cassandra/lib/jamm-0.2.5.jar:/usr/share/cassandra/lib/jellyfish.jar:/usr/share/cassandra/lib/jline-0.9.94.jar:/usr/share/cassandra/lib/json-simple-1.1.jar:/usr/share/cassandra/lib/libthrift-0.7.0.jar:/usr/share/cassandra/lib/log4j-1.2.16.jar:/usr/share/cassandra/lib/metrics-core-2.0.3.jar:/usr/share/cassandra/lib/servlet-api-2.5-20081211.jar:/usr/share/cassandra/lib/slf4j-api-1.6.1.jar:/usr/share/cassandra/lib/slf4j-log4j12-1.6.1.jar:/usr/share/cassandra/lib/snakeyaml-1.6.jar:/usr/share/cassandra/lib/snappy-java-1.0.4.1.jar:/usr/share/cassandra/lib/snaptree-0.1.jar:/usr/share/cassandra/apache-cassandra-1.1.2.jar:/usr/share/cassandra/apache-cassandra-thrift-1.1.2.jar:/usr/share/cassandra/apache-cassandra.jar:/usr/share/cassandra/stress.jar:/usr/share/cassandra/lib/jamm-0.2.5.jar INFO 23:15:31,340 JNA not found. Native methods will be disabled. INFO 23:15:31,351 Loading settings from file:/etc/cassandra/cassandra.yaml INFO 23:15:31,566 DiskAccessMode 'auto' determined to be mmap, indexAccessMode is mmap INFO 23:15:31,875 Global memtable threshold is enabled at 41MB INFO 23:15:32,380 Initializing key cache with capacity of 6 MBs. INFO 23:15:32,394 Scheduling key cache save to each 14400 seconds (going to save all keys). INFO 23:15:32,395 Initializing row cache with capacity of 0 MBs and provider org.apache.cassandra.cache.SerializingCacheProvider INFO 23:15:32,400 Scheduling row cache save to each 0 seconds (going to save all keys). INFO 23:15:32,661 Couldn't detect any schema definitions in local storage. INFO 23:15:32,665 Found table data in data directories. Consider using the CLI to define your schema. INFO 23:15:32,714 No commitlog files found; skipping replay INFO 23:15:32,740 Cassandra version: 1.1.2 INFO 23:15:32,754 Thrift API version: 19.32.0 INFO 23:15:32,763 CQL supported versions: 2.0.0,3.0.0-beta1 (default: 2.0.0) INFO 23:15:32,803 Loading persisted ring state INFO 23:15:32,807 Starting up server gossip INFO 23:15:32,821 Enqueuing flush of Memtable-LocationInfo@1473831778(163/203 serialized/live bytes, 3 ops) INFO 23:15:32,822 Writing Memtable-LocationInfo@1473831778(163/203 serialized/live bytes, 3 ops) INFO 23:15:33,072 Completed flushing /var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-hd-1-Data.db (235 bytes) for commitlog position ReplayPosition(segmentId=126105713813993, position=587) INFO
[jira] [Updated] (CASSANDRA-4496) NPE on creating secondary index from Hector
[ https://issues.apache.org/jira/browse/CASSANDRA-4496?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] David Semeria updated CASSANDRA-4496: - Description: The following code has been working fine up to and including 1.0.x public static String createIndexedColumnFamily(String cf){ Cluster cluster = HectorConfig.cluster; ComparatorType ctName = ComparatorType.getByClassName(JNameComparator.class.getName()); try{ cluster.dropColumnFamily(HectorConfig.dfltKeyspaceName, cf ); } catch (Exception e){} ListColumnDefinition cdL = new ArrayListColumnDefinition(); BasicColumnDefinition cd; cd = new BasicColumnDefinition(); cd.setName(ss.toByteBuffer(id)); cd.setIndexName(id); cd.setIndexType(ColumnIndexType.KEYS); cd.setValidationClass(JValueComparator.class.getName()); cdL.add(cd); ThriftCfDef cfd= new ThriftCfDef(HectorConfig.dfltKeyspaceName, cf, ctName, cdL); cfd.setKeyValidationClass(ComparatorType.UTF8TYPE.getClassName()); cfd.setDefaultValidationClass(JValueComparator.class.getName()); cluster.addColumnFamily(cfd); return created: + cf; } } I'm inclined to exclude the presence of the custom comparator since: (1) there is no issue using it if the cf doesn't have a secondary index (2) the stack trace (see below) doesn't include the comparator The above code throws the following error in Cassandra 1.1.3 david@vlap1:~/opt/cassandra$ sudo bin/cassandra -f xss = -ea -javaagent:/usr/share/cassandra/lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms128M -Xmx128M -Xmn32M -XX:+HeapDumpOnOutOfMemoryError -Xss160k INFO 23:15:31,333 Logging initialized INFO 23:15:31,337 JVM vendor/version: Java HotSpot(TM) 64-Bit Server VM/1.7.0 INFO 23:15:31,338 Heap size: 130875392/130875392 INFO 23:15:31,338 Classpath: /etc/cassandra:/usr/share/cassandra/lib/antlr-3.2.jar:/usr/share/cassandra/lib/avro-1.4.0-fixes.jar:/usr/share/cassandra/lib/avro-1.4.0-sources-fixes.jar:/usr/share/cassandra/lib/commons-cli-1.1.jar:/usr/share/cassandra/lib/commons-codec-1.2.jar:/usr/share/cassandra/lib/commons-lang-2.4.jar:/usr/share/cassandra/lib/compress-lzf-0.8.4.jar:/usr/share/cassandra/lib/concurrentlinkedhashmap-lru-1.3.jar:/usr/share/cassandra/lib/guava-r08.jar:/usr/share/cassandra/lib/hector-core-1.0-3.jar:/usr/share/cassandra/lib/high-scale-lib-1.1.2.jar:/usr/share/cassandra/lib/jackson-core-asl-1.9.2.jar:/usr/share/cassandra/lib/jackson-mapper-asl-1.9.2.jar:/usr/share/cassandra/lib/jamm-0.2.5.jar:/usr/share/cassandra/lib/jellyfish.jar:/usr/share/cassandra/lib/jline-0.9.94.jar:/usr/share/cassandra/lib/json-simple-1.1.jar:/usr/share/cassandra/lib/libthrift-0.7.0.jar:/usr/share/cassandra/lib/log4j-1.2.16.jar:/usr/share/cassandra/lib/metrics-core-2.0.3.jar:/usr/share/cassandra/lib/servlet-api-2.5-20081211.jar:/usr/share/cassandra/lib/slf4j-api-1.6.1.jar:/usr/share/cassandra/lib/slf4j-log4j12-1.6.1.jar:/usr/share/cassandra/lib/snakeyaml-1.6.jar:/usr/share/cassandra/lib/snappy-java-1.0.4.1.jar:/usr/share/cassandra/lib/snaptree-0.1.jar:/usr/share/cassandra/apache-cassandra-1.1.2.jar:/usr/share/cassandra/apache-cassandra-thrift-1.1.2.jar:/usr/share/cassandra/apache-cassandra.jar:/usr/share/cassandra/stress.jar:/usr/share/cassandra/lib/jamm-0.2.5.jar INFO 23:15:31,340 JNA not found. Native methods will be disabled. INFO 23:15:31,351 Loading settings from file:/etc/cassandra/cassandra.yaml INFO 23:15:31,566 DiskAccessMode 'auto' determined to be mmap, indexAccessMode is mmap INFO 23:15:31,875 Global memtable threshold is enabled at 41MB INFO 23:15:32,380 Initializing key cache with capacity of 6 MBs. INFO 23:15:32,394 Scheduling key cache save to each 14400 seconds (going to save all keys). INFO 23:15:32,395 Initializing row cache with capacity of 0 MBs and provider org.apache.cassandra.cache.SerializingCacheProvider INFO 23:15:32,400 Scheduling row cache save to each 0 seconds (going to save all keys). INFO 23:15:32,661 Couldn't detect any schema definitions in local storage. INFO 23:15:32,665 Found table data in data directories. Consider using the CLI to define your schema. INFO 23:15:32,714 No commitlog files found; skipping replay INFO 23:15:32,740 Cassandra version: 1.1.2 INFO 23:15:32,754 Thrift API version: 19.32.0 INFO 23:15:32,763 CQL supported versions: 2.0.0,3.0.0-beta1 (default: 2.0.0) INFO 23:15:32,803 Loading persisted ring state INFO 23:15:32,807 Starting up server gossip INFO 23:15:32,821 Enqueuing flush of Memtable-LocationInfo@1473831778(163/203 serialized/live bytes, 3 ops) INFO 23:15:32,822 Writing Memtable-LocationInfo@1473831778(163/203 serialized/live bytes, 3 ops) INFO 23:15:33,072 Completed flushing /var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-hd-1-Data.db (235 bytes) for commitlog position ReplayPosition(segmentId=126105713813993, position=587) INFO 23:15:33,094
[jira] [Updated] (CASSANDRA-4496) NPE on creating secondary index from Hector
[ https://issues.apache.org/jira/browse/CASSANDRA-4496?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] David Semeria updated CASSANDRA-4496: - Description: The following code has been working fine up to and including 1.0.x public static String createIndexedColumnFamily(String cf){ Cluster cluster = HectorConfig.cluster; ComparatorType ctName = ComparatorType.getByClassName(JNameComparator.class.getName()); try{ cluster.dropColumnFamily(HectorConfig.dfltKeyspaceName, cf ); } catch (Exception e){} ListColumnDefinition cdL = new ArrayListColumnDefinition(); BasicColumnDefinition cd; cd = new BasicColumnDefinition(); cd.setName(ss.toByteBuffer(id)); cd.setIndexName(id); cd.setIndexType(ColumnIndexType.KEYS); cd.setValidationClass(JValueComparator.class.getName()); cdL.add(cd); ThriftCfDef cfd= new ThriftCfDef(HectorConfig.dfltKeyspaceName, cf, ctName, cdL); cfd.setKeyValidationClass(ComparatorType.UTF8TYPE.getClassName()); cfd.setDefaultValidationClass(JValueComparator.class.getName()); cluster.addColumnFamily(cfd); return created: + cf; } } I'm inclined to exclude the presence of the custom comparator since: (1) there is no issue using it if the cf doesn't have a secondary index (2) the stack trace (see below) doesn't include the comparator The above code throws the following error in Cassandra 1.1.2 david@vlap1:~/opt/cassandra$ sudo bin/cassandra -f xss = -ea -javaagent:/usr/share/cassandra/lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms128M -Xmx128M -Xmn32M -XX:+HeapDumpOnOutOfMemoryError -Xss160k INFO 23:15:31,333 Logging initialized INFO 23:15:31,337 JVM vendor/version: Java HotSpot(TM) 64-Bit Server VM/1.7.0 INFO 23:15:31,338 Heap size: 130875392/130875392 INFO 23:15:31,338 Classpath: /etc/cassandra:/usr/share/cassandra/lib/antlr-3.2.jar:/usr/share/cassandra/lib/avro-1.4.0-fixes.jar:/usr/share/cassandra/lib/avro-1.4.0-sources-fixes.jar:/usr/share/cassandra/lib/commons-cli-1.1.jar:/usr/share/cassandra/lib/commons-codec-1.2.jar:/usr/share/cassandra/lib/commons-lang-2.4.jar:/usr/share/cassandra/lib/compress-lzf-0.8.4.jar:/usr/share/cassandra/lib/concurrentlinkedhashmap-lru-1.3.jar:/usr/share/cassandra/lib/guava-r08.jar:/usr/share/cassandra/lib/hector-core-1.0-3.jar:/usr/share/cassandra/lib/high-scale-lib-1.1.2.jar:/usr/share/cassandra/lib/jackson-core-asl-1.9.2.jar:/usr/share/cassandra/lib/jackson-mapper-asl-1.9.2.jar:/usr/share/cassandra/lib/jamm-0.2.5.jar:/usr/share/cassandra/lib/jellyfish.jar:/usr/share/cassandra/lib/jline-0.9.94.jar:/usr/share/cassandra/lib/json-simple-1.1.jar:/usr/share/cassandra/lib/libthrift-0.7.0.jar:/usr/share/cassandra/lib/log4j-1.2.16.jar:/usr/share/cassandra/lib/metrics-core-2.0.3.jar:/usr/share/cassandra/lib/servlet-api-2.5-20081211.jar:/usr/share/cassandra/lib/slf4j-api-1.6.1.jar:/usr/share/cassandra/lib/slf4j-log4j12-1.6.1.jar:/usr/share/cassandra/lib/snakeyaml-1.6.jar:/usr/share/cassandra/lib/snappy-java-1.0.4.1.jar:/usr/share/cassandra/lib/snaptree-0.1.jar:/usr/share/cassandra/apache-cassandra-1.1.2.jar:/usr/share/cassandra/apache-cassandra-thrift-1.1.2.jar:/usr/share/cassandra/apache-cassandra.jar:/usr/share/cassandra/stress.jar:/usr/share/cassandra/lib/jamm-0.2.5.jar INFO 23:15:31,340 JNA not found. Native methods will be disabled. INFO 23:15:31,351 Loading settings from file:/etc/cassandra/cassandra.yaml INFO 23:15:31,566 DiskAccessMode 'auto' determined to be mmap, indexAccessMode is mmap INFO 23:15:31,875 Global memtable threshold is enabled at 41MB INFO 23:15:32,380 Initializing key cache with capacity of 6 MBs. INFO 23:15:32,394 Scheduling key cache save to each 14400 seconds (going to save all keys). INFO 23:15:32,395 Initializing row cache with capacity of 0 MBs and provider org.apache.cassandra.cache.SerializingCacheProvider INFO 23:15:32,400 Scheduling row cache save to each 0 seconds (going to save all keys). INFO 23:15:32,661 Couldn't detect any schema definitions in local storage. INFO 23:15:32,665 Found table data in data directories. Consider using the CLI to define your schema. INFO 23:15:32,714 No commitlog files found; skipping replay INFO 23:15:32,740 Cassandra version: 1.1.2 INFO 23:15:32,754 Thrift API version: 19.32.0 INFO 23:15:32,763 CQL supported versions: 2.0.0,3.0.0-beta1 (default: 2.0.0) INFO 23:15:32,803 Loading persisted ring state INFO 23:15:32,807 Starting up server gossip INFO 23:15:32,821 Enqueuing flush of Memtable-LocationInfo@1473831778(163/203 serialized/live bytes, 3 ops) INFO 23:15:32,822 Writing Memtable-LocationInfo@1473831778(163/203 serialized/live bytes, 3 ops) INFO 23:15:33,072 Completed flushing /var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-hd-1-Data.db (235 bytes) for commitlog position ReplayPosition(segmentId=126105713813993, position=587) INFO