I'm trying to use get_range_by_token to do a mass delete against one of my CFs. But, after awhile, I'll get a glitch that causes the process to die (usually a timeout).
I could attack the settings on timeouts/retries, but a more fundamental solution would be to note the key where I left off and start from there. But I'm not sure if I can mix & match keys/tokens.
Right now my code is basically:
...setup stuff, including $localCassandra connection string...
$systemManager = new SystemManager($localCassandra);
$ring = $systemManager->describe_ring($keyspace);
...find $startToken/$endToken by finding myself in $ring...
$pool = new ConnectionPool($keyspace, array($localCassandra));
$column_family = new ColumnFamily($pool, $cf);
foreach ($column_family->get_range_by_token($startToken, $endToken, null) as $key => $columns) {
...do stuff...
}
Digging into the code, it seems like it boils down to the KeyRange argument to get_range_slices. get_range sets KeyRange->start_key and KeyRange->end_key. get_range_by_token sets either KeyRange->start_token or KeyRange->start_key (depending on first call vs Nth) and KeyRange->end_token.
I don't see a way to do "start with key, end with token", which is what I'd need for a proper "resume", right?
wil