mirror of https://github.com/apache/cassandra
fix CME during range queries -- keyset call needs to go on the memtable exector.
patch by jbellis; tested by Tv for CASSANDRA-153 git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@773152 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
426bf0f450
commit
44a0a3a54d
|
|
@ -399,9 +399,16 @@ public class Memtable implements Comparable<Memtable>
|
|||
}
|
||||
}
|
||||
|
||||
public Iterator<String> sortedKeyIterator()
|
||||
public Iterator<String> sortedKeyIterator() throws ExecutionException, InterruptedException
|
||||
{
|
||||
Set<String> keys = columnFamilies_.keySet();
|
||||
Callable<Set<String>> callable = new Callable<Set<String>>()
|
||||
{
|
||||
public Set<String> call() throws Exception
|
||||
{
|
||||
return columnFamilies_.keySet();
|
||||
}
|
||||
};
|
||||
Set<String> keys = executor_.submit(callable).get();
|
||||
if (keys.size() == 0)
|
||||
{
|
||||
// cannot create a PQ of size zero (wtf?)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.io.File;
|
|||
import java.io.FileNotFoundException;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.commons.collections.Predicate;
|
||||
|
|
@ -870,7 +871,7 @@ public class Table
|
|||
* @param maxResults
|
||||
* @return list of keys between startWith and stopAt
|
||||
*/
|
||||
public List<String> getKeyRange(final String startWith, final String stopAt, int maxResults) throws IOException
|
||||
public List<String> getKeyRange(final String startWith, final String stopAt, int maxResults) throws IOException, ExecutionException, InterruptedException
|
||||
{
|
||||
// (OPP key decoration is a no-op so using the "decorated" comparator against raw keys is fine)
|
||||
final Comparator<String> comparator = StorageService.getPartitioner().getDecoratedKeyComparator();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class RangeVerbHandler implements IVerbHandler
|
|||
Table table = Table.open(command.table);
|
||||
keys = table.getKeyRange(command.startWith, command.stopAt, command.maxResults);
|
||||
}
|
||||
catch (IOException e)
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue