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

Cathy Daw commented on CASSANDRA-3367:
--------------------------------------

* I waited until I saw in the log files that the index completion completed, 
and then queried the existing rows, and they still do not show up, regardless 
of whether or not new rows were inserted.

* Another interesting observation.  The log file snippet is from a clean 
database.  But if I create table / create index, and then drop table, it seems 
that the second time I create table / create index, the log files only show the 
Create log message, and not subsequent Submit, Flush, Complete messages.

{code}
INFO [MigrationStage:1] 2011-10-15 19:16:51,916 Migration.java (line 119) 
Applying migration e91d8660-f79c-11e0-0000-242d50cf1fff Update column family to 
org.apache.cassandra.config.CFMetaData@2310195c[cfId=1012,ksName=ks1,cfName=users,cfType=Standard,comparator=org.apache.cassandra.db.marshal.UTF8Type,subcolumncomparator=<null>,comment=,rowCacheSize=0.0,keyCacheSize=200000.0,readRepairChance=1.0,replicateOnWrite=true,gcGraceSeconds=864000,defaultValidator=org.apache.cassandra.db.marshal.UTF8Type,keyValidator=org.apache.cassandra.db.marshal.UTF8Type,minCompactionThreshold=4,maxCompactionThreshold=32,rowCacheSavePeriodInSeconds=0,keyCacheSavePeriodInSeconds=14400,rowCacheKeysToSave=2147483647,rowCacheProvider=org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider@75f0f8ff,mergeShardsChance=0.1,keyAlias=java.nio.HeapByteBuffer[pos=481
 lim=484 cap=581],column_metadata={java.nio.HeapByteBuffer[pos=0 lim=10 
cap=10]=ColumnDefinition{name=62697274685f79656172, 
validator=org.apache.cassandra.db.marshal.LongType, index_type=KEYS, 
index_name='users_birth_year_idx'}, java.nio.HeapByteBuffer[pos=0 lim=6 
cap=6]=ColumnDefinition{name=67656e646572, 
validator=org.apache.cassandra.db.marshal.UTF8Type, index_type=KEYS, 
index_name='users_gender_idx'}, java.nio.HeapByteBuffer[pos=0 lim=8 
cap=8]=ColumnDefinition{name=70617373776f7264, 
validator=org.apache.cassandra.db.marshal.UTF8Type, index_type=null, 
index_name='null'}, java.nio.HeapByteBuffer[pos=0 lim=13 
cap=13]=ColumnDefinition{name=73657373696f6e5f746f6b656e, 
validator=org.apache.cassandra.db.marshal.UTF8Type, index_type=null, 
index_name='null'}, java.nio.HeapByteBuffer[pos=0 lim=5 
cap=5]=ColumnDefinition{name=7374617465, 
validator=org.apache.cassandra.db.marshal.UTF8Type, index_type=KEYS, 
index_name='users_state_idx'}},compactionStrategyClass=class 
org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy,compactionStrategyOptions={},compressionOptions={}]
 INFO [MigrationStage:1] 2011-10-15 19:16:51,916 ColumnFamilyStore.java (line 
664) Enqueuing flush of Memtable-Migrations@527133143(11721/14651 
serialized/live bytes, 1 ops)
 INFO [FlushWriter:1] 2011-10-15 19:16:51,916 Memtable.java (line 237) Writing 
Memtable-Migrations@527133143(11721/14651 serialized/live bytes, 1 ops)
 INFO [MigrationStage:1] 2011-10-15 19:16:51,917 ColumnFamilyStore.java (line 
664) Enqueuing flush of Memtable-Schema@1156690526(6937/8671 serialized/live 
bytes, 6 ops)
 INFO [FlushWriter:1] 2011-10-15 19:16:51,922 Memtable.java (line 273) 
Completed flushing /var/lib/cassandra/data/system/Migrations-h-9-Data.db (11785 
bytes)
 INFO [FlushWriter:1] 2011-10-15 19:16:51,922 Memtable.java (line 237) Writing 
Memtable-Schema@1156690526(6937/8671 serialized/live bytes, 6 ops)
 INFO [CompactionExecutor:11] 2011-10-15 19:16:51,923 CompactionTask.java (line 
119) Compacting 
[SSTableReader(path='/var/lib/cassandra/data/system/Migrations-h-5-Data.db'), 
SSTableReader(path='/var/lib/cassandra/data/system/Migrations-h-9-Data.db'), 
SSTableReader(path='/var/lib/cassandra/data/system/Migrations-h-8-Data.db'), 
SSTableReader(path='/var/lib/cassandra/data/system/Migrations-h-7-Data.db')]
 INFO [FlushWriter:1] 2011-10-15 19:16:51,925 Memtable.java (line 273) 
Completed flushing /var/lib/cassandra/data/system/Schema-h-9-Data.db (7087 
bytes)
 INFO [CompactionExecutor:12] 2011-10-15 19:16:51,926 CompactionTask.java (line 
119) Compacting 
[SSTableReader(path='/var/lib/cassandra/data/system/Schema-h-9-Data.db'), 
SSTableReader(path='/var/lib/cassandra/data/system/Schema-h-8-Data.db'), 
SSTableReader(path='/var/lib/cassandra/data/system/Schema-h-7-Data.db'), 
SSTableReader(path='/var/lib/cassandra/data/system/Schema-h-5-Data.db')]
 INFO [MigrationStage:1] 2011-10-15 19:16:51,927 SecondaryIndexManager.java 
(line 181) Creating new index : ColumnDefinition{name=62697274685f79656172, 
validator=org.apache.cassandra.db.marshal.LongType, index_type=KEYS, 
index_name='users_birth_year_idx'}
 INFO [MigrationStage:1] 2011-10-15 19:16:51,928 SecondaryIndexManager.java 
(line 181) Creating new index : ColumnDefinition{name=67656e646572, 
validator=org.apache.cassandra.db.marshal.UTF8Type, index_type=KEYS, 
index_name='users_gender_idx'}
 INFO [Creating index: users.users_birth_year_idx] 2011-10-15 19:16:51,928 
ColumnFamilyStore.java (line 664) Enqueuing flush of 
Memtable-users@606630071(218/272 serialized/live bytes, 8 ops)
 INFO [FlushWriter:1] 2011-10-15 19:16:51,928 Memtable.java (line 237) Writing 
Memtable-users@606630071(218/272 serialized/live bytes, 8 ops)
 INFO [MigrationStage:1] 2011-10-15 19:16:51,929 SecondaryIndexManager.java 
(line 181) Creating new index : ColumnDefinition{name=7374617465, 
validator=org.apache.cassandra.db.marshal.UTF8Type, index_type=KEYS, 
index_name='users_state_idx'}
 INFO [Creating index: users.users_gender_idx] 2011-10-15 19:16:51,929 
SecondaryIndex.java (line 145) Submitting index build of users.users_gender_idx 
for data in 
 INFO [Creating index: users.users_gender_idx] 2011-10-15 19:16:51,931 
ColumnFamilyStore.java (line 664) Enqueuing flush of 
Memtable-IndexInfo@1938552511(37/46 serialized/live bytes, 1 ops)
 INFO [Creating index: users.users_state_idx] 2011-10-15 19:16:51,931 
SecondaryIndex.java (line 145) Submitting index build of users.users_state_idx 
for data in 
 INFO [FlushWriter:1] 2011-10-15 19:16:51,932 Memtable.java (line 273) 
Completed flushing /var/lib/cassandra/data/ks1/users-h-1-Data.db (328 bytes)
 INFO [FlushWriter:1] 2011-10-15 19:16:51,934 Memtable.java (line 237) Writing 
Memtable-IndexInfo@1938552511(37/46 serialized/live bytes, 1 ops)
 INFO [Creating index: users.users_birth_year_idx] 2011-10-15 19:16:51,935 
SecondaryIndex.java (line 145) Submitting index build of 
users.users_birth_year_idx for data in 
SSTableReader(path='/var/lib/cassandra/data/ks1/users-h-1-Data.db')
 INFO [Creating index: users.users_state_idx] 2011-10-15 19:16:51,935 
ColumnFamilyStore.java (line 664) Enqueuing flush of 
Memtable-IndexInfo@1862007600(36/45 serialized/live bytes, 1 ops)
 INFO [CompactionExecutor:11] 2011-10-15 19:16:51,936 CompactionTask.java (line 
222) Compacted to [/var/lib/cassandra/data/system/Migrations-h-10-Data.db,].  
77,850 to 77,762 (~99% of original) bytes for 1 keys at 6.179969MBPS.  Time: 
12ms.
 INFO [Creating index: users.users_birth_year_idx] 2011-10-15 19:16:51,938 
ColumnFamilyStore.java (line 664) Enqueuing flush of 
Memtable-users.users_birth_year_idx@1181487996(40/50 serialized/live bytes, 2 
ops)
 INFO [FlushWriter:1] 2011-10-15 19:16:51,939 Memtable.java (line 273) 
Completed flushing /var/lib/cassandra/data/system/IndexInfo-h-7-Data.db (90 
bytes)

-- INFO [Creating index: users.users_gender_idx] 2011-10-15 19:16:51,939 
SecondaryIndex.java (line 182) Index build of users.users_gender_idx complete*

 INFO [FlushWriter:1] 2011-10-15 19:16:51,939 Memtable.java (line 237) Writing 
Memtable-IndexInfo@1862007600(36/45 serialized/live bytes, 1 ops)
 INFO [CompactionExecutor:12] 2011-10-15 19:16:51,942 CompactionTask.java (line 
222) Compacted to [/var/lib/cassandra/data/system/Schema-h-10-Data.db,].  
44,714 to 44,387 (~99% of original) bytes for 8 keys at 2.645671MBPS.  Time: 
16ms.
 INFO [FlushWriter:1] 2011-10-15 19:16:51,943 Memtable.java (line 273) 
Completed flushing /var/lib/cassandra/data/system/IndexInfo-h-8-Data.db (89 
bytes)

-- INFO [Creating index: users.users_state_idx] 2011-10-15 19:16:51,944 
SecondaryIndex.java (line 182) Index build of users.users_state_idx complete*

 INFO [FlushWriter:1] 2011-10-15 19:16:51,944 Memtable.java (line 237) Writing 
Memtable-users.users_birth_year_idx@1181487996(40/50 serialized/live bytes, 2 
ops)
 INFO [FlushWriter:1] 2011-10-15 19:16:51,947 Memtable.java (line 273) 
Completed flushing 
/var/lib/cassandra/data/ks1/users.users_birth_year_idx-h-1-Data.db (156 bytes)
 INFO [Creating index: users.users_birth_year_idx] 2011-10-15 19:16:51,948 
ColumnFamilyStore.java (line 664) Enqueuing flush of 
Memtable-IndexInfo@716920921(41/51 serialized/live bytes, 1 ops)
 INFO [FlushWriter:1] 2011-10-15 19:16:51,948 Memtable.java (line 237) Writing 
Memtable-IndexInfo@716920921(41/51 serialized/live bytes, 1 ops)
 INFO [FlushWriter:1] 2011-10-15 19:16:51,951 Memtable.java (line 273) 
Completed flushing /var/lib/cassandra/data/system/IndexInfo-h-9-Data.db (94 
bytes)

-- INFO [Creating index: users.users_birth_year_idx] 2011-10-15 19:16:51,952 
SecondaryIndex.java (line 182) Index build of users.users_birth_year_idx 
complete

 INFO [CompactionExecutor:1] 2011-10-15 19:16:51,952 CompactionTask.java (line 
119) Compacting 
[SSTableReader(path='/var/lib/cassandra/data/system/IndexInfo-h-5-Data.db'), 
SSTableReader(path='/var/lib/cassandra/data/system/IndexInfo-h-9-Data.db'), 
SSTableReader(path='/var/lib/cassandra/data/system/IndexInfo-h-7-Data.db'), 
SSTableReader(path='/var/lib/cassandra/data/system/IndexInfo-h-8-Data.db')]
 INFO [CompactionExecutor:1] 2011-10-15 19:16:51,960 CompactionTask.java (line 
222) Compacted to [/var/lib/cassandra/data/system/IndexInfo-h-10-Data.db,].  
522 to 416 (~79% of original) bytes for 2 keys at 0.056676MBPS.  Time: 7ms.
{code}
                
> data created before index is not returned in where query
> --------------------------------------------------------
>
>                 Key: CASSANDRA-3367
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3367
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.0
>            Reporter: Cathy Daw
>
> *CQL version of bug*
> {code}
> // CREATE KS AND CF  
> CREATE KEYSPACE ks1 with 
>   strategy_class =  
>     'org.apache.cassandra.locator.SimpleStrategy' 
>   and strategy_options:replication_factor=1;
> use ks1;
> DROP COLUMNFAMILY users;
> CREATE COLUMNFAMILY users (
>   KEY varchar PRIMARY KEY, password varchar, gender varchar,
>   session_token varchar, state varchar, birth_year bigint);
> // INSERT DATA
> INSERT INTO users (KEY, password, gender, state, birth_year) VALUES ('user1', 
> 'ch@ngem3a', 'f', 'TX', '1968');    
> INSERT INTO users (KEY, password, gender, state, birth_year) VALUES ('user2', 
> 'ch@ngem3b', 'm', 'CA', '1971');    
> // CREATE INDEX
> CREATE INDEX gender_key ON users (gender);
> CREATE INDEX state_key ON users (state);
> CREATE INDEX birth_year_key ON users (birth_year);
> // INSERT DATA
> INSERT INTO users (KEY, password, gender, state, birth_year) VALUES ('user3', 
> 'ch@ngem3c', 'f', 'FL', '1978');    
> INSERT INTO users (KEY, password, gender, state, birth_year) VALUES ('user4', 
> 'ch@ngem3d', 'm', 'TX', '1974'); 
> // VERIFY DATA
> cqlsh> select * from users;
>    KEY | birth_year | gender |  password | state |
>  user1 |       1968 |      f | ch@ngem3a |    TX |
>  user4 |       1974 |      m | ch@ngem3d |    TX |
>  user3 |       1978 |      f | ch@ngem3c |    FL |
>  user2 |       1971 |      m | ch@ngem3b |    CA |
> //BUG : missing row from user1, created before index was added
> cqlsh> select * from users where state='TX';
>    KEY | birth_year | gender |  password | state |
>  user4 |       1974 |      m | ch@ngem3d |    TX |
> //BUG : missing row from user2, created before index was added
> cqlsh> select * from users where state='CA';
> {code}
> *CLI version of bug*
> {code}
> // CREATE KS AND CF  
> CREATE keyspace ks1 with
>   placement_strategy = 
>     'org.apache.cassandra.locator.SimpleStrategy'
>   and strategy_options = [{replication_factor:1}];
> use ks1;
> drop column family users;
> create column family users
>       with comparator = UTF8Type
>       and key_validation_class = UTF8Type
>       and default_validation_class = UTF8Type
>       and column_metadata = [{column_name: password, 
> validation_class:UTF8Type}
>       {column_name: gender, validation_class: UTF8Type},
>       {column_name: session_token, validation_class: UTF8Type},
>       {column_name: state, validation_class: UTF8Type},
>       {column_name: birth_year, validation_class: LongType}];
> // INSERT DATA        
> set users['user1']['password']='ch@ngem3a';
> set users['user1']['gender']='f';
> set users['user1']['state']='TX';
> set users['user1']['birth_year']='1968';
> set users['user2']['password']='ch@ngem3b';
> set users['user2']['gender']='m';
> set users['user2']['state']='CA';
> set users['user2']['birth_year']='1971';
> // ADD INDEX  
> update column family users
>       with comparator = UTF8Type
>       and key_validation_class = UTF8Type
>       and default_validation_class = UTF8Type
>       and column_metadata = [{column_name: password, 
> validation_class:UTF8Type}
>       {column_name: gender, validation_class: UTF8Type, index_type: KEYS},
>       {column_name: session_token, validation_class: UTF8Type},
>       {column_name: state, validation_class: UTF8Type, index_type: KEYS},
>       {column_name: birth_year, validation_class: LongType, index_type: 
> KEYS}];
> // INSERT DATA
> set users['user3']['password']='ch@ngem3b';
> set users['user3']['gender']='f';
> set users['user3']['state']='FL';
> set users['user3']['birth_year']='1978';
> set users['user4']['password']='ch@ngem3c';
> set users['user4']['gender']='m';
> set users['user4']['state']='TX';
> set users['user4']['birth_year']='1974';
> // VERIFY DATA
> [default@cqldb] list users;
> Using default limit of 100
> -------------------
> RowKey: user1
> => (column=birth_year, value=1968, timestamp=1318714655921000)
> => (column=gender, value=f, timestamp=1318714655917000)
> => (column=password, value=ch@ngem3a, timestamp=1318714655908000)
> => (column=state, value=TX, timestamp=1318714655919000)
> -------------------
> RowKey: user4
> => (column=birth_year, value=1974, timestamp=1318714671608000)
> => (column=gender, value=m, timestamp=1318714670666000)
> => (column=password, value=ch@ngem3c, timestamp=1318714670665000)
> => (column=state, value=TX, timestamp=1318714670668000)
> -------------------
> RowKey: user3
> => (column=birth_year, value=1978, timestamp=1318714670662000)
> => (column=gender, value=f, timestamp=1318714670657000)
> => (column=password, value=ch@ngem3b, timestamp=1318714670654000)
> => (column=state, value=FL, timestamp=1318714670660000)
> -------------------
> RowKey: user2
> => (column=birth_year, value=1971, timestamp=1318714657353000)
> => (column=gender, value=m, timestamp=1318714655924000)
> => (column=password, value=ch@ngem3b, timestamp=1318714655923000)
> => (column=state, value=CA, timestamp=1318714655926000)
> 4 Rows Returned.
> //BUG : missing row from user1, created before index was added
> [default@cqldb] get users where state='TX';
> -------------------
> RowKey: user4
> => (column=birth_year, value=1974, timestamp=1318714671608000)
> => (column=gender, value=m, timestamp=1318714670666000)
> => (column=password, value=ch@ngem3c, timestamp=1318714670665000)
> => (column=state, value=TX, timestamp=1318714670668000)
> //BUG : missing row from user2, created before index was added
> [default@cqldb] get users where state='CA';
> 0 Row Returned.
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to