You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jonathan Ellis (JIRA)" <ji...@apache.org> on 2010/08/25 17:58:18 UTC

[jira] Commented: (CASSANDRA-1415) Allow creating indexes on existing data

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

Jonathan Ellis commented on CASSANDRA-1415:
-------------------------------------------

01 changes the index creation approach used when building the index from the data file after streaming.  the old approach scans through the new data file and applies the data in those row fragments to the index, but this is buggy: if the data file contains old data, or newer data arrives via a write after the file is streamed, we will corrupt our index.  instead, 01 creates a Table.rebuildIndex method that scans the index columns from the _entire_ row (that is, merged w/ other sstables), with locking so that when we scan that row, we're guaranteed that it's the most recent version.  The KeyIterator class is what we use to tell this scanner what keys to index.  (We don't use getRangeSlice because the streamed rows aren't guaranteed to be contiguous.)  The rebuild is done in the CompactionManager executor to avoid excessive i/o conflicts.

02 is a simple refactor, pulling addIndex out of CFS constructor.

03 extends addIndex to adding indexes that weren't previously defined.  we add INDEX_CF to record when an index is created; if addIndex is called for one that doesn't exist, we initiate the build using a KeyIterator that merges all keys from all sstables.  This makes sure that if we add an index, and the index build doesn't complete before the server is restarted, the build will restart too.

> Allow creating indexes on existing data
> ---------------------------------------
>
>                 Key: CASSANDRA-1415
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-1415
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Core
>    Affects Versions: 0.7 beta 1
>            Reporter: Jonathan Ellis
>            Assignee: Jonathan Ellis
>             Fix For: 0.7 beta 2
>
>         Attachments: 0001-Table.rebuildIndex.txt, 0002-extract-addIndex-method.txt, 0003-allow-addIndex-to-create-indexes-that-did-not-previous.txt
>
>
> (This ticket is only for the index-CF creation part, not for the thrift API changes, which may come for free from CASSANDRA-1285)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.