incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Washusen <...@reactive.org>
Subject Re: Range Queries in RP on SCF in 0.7 with UUID SCs
Date Thu, 02 Dec 2010 00:34:16 GMT
Using the methods on the Bytes class would be preferable.  The byte[]
related methods on UuidHelper should have been deprecated with the Bytes
class was introduced...

e.g. new Bytes(col.getName()).toUuid()

Cheers,
Dan

On Thu, Dec 2, 2010 at 10:26 AM, Frank LoVecchio <frank@isidorey.com> wrote:

> Actually, it was a class issue at this line:
>
> System.*out*.println("NAME: " + UUID.*nameUUIDFromBytes*(col.getName()));
>
> The native Pelops class timeUuidHelper is what should be used.
>
> On Wed, Dec 1, 2010 at 4:16 PM, Aaron Morton <aaron@thelastpickle.com>wrote:
>
>> When you say "I want to get rows starting from a Super Column..." it's a
>> bit confusing. Do you want to get super columns from a single row, or
>> multiple rows? I'm assuming you are talking about getting columns from a
>> single row / key as that's what your code does.
>>
>> For the pelops code, it looks OK but I've not used Pelops. You can turn
>> the logging up on the server and check the command that is sent to it. I'm
>> would guess there is something wrong with the way you are transforming the
>> start key
>>
>> For your cli example what was the command you executed ?
>>
>> Aaron
>>
>> On 02 Dec, 2010,at 11:03 AM, Frank LoVecchio <frank@isidorey.com> wrote:
>>
>> Hey Aaron,
>>
>>
>> Yes, in regards to SCF definition, you are correct:
>>
>>
>> name: Sensor
>>
>>       column_type: Super
>>
>>       compare_with: TimeUUIDType
>>
>>       gc_grace_seconds: 864000
>>
>>       keys_cached: 10000.0
>>
>>       read_repair_chance: 1.0
>>
>>       rows_cached: 0.0
>>
>> I'm not quite sure I follow you, though, as I think I'm doing what you
>> specify.  The Pelops code is below.  Basically, I want to get rows
>> starting from a Super Column with a specific UUID and limit the number, just
>> as you inferred.  When I run this code I just get the last N values (25 in
>> this case) if non-reversed, and the first N values if reversed.  However,
>> regardless of what start param we use (Super Column UUID is String startKey
>> below), we still get the same values for the specified amount (e.g. the same
>> 25).
>>
>> *public* *void* getSuperRowKeys(String rowKey, String columnFamily, *int* limit,
>> String startKey) *throws* Exception {
>>
>>   *byte*[] byteArray = UuidHelper.*timeUuidStringToBytes*(startKey);
>>
>>  ByteBuffer bb = ByteBuffer.*wrap*(byteArray);
>>
>>  *new* UUID (bb.getLong(), bb.getLong());
>>
>>    List<SuperColumn> cols = selector.getPageOfSuperColumnsFromRow(columnFamily,
>> rowKey, Bytes.*fromByteBuffer*(bb), *false*, limit, ConsistencyLevel.*ONE
>> *);
>>
>>
>>   *for* (SuperColumn col : cols) {
>>
>>  *if* (col.getName() != *null*) {
>>
>>
>>  System.*out*.println("NAME: " + UUID.*nameUUIDFromBytes*
>> (col.getName()));
>>
>>
>> *for* (Column c : col.columns) {
>>
>> System.*out*.println("\t\tName: " + Bytes.*toUTF8*(c.getName())
>>
>> + " Value: " + Bytes.*toUTF8*(c.getValue())
>>
>> + " timestamp: " + c.timestamp);
>>
>>
>> }
>>
>>
>> }
>>
>> }
>>
>>
>> }
>>
>> Here is some example data from the CLI.  If we specify 2f814d30-f758-11df-2f81-4d30f75811df
>> as the start param (second super column down), we still get 52e6540-f759-11df-952e-6540f75911df
>> (first super column) returned.
>>
>> => (super_column=952e6540-f759-11df-952e-6540f75911df,
>>      (column=64617465,
>> value=323031302d31312d32332032333a32393a30332e303030,
>> timestamp=1290554997141000)
>>      (column=65787472615f696e666f, value=6e6f6e65,
>> timestamp=1290554997141000)
>>      (column=726561736f6e, value=6e6f6e65, timestamp=1290554997141000)
>>      (column=7365636f6e64735f746f5f6e657874, value=373530,
>> timestamp=1290554997141000)
>>      (column=73657269616c, value=393135353032353731,
>> timestamp=1290554997141000)
>>      (column=737461747573, value=5550, timestamp=1290554997141000)
>>      (column=74797065, value=486561727462656174,
>> timestamp=1290554997141000))
>> => (super_column=2f814d30-f758-11df-2f81-4d30f75811df,
>>      (column=64617465,
>> value=323031302d31312d32332032333a31393a30332e303030,
>> timestamp=1290554397060000)
>>      (column=65787472615f696e666f, value=6e6f6e65,
>> timestamp=1290554397060000)
>>      (column=726561736f6e, value=6e6f6e65, timestamp=1290554397060000)
>>      (column=7365636f6e64735f746f5f6e657874, value=373530,
>> timestamp=1290554397060000)
>>      (column=73657269616c, value=393135353032353731,
>> timestamp=1290554397060000)
>>      (column=737461747573, value=5550, timestamp=1290554397060000)
>>      (column=74797065, value=486561727462656174,
>> timestamp=1290554397060000))
>> => (super_column=7c959f00-f757-11df-7c95-9f00f75711df,
>>      (column=64617465,
>> value=323031302d31312d32332032333a31343a30332e303030,
>> timestamp=1290554096881000)
>>      (column=65787472615f696e666f, value=6e6f6e65,
>> timestamp=1290554096881000)
>>      (column=726561736f6e, value=6e6f6e65, timestamp=1290554096881000)
>>      (column=7365636f6e64735f746f5f6e657874, value=373530,
>> timestamp=1290554096881000)
>>      (column=73657269616c, value=393135353032353731,
>> timestamp=1290554096881000)
>>      (column=737461747573, value=5550, timestamp=1290554096881000)
>>      (column=74797065, value=486561727462656174,
>> timestamp=1290554096881000))
>> => (super_column=c9be6330-f756-11df-c9be-6330f75611df,
>>      (column=64617465,
>> value=323031302d31312d32332032333a30393a30332e303030,
>> timestamp=1290553796836000)
>>      (column=65787472615f696e666f, value=6e6f6e65,
>> timestamp=1290553796836000)
>>      (column=726561736f6e, value=6e6f6e65, timestamp=1290553796836000)
>>      (column=7365636f6e64735f746f5f6e657874, value=373530,
>> timestamp=1290553796836000)
>>      (column=73657269616c, value=393135353032353731,
>> timestamp=1290553796836000)
>>      (column=737461747573, value=5550, timestamp=1290553796836000)
>>      (column=74797065, value=486561727462656174,
>> timestamp=1290553796836000))
>> => (super_column=17108150-f756-11df-1710-8150f75611df,
>>      (column=64617465,
>> value=323031302d31312d32332032333a30343a30332e303030,
>> timestamp=1290553497067000)
>>      (column=65787472615f696e666f, value=6e6f6e65,
>> timestamp=1290553497067000)
>>      (column=726561736f6e, value=6e6f6e65, timestamp=1290553497067000)
>>      (column=7365636f6e64735f746f5f6e657874, value=373530,
>> timestamp=1290553497067000)
>>      (column=73657269616c, value=393135353032353731,
>> timestamp=1290553497067000)
>>      (column=737461747573, value=5550, timestamp=1290553497067000)
>>      (column=74797065, value=486561727462656174,
>> timestamp=1290553497067000))
>> => (super_column=641da730-f755-11df-641d-a730f75511df,
>>      (column=64617465,
>> value=323031302d31312d32332032323a35393a30332e303030,
>> timestamp=1290553196836000)
>>      (column=65787472615f696e666f, value=6e6f6e65,
>> timestamp=1290553196836000)
>>      (column=726561736f6e, value=6e6f6e65, timestamp=1290553196836000)
>>      (column=7365636f6e64735f746f5f6e657874, value=373530,
>> timestamp=1290553196836000)
>>      (column=73657269616c, value=393135353032353731,
>> timestamp=1290553196836000)
>>      (column=737461747573, value=5550, timestamp=1290553196836000)
>>      (column=74797065, value=486561727462656174,
>> timestamp=1290553196836000))
>> => (super_column=4bce9420-f753-11df-4bce-9420f75311df,
>>      (column=64617465,
>> value=323031302d31312d32332032323a34343a30332e303030,
>> timestamp=1290552297060000)
>>      (column=65787472615f696e666f, value=6e6f6e65,
>> timestamp=1290552297060000)
>>      (column=726561736f6e, value=6e6f6e65, timestamp=1290552297060000)
>>      (column=7365636f6e64735f746f5f6e657874, value=373530,
>> timestamp=1290552297060000)
>>      (column=73657269616c, value=393135353032353731,
>> timestamp=1290552297060000)
>>      (column=737461747573, value=5550, timestamp=1290552297060000)
>>      (column=74797065, value=486561727462656174,
>> timestamp=1290552297060000))
>>
>> On Wed, Dec 1, 2010 at 2:25 PM, Aaron Morton <aaron@thelastpickle.com>wrote:
>>
>>> The Partitioner applies to the row keys, not the columns. Their order is
>>> determined by the compare_with and compare_subcolumns_with CF settings
>>>
>>> So where you say "get the last 25 inserts for a key" I'm translating that
>>> into "get the most recent 25 super columns for a row, where the super column
>>> names are UUID's and the CF definition has compare_with:  TimeUUIDType"
>>>
>>> You can send a get_slice where the SliceRange has count=25 and
>>> reversed=True. If you know the 25th col name you can use it as the start
>>> param, and AFAIK the operation would go faster Not sure how this translates
>>> into calls against Pelops.
>>>
>>> This assumes you are using time / v1 UUID's that have an increasing
>>> order.
>>>
>>> Hope that helps.
>>>
>>> Aaron
>>>
>>>
>>>
>>> On 02 Dec, 2010,at 09:19 AM, Frank LoVecchio <frank@isidorey.com> wrote:
>>>
>>> Is it possible to perform paginated queries using Random Partitioner in
>>> 0.7 with Super Column Families whose Super Columns are UUID's?  I don't
>>> believe it is, based on this article:
>>> http://ria101.wordpress.com/2010/02/22/cassandra-randompartitioner-vs-orderpreservingpartitioner,
>>> and my attempts with Pelops.
>>>
>>> Let's say I get the last 25 inserts for a key.  I now know the 25th Super
>>> Column UUID, and I want to start from there and get the next 25 inserts.  Do
>>> I have to change over to Order Preserving Partitioner?  I'd like to avoid
>>> this at all costs.
>>>
>>> Thanks,
>>>
>>> Frank
>>>
>>>
>>
>

Mime
View raw message