cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Hanna (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-5023) Upgrading from 1.0 to 1.1 makes secondary indexes no longer work
Date Mon, 03 Dec 2012 21:49:58 GMT

     [ 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

Mime
View raw message