You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jeremy Hanna (JIRA)" <ji...@apache.org> on 2012/12/03 22:47:58 UTC

[jira] [Created] (CASSANDRA-5023) Upgrading from 1.0 to 1.1 makes secondary indexes no longer work

Jeremy Hanna created CASSANDRA-5023:
---------------------------------------

             Summary: Upgrading from 1.0 to 1.1 makes secondary indexes no longer work
                 Key: CASSANDRA-5023
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5023
             Project: Cassandra
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.1.7
            Reporter: Jeremy Hanna


To reproduce:
Create column family with C* 1.0.8:
{code}
CREATE KEYSPACE Keyspace1 
with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
and strategy_options = {replication_factor:1};

use Keyspace1;

CREATE COLUMN FAMILY 'User' WITH
 key_validation_class = 'UTF8Type' AND
 comparator = 'UTF8Type' AND
 default_validation_class = 'UTF8Type' AND
 compression_options = {sstable_compression:SnappyCompressor,chunk_length_kb:64} AND
-- rows_cached = 100000000 AND
-- key_alias = 'userId' AND
 column_metadata = [
 {column_name: 'numberOfDeloreans', validation_class: 'IntegerType', index_type: KEYS}
];
{code}

Then in cqlsh adding some data:
{code}
use Keyspace1;
update User set 'numberOfDeloreans'=0 where key = 'marty';
update User set 'userId'='themartymcfly' where key = 'marty';
{code}

In cqlsh, do
{code}select * from User where numberOfDeloreans=0;{code}

Then in thrift do:
{code}
package org.mostlyharmless;

import org.apache.cassandra.thrift.*;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;

import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;

public class ThriftQuery {

    public static void main(String[] args)
            throws TException, InvalidRequestException, UnavailableException, UnsupportedEncodingException, NotFoundException, TimedOutException
    {
        TTransport tr = new TFramedTransport(new TSocket("localhost", 9160));
        TProtocol proto = new TBinaryProtocol(tr);
        Cassandra.Client client = new Cassandra.Client(proto);
        tr.open();
        client.set_keyspace("Keyspace1");
        ColumnParent columnParent = new ColumnParent("User");
        SlicePredicate slicePredicate = new SlicePredicate();
        List<ByteBuffer> columnNames = new ArrayList<ByteBuffer>();
        columnNames.add(ByteBufferUtil.bytes("userId"));
        slicePredicate.setColumn_names(columnNames);
        KeyRange keyRange = new KeyRange();
        keyRange.setStart_token("0");
        keyRange.setEnd_token("0");
        List<IndexExpression> indexExpressions = new ArrayList<IndexExpression>();
        indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, ByteBufferUtil.bytes(0)));
        keyRange.setRow_filter(indexExpressions);
        List<KeySlice> keySlices = client.get_range_slices(columnParent, slicePredicate, keyRange, ConsistencyLevel.ONE);
        System.out.println("number of keyslices returned: " + keySlices.size());
        tr.close();
    }
}
{code}

Note that 1 record is returned in both instances.

Run nodetool drain on 1.0.8.  Start 1.1.7.  Do the cqlsh query again, returns the result.  Run the thrift code again, get 0 results.

Tried both upgradesstables and rebuild_index.  Didn't help.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-5023) Upgrading from 1.0 to 1.1 makes secondary indexes no longer work

Posted by "Yuki Morishita (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13509962#comment-13509962 ] 

Yuki Morishita commented on CASSANDRA-5023:
-------------------------------------------

In above case, inserting via CQL stores value(and key in index) in IntegerType(BigInteger), and you are querying that with 1 byte ByteBuffer(ByteBufferUtil.bytes(0)). If you change the line

{code}
indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, ByteBufferUtil.bytes(0)));
{code}

to

{code}
indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, IntegerType.instance.fromString("0")));
{code}

it all works fine.

So why the code has been working with 1.0? In 1.0, DecoratedKey#compareTo just compares two tokens. LocalToken, which is used for secondary index, from ByteBufferUtil.bytes(0) ...(1) and from IntegerType.instance.fromString("0")...(2) are considered equal when using IntegerType, and that's why you can query IntegerTyped DK with both (1) and (2).

DK#comparedTo changed since 1.1(CASSANDRA-1034), and now DKs are compared by key itself byte by byte if two tokens are considered equal. In above case, tokens are equal but keys are different byte-wise. So you only can query IndexedTyped value with the same IndexTyped value now.

So I conclude that the behavior of 1.0 can be considered as a "bug".
                
> Upgrading from 1.0 to 1.1 makes secondary indexes no longer work
> ----------------------------------------------------------------
>
>                 Key: CASSANDRA-5023
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5023
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Jeremy Hanna
>            Assignee: Yuki Morishita
>             Fix For: 1.1.8
>
>
> To reproduce:
> Create column family with C* 1.0.8:
> {code}
> CREATE KEYSPACE Keyspace1 
> with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
> and strategy_options = {replication_factor:1};
> use Keyspace1;
> CREATE COLUMN FAMILY 'User' WITH
>  key_validation_class = 'UTF8Type' AND
>  comparator = 'UTF8Type' AND
>  default_validation_class = 'UTF8Type' AND
>  compression_options = {sstable_compression:SnappyCompressor,chunk_length_kb:64} AND
>  column_metadata = [
>  {column_name: 'numberOfDeloreans', validation_class: 'IntegerType', index_type: KEYS}
> ];
> {code}
> Then in cqlsh add some data:
> {code}
> use Keyspace1;
> update User set 'numberOfDeloreans'=0 where key = 'marty';
> update User set 'userId'='themartymcfly' where key = 'marty';
> {code}
> In cqlsh, do
> {code}select * from User where numberOfDeloreans=0;{code}
> Then in thrift do:
> {code}
> package org.mostlyharmless;
> import org.apache.cassandra.thrift.*;
> import org.apache.cassandra.utils.ByteBufferUtil;
> import org.apache.thrift.TException;
> import org.apache.thrift.protocol.TProtocol;
> import org.apache.thrift.transport.TFramedTransport;
> import org.apache.thrift.transport.TSocket;
> import org.apache.thrift.transport.TTransport;
> import java.io.UnsupportedEncodingException;
> import java.nio.ByteBuffer;
> import java.util.ArrayList;
> import java.util.List;
> public class ThriftQuery {
>     public static void main(String[] args)
>             throws TException, InvalidRequestException, UnavailableException, UnsupportedEncodingException, NotFoundException, TimedOutException
>     {
>         TTransport tr = new TFramedTransport(new TSocket("localhost", 9160));
>         TProtocol proto = new TBinaryProtocol(tr);
>         Cassandra.Client client = new Cassandra.Client(proto);
>         tr.open();
>         client.set_keyspace("Keyspace1");
>         ColumnParent columnParent = new ColumnParent("User");
>         SlicePredicate slicePredicate = new SlicePredicate();
>         List<ByteBuffer> columnNames = new ArrayList<ByteBuffer>();
>         columnNames.add(ByteBufferUtil.bytes("userId"));
>         slicePredicate.setColumn_names(columnNames);
>         KeyRange keyRange = new KeyRange();
>         keyRange.setStart_token("0");
>         keyRange.setEnd_token("0");
>         List<IndexExpression> indexExpressions = new ArrayList<IndexExpression>();
>         indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, ByteBufferUtil.bytes(0)));
>         keyRange.setRow_filter(indexExpressions);
>         List<KeySlice> keySlices = client.get_range_slices(columnParent, slicePredicate, keyRange, ConsistencyLevel.ONE);
>         System.out.println("number of keyslices returned: " + keySlices.size());
>         tr.close();
>     }
> }
> {code}
> Note that 1 record is returned in both instances.
> Run nodetool drain on 1.0.8.  Start 1.1.7.  Do the cqlsh query again, returns the result.  Run the thrift code again, get 0 results.
> Tried both upgradesstables and rebuild_index.  Didn't help.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CASSANDRA-5023) Upgrading from 1.0 to 1.1 makes secondary indexes no longer work

Posted by "Jeremy Hanna (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeremy Hanna updated CASSANDRA-5023:
------------------------------------

    Description: 
To reproduce:
Create column family with C* 1.0.8:
{code}
CREATE KEYSPACE Keyspace1 
with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
and strategy_options = {replication_factor:1};

use Keyspace1;

CREATE COLUMN FAMILY 'User' WITH
 key_validation_class = 'UTF8Type' AND
 comparator = 'UTF8Type' AND
 default_validation_class = 'UTF8Type' AND
 compression_options = {sstable_compression:SnappyCompressor,chunk_length_kb:64} AND
 column_metadata = [
 {column_name: 'numberOfDeloreans', validation_class: 'IntegerType', index_type: KEYS}
];
{code}

Then in cqlsh adding some data:
{code}
use Keyspace1;
update User set 'numberOfDeloreans'=0 where key = 'marty';
update User set 'userId'='themartymcfly' where key = 'marty';
{code}

In cqlsh, do
{code}select * from User where numberOfDeloreans=0;{code}

Then in thrift do:
{code}
package org.mostlyharmless;

import org.apache.cassandra.thrift.*;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;

import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;

public class ThriftQuery {

    public static void main(String[] args)
            throws TException, InvalidRequestException, UnavailableException, UnsupportedEncodingException, NotFoundException, TimedOutException
    {
        TTransport tr = new TFramedTransport(new TSocket("localhost", 9160));
        TProtocol proto = new TBinaryProtocol(tr);
        Cassandra.Client client = new Cassandra.Client(proto);
        tr.open();
        client.set_keyspace("Keyspace1");
        ColumnParent columnParent = new ColumnParent("User");
        SlicePredicate slicePredicate = new SlicePredicate();
        List<ByteBuffer> columnNames = new ArrayList<ByteBuffer>();
        columnNames.add(ByteBufferUtil.bytes("userId"));
        slicePredicate.setColumn_names(columnNames);
        KeyRange keyRange = new KeyRange();
        keyRange.setStart_token("0");
        keyRange.setEnd_token("0");
        List<IndexExpression> indexExpressions = new ArrayList<IndexExpression>();
        indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, ByteBufferUtil.bytes(0)));
        keyRange.setRow_filter(indexExpressions);
        List<KeySlice> keySlices = client.get_range_slices(columnParent, slicePredicate, keyRange, ConsistencyLevel.ONE);
        System.out.println("number of keyslices returned: " + keySlices.size());
        tr.close();
    }
}
{code}

Note that 1 record is returned in both instances.

Run nodetool drain on 1.0.8.  Start 1.1.7.  Do the cqlsh query again, returns the result.  Run the thrift code again, get 0 results.

Tried both upgradesstables and rebuild_index.  Didn't help.

  was:
To reproduce:
Create column family with C* 1.0.8:
{code}
CREATE KEYSPACE Keyspace1 
with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
and strategy_options = {replication_factor:1};

use Keyspace1;

CREATE COLUMN FAMILY 'User' WITH
 key_validation_class = 'UTF8Type' AND
 comparator = 'UTF8Type' AND
 default_validation_class = 'UTF8Type' AND
 compression_options = {sstable_compression:SnappyCompressor,chunk_length_kb:64} AND
-- rows_cached = 100000000 AND
-- key_alias = 'userId' AND
 column_metadata = [
 {column_name: 'numberOfDeloreans', validation_class: 'IntegerType', index_type: KEYS}
];
{code}

Then in cqlsh adding some data:
{code}
use Keyspace1;
update User set 'numberOfDeloreans'=0 where key = 'marty';
update User set 'userId'='themartymcfly' where key = 'marty';
{code}

In cqlsh, do
{code}select * from User where numberOfDeloreans=0;{code}

Then in thrift do:
{code}
package org.mostlyharmless;

import org.apache.cassandra.thrift.*;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;

import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;

public class ThriftQuery {

    public static void main(String[] args)
            throws TException, InvalidRequestException, UnavailableException, UnsupportedEncodingException, NotFoundException, TimedOutException
    {
        TTransport tr = new TFramedTransport(new TSocket("localhost", 9160));
        TProtocol proto = new TBinaryProtocol(tr);
        Cassandra.Client client = new Cassandra.Client(proto);
        tr.open();
        client.set_keyspace("Keyspace1");
        ColumnParent columnParent = new ColumnParent("User");
        SlicePredicate slicePredicate = new SlicePredicate();
        List<ByteBuffer> columnNames = new ArrayList<ByteBuffer>();
        columnNames.add(ByteBufferUtil.bytes("userId"));
        slicePredicate.setColumn_names(columnNames);
        KeyRange keyRange = new KeyRange();
        keyRange.setStart_token("0");
        keyRange.setEnd_token("0");
        List<IndexExpression> indexExpressions = new ArrayList<IndexExpression>();
        indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, ByteBufferUtil.bytes(0)));
        keyRange.setRow_filter(indexExpressions);
        List<KeySlice> keySlices = client.get_range_slices(columnParent, slicePredicate, keyRange, ConsistencyLevel.ONE);
        System.out.println("number of keyslices returned: " + keySlices.size());
        tr.close();
    }
}
{code}

Note that 1 record is returned in both instances.

Run nodetool drain on 1.0.8.  Start 1.1.7.  Do the cqlsh query again, returns the result.  Run the thrift code again, get 0 results.

Tried both upgradesstables and rebuild_index.  Didn't help.

    
> Upgrading from 1.0 to 1.1 makes secondary indexes no longer work
> ----------------------------------------------------------------
>
>                 Key: CASSANDRA-5023
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5023
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.7
>            Reporter: Jeremy Hanna
>
> To reproduce:
> Create column family with C* 1.0.8:
> {code}
> CREATE KEYSPACE Keyspace1 
> with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
> and strategy_options = {replication_factor:1};
> use Keyspace1;
> CREATE COLUMN FAMILY 'User' WITH
>  key_validation_class = 'UTF8Type' AND
>  comparator = 'UTF8Type' AND
>  default_validation_class = 'UTF8Type' AND
>  compression_options = {sstable_compression:SnappyCompressor,chunk_length_kb:64} AND
>  column_metadata = [
>  {column_name: 'numberOfDeloreans', validation_class: 'IntegerType', index_type: KEYS}
> ];
> {code}
> Then in cqlsh adding some data:
> {code}
> use Keyspace1;
> update User set 'numberOfDeloreans'=0 where key = 'marty';
> update User set 'userId'='themartymcfly' where key = 'marty';
> {code}
> In cqlsh, do
> {code}select * from User where numberOfDeloreans=0;{code}
> Then in thrift do:
> {code}
> package org.mostlyharmless;
> import org.apache.cassandra.thrift.*;
> import org.apache.cassandra.utils.ByteBufferUtil;
> import org.apache.thrift.TException;
> import org.apache.thrift.protocol.TProtocol;
> import org.apache.thrift.transport.TFramedTransport;
> import org.apache.thrift.transport.TSocket;
> import org.apache.thrift.transport.TTransport;
> import java.io.UnsupportedEncodingException;
> import java.nio.ByteBuffer;
> import java.util.ArrayList;
> import java.util.List;
> public class ThriftQuery {
>     public static void main(String[] args)
>             throws TException, InvalidRequestException, UnavailableException, UnsupportedEncodingException, NotFoundException, TimedOutException
>     {
>         TTransport tr = new TFramedTransport(new TSocket("localhost", 9160));
>         TProtocol proto = new TBinaryProtocol(tr);
>         Cassandra.Client client = new Cassandra.Client(proto);
>         tr.open();
>         client.set_keyspace("Keyspace1");
>         ColumnParent columnParent = new ColumnParent("User");
>         SlicePredicate slicePredicate = new SlicePredicate();
>         List<ByteBuffer> columnNames = new ArrayList<ByteBuffer>();
>         columnNames.add(ByteBufferUtil.bytes("userId"));
>         slicePredicate.setColumn_names(columnNames);
>         KeyRange keyRange = new KeyRange();
>         keyRange.setStart_token("0");
>         keyRange.setEnd_token("0");
>         List<IndexExpression> indexExpressions = new ArrayList<IndexExpression>();
>         indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, ByteBufferUtil.bytes(0)));
>         keyRange.setRow_filter(indexExpressions);
>         List<KeySlice> keySlices = client.get_range_slices(columnParent, slicePredicate, keyRange, ConsistencyLevel.ONE);
>         System.out.println("number of keyslices returned: " + keySlices.size());
>         tr.close();
>     }
> }
> {code}
> Note that 1 record is returned in both instances.
> Run nodetool drain on 1.0.8.  Start 1.1.7.  Do the cqlsh query again, returns the result.  Run the thrift code again, get 0 results.
> Tried both upgradesstables and rebuild_index.  Didn't help.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (CASSANDRA-5023) Upgrading from 1.0 to 1.1 makes secondary indexes no longer work

Posted by "Brandon Williams (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brandon Williams resolved CASSANDRA-5023.
-----------------------------------------

    Resolution: Not A Problem
    
> Upgrading from 1.0 to 1.1 makes secondary indexes no longer work
> ----------------------------------------------------------------
>
>                 Key: CASSANDRA-5023
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5023
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Jeremy Hanna
>            Assignee: Yuki Morishita
>             Fix For: 1.1.8
>
>
> To reproduce:
> Create column family with C* 1.0.8:
> {code}
> CREATE KEYSPACE Keyspace1 
> with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
> and strategy_options = {replication_factor:1};
> use Keyspace1;
> CREATE COLUMN FAMILY 'User' WITH
>  key_validation_class = 'UTF8Type' AND
>  comparator = 'UTF8Type' AND
>  default_validation_class = 'UTF8Type' AND
>  compression_options = {sstable_compression:SnappyCompressor,chunk_length_kb:64} AND
>  column_metadata = [
>  {column_name: 'numberOfDeloreans', validation_class: 'IntegerType', index_type: KEYS}
> ];
> {code}
> Then in cqlsh add some data:
> {code}
> use Keyspace1;
> update User set 'numberOfDeloreans'=0 where key = 'marty';
> update User set 'userId'='themartymcfly' where key = 'marty';
> {code}
> In cqlsh, do
> {code}select * from User where numberOfDeloreans=0;{code}
> Then in thrift do:
> {code}
> package org.mostlyharmless;
> import org.apache.cassandra.thrift.*;
> import org.apache.cassandra.utils.ByteBufferUtil;
> import org.apache.thrift.TException;
> import org.apache.thrift.protocol.TProtocol;
> import org.apache.thrift.transport.TFramedTransport;
> import org.apache.thrift.transport.TSocket;
> import org.apache.thrift.transport.TTransport;
> import java.io.UnsupportedEncodingException;
> import java.nio.ByteBuffer;
> import java.util.ArrayList;
> import java.util.List;
> public class ThriftQuery {
>     public static void main(String[] args)
>             throws TException, InvalidRequestException, UnavailableException, UnsupportedEncodingException, NotFoundException, TimedOutException
>     {
>         TTransport tr = new TFramedTransport(new TSocket("localhost", 9160));
>         TProtocol proto = new TBinaryProtocol(tr);
>         Cassandra.Client client = new Cassandra.Client(proto);
>         tr.open();
>         client.set_keyspace("Keyspace1");
>         ColumnParent columnParent = new ColumnParent("User");
>         SlicePredicate slicePredicate = new SlicePredicate();
>         List<ByteBuffer> columnNames = new ArrayList<ByteBuffer>();
>         columnNames.add(ByteBufferUtil.bytes("userId"));
>         slicePredicate.setColumn_names(columnNames);
>         KeyRange keyRange = new KeyRange();
>         keyRange.setStart_token("0");
>         keyRange.setEnd_token("0");
>         List<IndexExpression> indexExpressions = new ArrayList<IndexExpression>();
>         indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, ByteBufferUtil.bytes(0)));
>         keyRange.setRow_filter(indexExpressions);
>         List<KeySlice> keySlices = client.get_range_slices(columnParent, slicePredicate, keyRange, ConsistencyLevel.ONE);
>         System.out.println("number of keyslices returned: " + keySlices.size());
>         tr.close();
>     }
> }
> {code}
> Note that 1 record is returned in both instances.
> Run nodetool drain on 1.0.8.  Start 1.1.7.  Do the cqlsh query again, returns the result.  Run the thrift code again, get 0 results.
> Tried both upgradesstables and rebuild_index.  Didn't help.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-5023) Upgrading from 1.0 to 1.1 makes secondary indexes no longer work

Posted by "Jeremy Hanna (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13509511#comment-13509511 ] 

Jeremy Hanna commented on CASSANDRA-5023:
-----------------------------------------

Fwiw I first tried 1.1.5 which was broken but then tried 1.1.7 to see if there were any fixes for it.
                
> Upgrading from 1.0 to 1.1 makes secondary indexes no longer work
> ----------------------------------------------------------------
>
>                 Key: CASSANDRA-5023
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5023
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Jeremy Hanna
>            Assignee: Yuki Morishita
>             Fix For: 1.1.8
>
>
> To reproduce:
> Create column family with C* 1.0.8:
> {code}
> CREATE KEYSPACE Keyspace1 
> with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
> and strategy_options = {replication_factor:1};
> use Keyspace1;
> CREATE COLUMN FAMILY 'User' WITH
>  key_validation_class = 'UTF8Type' AND
>  comparator = 'UTF8Type' AND
>  default_validation_class = 'UTF8Type' AND
>  compression_options = {sstable_compression:SnappyCompressor,chunk_length_kb:64} AND
>  column_metadata = [
>  {column_name: 'numberOfDeloreans', validation_class: 'IntegerType', index_type: KEYS}
> ];
> {code}
> Then in cqlsh add some data:
> {code}
> use Keyspace1;
> update User set 'numberOfDeloreans'=0 where key = 'marty';
> update User set 'userId'='themartymcfly' where key = 'marty';
> {code}
> In cqlsh, do
> {code}select * from User where numberOfDeloreans=0;{code}
> Then in thrift do:
> {code}
> package org.mostlyharmless;
> import org.apache.cassandra.thrift.*;
> import org.apache.cassandra.utils.ByteBufferUtil;
> import org.apache.thrift.TException;
> import org.apache.thrift.protocol.TProtocol;
> import org.apache.thrift.transport.TFramedTransport;
> import org.apache.thrift.transport.TSocket;
> import org.apache.thrift.transport.TTransport;
> import java.io.UnsupportedEncodingException;
> import java.nio.ByteBuffer;
> import java.util.ArrayList;
> import java.util.List;
> public class ThriftQuery {
>     public static void main(String[] args)
>             throws TException, InvalidRequestException, UnavailableException, UnsupportedEncodingException, NotFoundException, TimedOutException
>     {
>         TTransport tr = new TFramedTransport(new TSocket("localhost", 9160));
>         TProtocol proto = new TBinaryProtocol(tr);
>         Cassandra.Client client = new Cassandra.Client(proto);
>         tr.open();
>         client.set_keyspace("Keyspace1");
>         ColumnParent columnParent = new ColumnParent("User");
>         SlicePredicate slicePredicate = new SlicePredicate();
>         List<ByteBuffer> columnNames = new ArrayList<ByteBuffer>();
>         columnNames.add(ByteBufferUtil.bytes("userId"));
>         slicePredicate.setColumn_names(columnNames);
>         KeyRange keyRange = new KeyRange();
>         keyRange.setStart_token("0");
>         keyRange.setEnd_token("0");
>         List<IndexExpression> indexExpressions = new ArrayList<IndexExpression>();
>         indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, ByteBufferUtil.bytes(0)));
>         keyRange.setRow_filter(indexExpressions);
>         List<KeySlice> keySlices = client.get_range_slices(columnParent, slicePredicate, keyRange, ConsistencyLevel.ONE);
>         System.out.println("number of keyslices returned: " + keySlices.size());
>         tr.close();
>     }
> }
> {code}
> Note that 1 record is returned in both instances.
> Run nodetool drain on 1.0.8.  Start 1.1.7.  Do the cqlsh query again, returns the result.  Run the thrift code again, get 0 results.
> Tried both upgradesstables and rebuild_index.  Didn't help.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CASSANDRA-5023) Upgrading from 1.0 to 1.1 makes secondary indexes no longer work

Posted by "Jeremy Hanna (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeremy Hanna updated CASSANDRA-5023:
------------------------------------

    Description: 
To reproduce:
Create column family with C* 1.0.8:
{code}
CREATE KEYSPACE Keyspace1 
with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
and strategy_options = {replication_factor:1};

use Keyspace1;

CREATE COLUMN FAMILY 'User' WITH
 key_validation_class = 'UTF8Type' AND
 comparator = 'UTF8Type' AND
 default_validation_class = 'UTF8Type' AND
 compression_options = {sstable_compression:SnappyCompressor,chunk_length_kb:64} AND
 column_metadata = [
 {column_name: 'numberOfDeloreans', validation_class: 'IntegerType', index_type: KEYS}
];
{code}

Then in cqlsh add some data:
{code}
use Keyspace1;
update User set 'numberOfDeloreans'=0 where key = 'marty';
update User set 'userId'='themartymcfly' where key = 'marty';
{code}

In cqlsh, do
{code}select * from User where numberOfDeloreans=0;{code}

Then in thrift do:
{code}
package org.mostlyharmless;

import org.apache.cassandra.thrift.*;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;

import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;

public class ThriftQuery {

    public static void main(String[] args)
            throws TException, InvalidRequestException, UnavailableException, UnsupportedEncodingException, NotFoundException, TimedOutException
    {
        TTransport tr = new TFramedTransport(new TSocket("localhost", 9160));
        TProtocol proto = new TBinaryProtocol(tr);
        Cassandra.Client client = new Cassandra.Client(proto);
        tr.open();
        client.set_keyspace("Keyspace1");
        ColumnParent columnParent = new ColumnParent("User");
        SlicePredicate slicePredicate = new SlicePredicate();
        List<ByteBuffer> columnNames = new ArrayList<ByteBuffer>();
        columnNames.add(ByteBufferUtil.bytes("userId"));
        slicePredicate.setColumn_names(columnNames);
        KeyRange keyRange = new KeyRange();
        keyRange.setStart_token("0");
        keyRange.setEnd_token("0");
        List<IndexExpression> indexExpressions = new ArrayList<IndexExpression>();
        indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, ByteBufferUtil.bytes(0)));
        keyRange.setRow_filter(indexExpressions);
        List<KeySlice> keySlices = client.get_range_slices(columnParent, slicePredicate, keyRange, ConsistencyLevel.ONE);
        System.out.println("number of keyslices returned: " + keySlices.size());
        tr.close();
    }
}
{code}

Note that 1 record is returned in both instances.

Run nodetool drain on 1.0.8.  Start 1.1.7.  Do the cqlsh query again, returns the result.  Run the thrift code again, get 0 results.

Tried both upgradesstables and rebuild_index.  Didn't help.

  was:
To reproduce:
Create column family with C* 1.0.8:
{code}
CREATE KEYSPACE Keyspace1 
with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
and strategy_options = {replication_factor:1};

use Keyspace1;

CREATE COLUMN FAMILY 'User' WITH
 key_validation_class = 'UTF8Type' AND
 comparator = 'UTF8Type' AND
 default_validation_class = 'UTF8Type' AND
 compression_options = {sstable_compression:SnappyCompressor,chunk_length_kb:64} AND
 column_metadata = [
 {column_name: 'numberOfDeloreans', validation_class: 'IntegerType', index_type: KEYS}
];
{code}

Then in cqlsh adding some data:
{code}
use Keyspace1;
update User set 'numberOfDeloreans'=0 where key = 'marty';
update User set 'userId'='themartymcfly' where key = 'marty';
{code}

In cqlsh, do
{code}select * from User where numberOfDeloreans=0;{code}

Then in thrift do:
{code}
package org.mostlyharmless;

import org.apache.cassandra.thrift.*;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;

import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;

public class ThriftQuery {

    public static void main(String[] args)
            throws TException, InvalidRequestException, UnavailableException, UnsupportedEncodingException, NotFoundException, TimedOutException
    {
        TTransport tr = new TFramedTransport(new TSocket("localhost", 9160));
        TProtocol proto = new TBinaryProtocol(tr);
        Cassandra.Client client = new Cassandra.Client(proto);
        tr.open();
        client.set_keyspace("Keyspace1");
        ColumnParent columnParent = new ColumnParent("User");
        SlicePredicate slicePredicate = new SlicePredicate();
        List<ByteBuffer> columnNames = new ArrayList<ByteBuffer>();
        columnNames.add(ByteBufferUtil.bytes("userId"));
        slicePredicate.setColumn_names(columnNames);
        KeyRange keyRange = new KeyRange();
        keyRange.setStart_token("0");
        keyRange.setEnd_token("0");
        List<IndexExpression> indexExpressions = new ArrayList<IndexExpression>();
        indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, ByteBufferUtil.bytes(0)));
        keyRange.setRow_filter(indexExpressions);
        List<KeySlice> keySlices = client.get_range_slices(columnParent, slicePredicate, keyRange, ConsistencyLevel.ONE);
        System.out.println("number of keyslices returned: " + keySlices.size());
        tr.close();
    }
}
{code}

Note that 1 record is returned in both instances.

Run nodetool drain on 1.0.8.  Start 1.1.7.  Do the cqlsh query again, returns the result.  Run the thrift code again, get 0 results.

Tried both upgradesstables and rebuild_index.  Didn't help.

    
> Upgrading from 1.0 to 1.1 makes secondary indexes no longer work
> ----------------------------------------------------------------
>
>                 Key: CASSANDRA-5023
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5023
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.7
>            Reporter: Jeremy Hanna
>
> To reproduce:
> Create column family with C* 1.0.8:
> {code}
> CREATE KEYSPACE Keyspace1 
> with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
> and strategy_options = {replication_factor:1};
> use Keyspace1;
> CREATE COLUMN FAMILY 'User' WITH
>  key_validation_class = 'UTF8Type' AND
>  comparator = 'UTF8Type' AND
>  default_validation_class = 'UTF8Type' AND
>  compression_options = {sstable_compression:SnappyCompressor,chunk_length_kb:64} AND
>  column_metadata = [
>  {column_name: 'numberOfDeloreans', validation_class: 'IntegerType', index_type: KEYS}
> ];
> {code}
> Then in cqlsh add some data:
> {code}
> use Keyspace1;
> update User set 'numberOfDeloreans'=0 where key = 'marty';
> update User set 'userId'='themartymcfly' where key = 'marty';
> {code}
> In cqlsh, do
> {code}select * from User where numberOfDeloreans=0;{code}
> Then in thrift do:
> {code}
> package org.mostlyharmless;
> import org.apache.cassandra.thrift.*;
> import org.apache.cassandra.utils.ByteBufferUtil;
> import org.apache.thrift.TException;
> import org.apache.thrift.protocol.TProtocol;
> import org.apache.thrift.transport.TFramedTransport;
> import org.apache.thrift.transport.TSocket;
> import org.apache.thrift.transport.TTransport;
> import java.io.UnsupportedEncodingException;
> import java.nio.ByteBuffer;
> import java.util.ArrayList;
> import java.util.List;
> public class ThriftQuery {
>     public static void main(String[] args)
>             throws TException, InvalidRequestException, UnavailableException, UnsupportedEncodingException, NotFoundException, TimedOutException
>     {
>         TTransport tr = new TFramedTransport(new TSocket("localhost", 9160));
>         TProtocol proto = new TBinaryProtocol(tr);
>         Cassandra.Client client = new Cassandra.Client(proto);
>         tr.open();
>         client.set_keyspace("Keyspace1");
>         ColumnParent columnParent = new ColumnParent("User");
>         SlicePredicate slicePredicate = new SlicePredicate();
>         List<ByteBuffer> columnNames = new ArrayList<ByteBuffer>();
>         columnNames.add(ByteBufferUtil.bytes("userId"));
>         slicePredicate.setColumn_names(columnNames);
>         KeyRange keyRange = new KeyRange();
>         keyRange.setStart_token("0");
>         keyRange.setEnd_token("0");
>         List<IndexExpression> indexExpressions = new ArrayList<IndexExpression>();
>         indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, ByteBufferUtil.bytes(0)));
>         keyRange.setRow_filter(indexExpressions);
>         List<KeySlice> keySlices = client.get_range_slices(columnParent, slicePredicate, keyRange, ConsistencyLevel.ONE);
>         System.out.println("number of keyslices returned: " + keySlices.size());
>         tr.close();
>     }
> }
> {code}
> Note that 1 record is returned in both instances.
> Run nodetool drain on 1.0.8.  Start 1.1.7.  Do the cqlsh query again, returns the result.  Run the thrift code again, get 0 results.
> Tried both upgradesstables and rebuild_index.  Didn't help.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-5023) Upgrading from 1.0 to 1.1 makes secondary indexes no longer work

Posted by "Jeremy Hanna (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13510019#comment-13510019 ] 

Jeremy Hanna commented on CASSANDRA-5023:
-----------------------------------------

Great - this also fixes some code that was done in hector - using the IntegerType.instance.fromString instead of hector's IntegerSerializer's toByteBuffer.  Thank you Yuki.
                
> Upgrading from 1.0 to 1.1 makes secondary indexes no longer work
> ----------------------------------------------------------------
>
>                 Key: CASSANDRA-5023
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5023
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Jeremy Hanna
>            Assignee: Yuki Morishita
>             Fix For: 1.1.8
>
>
> To reproduce:
> Create column family with C* 1.0.8:
> {code}
> CREATE KEYSPACE Keyspace1 
> with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
> and strategy_options = {replication_factor:1};
> use Keyspace1;
> CREATE COLUMN FAMILY 'User' WITH
>  key_validation_class = 'UTF8Type' AND
>  comparator = 'UTF8Type' AND
>  default_validation_class = 'UTF8Type' AND
>  compression_options = {sstable_compression:SnappyCompressor,chunk_length_kb:64} AND
>  column_metadata = [
>  {column_name: 'numberOfDeloreans', validation_class: 'IntegerType', index_type: KEYS}
> ];
> {code}
> Then in cqlsh add some data:
> {code}
> use Keyspace1;
> update User set 'numberOfDeloreans'=0 where key = 'marty';
> update User set 'userId'='themartymcfly' where key = 'marty';
> {code}
> In cqlsh, do
> {code}select * from User where numberOfDeloreans=0;{code}
> Then in thrift do:
> {code}
> package org.mostlyharmless;
> import org.apache.cassandra.thrift.*;
> import org.apache.cassandra.utils.ByteBufferUtil;
> import org.apache.thrift.TException;
> import org.apache.thrift.protocol.TProtocol;
> import org.apache.thrift.transport.TFramedTransport;
> import org.apache.thrift.transport.TSocket;
> import org.apache.thrift.transport.TTransport;
> import java.io.UnsupportedEncodingException;
> import java.nio.ByteBuffer;
> import java.util.ArrayList;
> import java.util.List;
> public class ThriftQuery {
>     public static void main(String[] args)
>             throws TException, InvalidRequestException, UnavailableException, UnsupportedEncodingException, NotFoundException, TimedOutException
>     {
>         TTransport tr = new TFramedTransport(new TSocket("localhost", 9160));
>         TProtocol proto = new TBinaryProtocol(tr);
>         Cassandra.Client client = new Cassandra.Client(proto);
>         tr.open();
>         client.set_keyspace("Keyspace1");
>         ColumnParent columnParent = new ColumnParent("User");
>         SlicePredicate slicePredicate = new SlicePredicate();
>         List<ByteBuffer> columnNames = new ArrayList<ByteBuffer>();
>         columnNames.add(ByteBufferUtil.bytes("userId"));
>         slicePredicate.setColumn_names(columnNames);
>         KeyRange keyRange = new KeyRange();
>         keyRange.setStart_token("0");
>         keyRange.setEnd_token("0");
>         List<IndexExpression> indexExpressions = new ArrayList<IndexExpression>();
>         indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, ByteBufferUtil.bytes(0)));
>         keyRange.setRow_filter(indexExpressions);
>         List<KeySlice> keySlices = client.get_range_slices(columnParent, slicePredicate, keyRange, ConsistencyLevel.ONE);
>         System.out.println("number of keyslices returned: " + keySlices.size());
>         tr.close();
>     }
> }
> {code}
> Note that 1 record is returned in both instances.
> Run nodetool drain on 1.0.8.  Start 1.1.7.  Do the cqlsh query again, returns the result.  Run the thrift code again, get 0 results.
> Tried both upgradesstables and rebuild_index.  Didn't help.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-5023) Upgrading from 1.0 to 1.1 makes secondary indexes no longer work

Posted by "Konstantin Zadorozhny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13509502#comment-13509502 ] 

Konstantin Zadorozhny commented on CASSANDRA-5023:
--------------------------------------------------

get_range_slices works fine in 1.1.6, but is broken in 1.1.7.
                
> Upgrading from 1.0 to 1.1 makes secondary indexes no longer work
> ----------------------------------------------------------------
>
>                 Key: CASSANDRA-5023
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5023
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Jeremy Hanna
>            Assignee: Yuki Morishita
>             Fix For: 1.1.8
>
>
> To reproduce:
> Create column family with C* 1.0.8:
> {code}
> CREATE KEYSPACE Keyspace1 
> with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
> and strategy_options = {replication_factor:1};
> use Keyspace1;
> CREATE COLUMN FAMILY 'User' WITH
>  key_validation_class = 'UTF8Type' AND
>  comparator = 'UTF8Type' AND
>  default_validation_class = 'UTF8Type' AND
>  compression_options = {sstable_compression:SnappyCompressor,chunk_length_kb:64} AND
>  column_metadata = [
>  {column_name: 'numberOfDeloreans', validation_class: 'IntegerType', index_type: KEYS}
> ];
> {code}
> Then in cqlsh add some data:
> {code}
> use Keyspace1;
> update User set 'numberOfDeloreans'=0 where key = 'marty';
> update User set 'userId'='themartymcfly' where key = 'marty';
> {code}
> In cqlsh, do
> {code}select * from User where numberOfDeloreans=0;{code}
> Then in thrift do:
> {code}
> package org.mostlyharmless;
> import org.apache.cassandra.thrift.*;
> import org.apache.cassandra.utils.ByteBufferUtil;
> import org.apache.thrift.TException;
> import org.apache.thrift.protocol.TProtocol;
> import org.apache.thrift.transport.TFramedTransport;
> import org.apache.thrift.transport.TSocket;
> import org.apache.thrift.transport.TTransport;
> import java.io.UnsupportedEncodingException;
> import java.nio.ByteBuffer;
> import java.util.ArrayList;
> import java.util.List;
> public class ThriftQuery {
>     public static void main(String[] args)
>             throws TException, InvalidRequestException, UnavailableException, UnsupportedEncodingException, NotFoundException, TimedOutException
>     {
>         TTransport tr = new TFramedTransport(new TSocket("localhost", 9160));
>         TProtocol proto = new TBinaryProtocol(tr);
>         Cassandra.Client client = new Cassandra.Client(proto);
>         tr.open();
>         client.set_keyspace("Keyspace1");
>         ColumnParent columnParent = new ColumnParent("User");
>         SlicePredicate slicePredicate = new SlicePredicate();
>         List<ByteBuffer> columnNames = new ArrayList<ByteBuffer>();
>         columnNames.add(ByteBufferUtil.bytes("userId"));
>         slicePredicate.setColumn_names(columnNames);
>         KeyRange keyRange = new KeyRange();
>         keyRange.setStart_token("0");
>         keyRange.setEnd_token("0");
>         List<IndexExpression> indexExpressions = new ArrayList<IndexExpression>();
>         indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, ByteBufferUtil.bytes(0)));
>         keyRange.setRow_filter(indexExpressions);
>         List<KeySlice> keySlices = client.get_range_slices(columnParent, slicePredicate, keyRange, ConsistencyLevel.ONE);
>         System.out.println("number of keyslices returned: " + keySlices.size());
>         tr.close();
>     }
> }
> {code}
> Note that 1 record is returned in both instances.
> Run nodetool drain on 1.0.8.  Start 1.1.7.  Do the cqlsh query again, returns the result.  Run the thrift code again, get 0 results.
> Tried both upgradesstables and rebuild_index.  Didn't help.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CASSANDRA-5023) Upgrading from 1.0 to 1.1 makes secondary indexes no longer work

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Ellis updated CASSANDRA-5023:
--------------------------------------

    Affects Version/s:     (was: 1.1.7)
        Fix Version/s: 1.1.8
             Assignee: Yuki Morishita
    
> Upgrading from 1.0 to 1.1 makes secondary indexes no longer work
> ----------------------------------------------------------------
>
>                 Key: CASSANDRA-5023
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5023
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Jeremy Hanna
>            Assignee: Yuki Morishita
>             Fix For: 1.1.8
>
>
> To reproduce:
> Create column family with C* 1.0.8:
> {code}
> CREATE KEYSPACE Keyspace1 
> with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
> and strategy_options = {replication_factor:1};
> use Keyspace1;
> CREATE COLUMN FAMILY 'User' WITH
>  key_validation_class = 'UTF8Type' AND
>  comparator = 'UTF8Type' AND
>  default_validation_class = 'UTF8Type' AND
>  compression_options = {sstable_compression:SnappyCompressor,chunk_length_kb:64} AND
>  column_metadata = [
>  {column_name: 'numberOfDeloreans', validation_class: 'IntegerType', index_type: KEYS}
> ];
> {code}
> Then in cqlsh add some data:
> {code}
> use Keyspace1;
> update User set 'numberOfDeloreans'=0 where key = 'marty';
> update User set 'userId'='themartymcfly' where key = 'marty';
> {code}
> In cqlsh, do
> {code}select * from User where numberOfDeloreans=0;{code}
> Then in thrift do:
> {code}
> package org.mostlyharmless;
> import org.apache.cassandra.thrift.*;
> import org.apache.cassandra.utils.ByteBufferUtil;
> import org.apache.thrift.TException;
> import org.apache.thrift.protocol.TProtocol;
> import org.apache.thrift.transport.TFramedTransport;
> import org.apache.thrift.transport.TSocket;
> import org.apache.thrift.transport.TTransport;
> import java.io.UnsupportedEncodingException;
> import java.nio.ByteBuffer;
> import java.util.ArrayList;
> import java.util.List;
> public class ThriftQuery {
>     public static void main(String[] args)
>             throws TException, InvalidRequestException, UnavailableException, UnsupportedEncodingException, NotFoundException, TimedOutException
>     {
>         TTransport tr = new TFramedTransport(new TSocket("localhost", 9160));
>         TProtocol proto = new TBinaryProtocol(tr);
>         Cassandra.Client client = new Cassandra.Client(proto);
>         tr.open();
>         client.set_keyspace("Keyspace1");
>         ColumnParent columnParent = new ColumnParent("User");
>         SlicePredicate slicePredicate = new SlicePredicate();
>         List<ByteBuffer> columnNames = new ArrayList<ByteBuffer>();
>         columnNames.add(ByteBufferUtil.bytes("userId"));
>         slicePredicate.setColumn_names(columnNames);
>         KeyRange keyRange = new KeyRange();
>         keyRange.setStart_token("0");
>         keyRange.setEnd_token("0");
>         List<IndexExpression> indexExpressions = new ArrayList<IndexExpression>();
>         indexExpressions.add(new IndexExpression(ByteBufferUtil.bytes("numberOfDeloreans"), IndexOperator.EQ, ByteBufferUtil.bytes(0)));
>         keyRange.setRow_filter(indexExpressions);
>         List<KeySlice> keySlices = client.get_range_slices(columnParent, slicePredicate, keyRange, ConsistencyLevel.ONE);
>         System.out.println("number of keyslices returned: " + keySlices.size());
>         tr.close();
>     }
> }
> {code}
> Note that 1 record is returned in both instances.
> Run nodetool drain on 1.0.8.  Start 1.1.7.  Do the cqlsh query again, returns the result.  Run the thrift code again, get 0 results.
> Tried both upgradesstables and rebuild_index.  Didn't help.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira