You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "maxwellguo (Jira)" <ji...@apache.org> on 2022/10/13 03:58:00 UTC

[jira] [Comment Edited] (CASSANDRA-17698) sstabledump errors when dumping data from index

    [ https://issues.apache.org/jira/browse/CASSANDRA-17698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17616763#comment-17616763 ] 

maxwellguo edited comment on CASSANDRA-17698 at 10/13/22 3:57 AM:
------------------------------------------------------------------

Hi [~smiklosovic][~brandon.williams] [~adelapena], I find the reason of the bug and it is because that the CassandraIndex -> indexCfsMetadata build the index table meta at the first clustering key  with PartitionerDefinedOrder which have not implement toJSONString method , see https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/index/internal/CassandraIndex.java#L743

I have fixed the bug , and done some test with index sstable dump. Now I want to add some unit test for this like https://github.com/apache/cassandra/blob/trunk/test/unit/org/apache/cassandra/tools/SSTableExportSchemaLoadingTest.java  ,But I just find some exists sstables in test dir , they are here https://github.com/apache/cassandra/tree/trunk/test/data/legacy-sstables/nb/legacy_tables
But I need to add some sstable for secondary index , My question is : How does this sstables been created ? What I am going to do is just create index sstable locally and upload to github at this commit and then the ut can use them ?


was (Author: maxwellguo):
Hi [~smiklosovic][~brandon.williams], I find the reason of the bug and it is because that the CassandraIndex -> indexCfsMetadata build the index table meta at the first clustering key  with PartitionerDefinedOrder which have not implement toJSONString method , see https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/index/internal/CassandraIndex.java#L743

I have fixed the bug , and done some test with index sstable dump. Now I want to add some unit test for this like https://github.com/apache/cassandra/blob/trunk/test/unit/org/apache/cassandra/tools/SSTableExportSchemaLoadingTest.java  ,But I just find some exists sstables in test dir , they are here https://github.com/apache/cassandra/tree/trunk/test/data/legacy-sstables/nb/legacy_tables
But I need to add some sstable for secondary index , My question is : How does this sstables been created ? What I am going to do is just create index sstable locally and upload to github at this commit and then the ut can use them ?

> sstabledump errors when dumping data from index
> -----------------------------------------------
>
>                 Key: CASSANDRA-17698
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17698
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tool/sstable
>            Reporter: Stefan Miklosovic
>            Assignee: maxwellguo
>            Priority: Normal
>
> {code:java}
> cqlsh> CREATE KEYSPACE ks1 WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
> cqlsh> CREATE TABLE ks1.tb1 ( id text, name text, primary key (id));
> cqlsh> CREATE INDEX IF NOT EXISTS ON ks1.tb1(name);
> cqlsh> INSERT INTO ks1.tb1 (id, name ) VALUES ( '1', 'Joe');
> cqlsh> exit
> ./bin/nodetool flush
> ./tools/bin/sstabledump data/data/ks1/tb1-1c3c5f10ee4711ecab82eda2f44200b3/.tb1_name_idx/nb-1-big-Data.db 
> [
>   {
>     "partition" : {
>       "key" : [ "Joe" ],
>       "position" : 0
>     },
>     "rows" : [
>       {
>         "type" : "row",
>         "position" : 17,
>         "clustering" : [ ] } ] } ]Exception in thread "main" java.lang.UnsupportedOperationException
>         at org.apache.cassandra.db.marshal.PartitionerDefinedOrder.toJSONString(PartitionerDefinedOrder.java:87)
>         at org.apache.cassandra.db.marshal.AbstractType.toJSONString(AbstractType.java:187)
>         at org.apache.cassandra.tools.JsonTransformer.serializeClustering(JsonTransformer.java:372)
>         at org.apache.cassandra.tools.JsonTransformer.serializeRow(JsonTransformer.java:269)
>         at org.apache.cassandra.tools.JsonTransformer.serializePartition(JsonTransformer.java:235)
>         at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
>         at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
>         at java.util.Iterator.forEachRemaining(Iterator.java:116)
>         at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
>         at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
>         at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
>         at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
>         at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
>         at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
>         at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
>         at org.apache.cassandra.tools.JsonTransformer.toJson(JsonTransformer.java:113)
>         at org.apache.cassandra.tools.SSTableExport.main(SSTableExport.java:214) {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org