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

Jonathan Ellis commented on CASSANDRA-276:
------------------------------------------

looks great!

a couple things:

1)
    public static String getDataFileLocationForTable(String table)
    {
        String dataFileDirectory = dataFileDirectories_[currentIndex_] + 
File.separator + table;
        return dataFileDirectory;
    }

needs to rotate currentIndex like getCompaction or it won't rotate.

avoid creating redundant local vars like this, just return the String directly.

why do we need a separate method?  getCompaction... will do fine, or am I 
missing something? (feel free to rename it getDataFile... if you think that is 
more clear.)

2)
    public static String getCompactionFileLocationForTable(String table)
    {
        String[] dataDirectoryForTable = getAllDataFileLocationsForTable(table);
        String dataFileDirectory = dataDirectoryForTable[currentIndex_];
        currentIndex_ = (currentIndex_ + 1 )%dataDirectoryForTable.length ;
        return dataFileDirectory;
    }

this is a little confusing because there is a hidden assumption that all tables 
have the same numbers of directories.  if this ever changes you will risk 
indexoutofbounds here.  Better to just add table name to the next item from the 
global data directory list, like you did in getDataFile...

... that's it.

I do think the right thing to do is lazy directory creation (for efficiency 
when there are thousands of tables -- that's not an entirely hypothetical 
situation :) but I will make a separate ticket for that.

> use subdirectory-per-table for data files
> -----------------------------------------
>
>                 Key: CASSANDRA-276
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-276
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Jonathan Ellis
>            Assignee: Arin Sarkissian
>         Attachments: 0001-changes.patch, 
> 0001-cleanup-the-patch-for-a-second-round.patch, 
> 0001-Single-pacth-for-Cassandra-276.patch, 0002-Cassandra-276-no-WS-Diff.patch
>
>
> it's a little silly to do this in the filename when the FS will give us a 
> heirarchical structure for free.

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

Reply via email to