get_range_slices always returns super columns that's been removed/restored, regardless of count
value in slicerange
-------------------------------------------------------------------------------------------------------------------
Key: CASSANDRA-1591
URL: https://issues.apache.org/jira/browse/CASSANDRA-1591
Project: Cassandra
Issue Type: Bug
Affects Versions: 0.6.4
Environment: CentOS 5.4, single Cassandra node
Reporter: Jianing hu
I'm seeing cases where the count in slicerange predicate is not respected. This is only happening
for super columns. I'm running Cassandra 0.6.4 in a single node.
Steps to reproduce, using the Keyspace1.Super1 CF:
* insert three super columns, bar1 bar 2, and bar3, under the same key
* delete bar1
* insert bar1 again
* run a get_range_slices on Super1, with start=bar1, finish=bar3, and count=1
* I expected only bar1 to be returned, but both both bar1 and bar2 are returned. bar3 isn't,
though. so count is somewhat respected.
perl code to reproduce follows:
#!/usr/bin/perl
use strict;
use Data::Dumper;
use Net::Cassandra;
my $key = 10;
my $cs = new Net::Cassandra( hostname => 'localhost' )->client;
my $ts = time;
$cs->batch_mutate(
'Keyspace1',
{
$key => {
Super1 => [
new Net::Cassandra::Backend::Mutation({
column_or_supercolumn => new Net::Cassandra::Backend::ColumnOrSuperColumn({
super_column => new Net::Cassandra::Backend::SuperColumn({
name => 'bar1',
columns => [
new Net::Cassandra::Backend::Column({
name => 'foo1',
value => 'foo1',
timestamp => $ts++
})
]
})
})
}),
new Net::Cassandra::Backend::Mutation({
column_or_supercolumn => new Net::Cassandra::Backend::ColumnOrSuperColumn({
super_column => new Net::Cassandra::Backend::SuperColumn({
name => 'bar2',
columns => [
new Net::Cassandra::Backend::Column({
name => 'foo1',
value => 'foo1',
timestamp => $ts++
})
]
})
})
}),
new Net::Cassandra::Backend::Mutation({
column_or_supercolumn => new Net::Cassandra::Backend::ColumnOrSuperColumn({
super_column => new Net::Cassandra::Backend::SuperColumn({
name => 'bar3',
columns => [
new Net::Cassandra::Backend::Column({
name => 'foo1',
value => 'foo1',
timestamp => $ts++
})
]
})
})
})
]
}
},
Net::Cassandra::Backend::ConsistencyLevel::ONE
);
warn 'with fresh data';
# expect bar1
warn Dumper $cs->get_range_slices(
'Keyspace1',
new Net::Cassandra::Backend::ColumnParent({
column_family => 'Super1',
}),
new Net::Cassandra::Backend::SlicePredicate({
slice_range => new Net::Cassandra::Backend::SliceRange({
start => 'bar1',
finish => 'bar3',
count => 1
})
}),
new Net::Cassandra::Backend::KeyRange({
start_key => $key,
end_key => $key,
count => 1
}),
Net::Cassandra::Backend::ConsistencyLevel::ONE
);
$cs->remove(
'Keyspace1',
$key,
new Net::Cassandra::Backend::ColumnPath({
column_family => 'Super1',
super_column => 'bar1'
}),
$ts++,
Net::Cassandra::Backend::ConsistencyLevel::ONE
);
'warn after delete';
# expect bar2
warn Dumper $cs->get_range_slices(
'Keyspace1',
new Net::Cassandra::Backend::ColumnParent({
column_family => 'Super1',
}),
new Net::Cassandra::Backend::SlicePredicate({
slice_range => new Net::Cassandra::Backend::SliceRange({
start => 'bar1',
finish => 'bar3',
count => 1
})
}),
new Net::Cassandra::Backend::KeyRange({
start_key => $key,
end_key => $key,
count => 1
}),
Net::Cassandra::Backend::ConsistencyLevel::ONE
);
$cs->batch_mutate(
'Keyspace1',
{
$key => {
Super1 => [
new Net::Cassandra::Backend::Mutation({
column_or_supercolumn => new Net::Cassandra::Backend::ColumnOrSuperColumn({
super_column => new Net::Cassandra::Backend::SuperColumn({
name => 'bar1',
columns => [
new Net::Cassandra::Backend::Column({
name => 'foo1',
value => 'foo1',
timestamp => $ts++
})
]
})
})
}),
]
}
},
Net::Cassandra::Backend::ConsistencyLevel::ONE
);
warn 'after restore data';
# expect bar1, but get both bar1 and bar2, not bar3, though. so count is somewhat respected.
warn Dumper $cs->get_range_slices(
'Keyspace1',
new Net::Cassandra::Backend::ColumnParent({
column_family => 'Super1',
}),
new Net::Cassandra::Backend::SlicePredicate({
slice_range => new Net::Cassandra::Backend::SliceRange({
start => 'bar1',
finish => 'bar3',
count => 1
})
}),
new Net::Cassandra::Backend::KeyRange({
start_key => $key,
end_key => $key,
count => 1
}),
Net::Cassandra::Backend::ConsistencyLevel::ONE
);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
|