-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
To improve accord interoperability test coverage, need to extend the harry model domain to handle more possible CQL states #3785
Conversation
@@ -536,7 +536,7 @@ protected ByteBuffer getValue(TableMetadata metadata, DecoratedKey partitionKey, | |||
return row.clustering().bufferAt(column.position()); | |||
default: | |||
Cell<?> cell = row.getCell(column); | |||
return cell == null ? null : cell.buffer(); | |||
return cell == null || cell.isTombstone() || !cell.isLive(nowInSec) ? null : cell.buffer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backport
commit 4fc8bb29fcda935728d8863a4499fa0e9d924b82
Author: Sunil Ramchandra Pawar <[email protected]>
Date: Tue Jan 7 08:58:48 2025 -0800
IndexOutOfBoundsException when accessing partition where the column was deleted
patch by Sunil Ramchandra Pawar; reviewed by Caleb Rackliffe, David Capwell for CASSANDRA-20108
as these tests detect this issue
import accord.utils.Property; | ||
import org.apache.cassandra.service.consensus.TransactionalMode; | ||
|
||
public class AccordInteropSingleNodeTableWalkTest extends SingleNodeTableWalkTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think im going to drop all Interop tests for now as they are all broken... Ariel has a patch in-flight to fix known issues... so rather than blocking this patch its prob best to just skip testing accord for now...
@@ -223,7 +232,7 @@ private RowState updateRowState(RowState currentState, IntFunction<Bijections.Bi | |||
|
|||
assert lts >= currentState.lts[i] : String.format("Out-of-order LTS: %d. Max seen: %s", lts, currentState.lts[i]); // sanity check; we're iterating in lts order | |||
|
|||
if (currentState.lts[i] == lts) | |||
if (lts != MagicConstants.NO_TIMESTAMP && currentState.lts[i] == lts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ast
tests down track timestamps so this would always hit this branch causing test failures... needed to disable this logic when doing a write and just assume that the write is newer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"down track"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, bad sentence.
the ast tests in this PR do not track timestamps, they rely on server to calculate them. The existing logic expects harry to own the timestamps and update the lts
, so i need a way to opt-out of this behavior; hence this change.
When the caller defines the lts
as NO_TIMESTAMP
that tells harry to just accept the write and override, rather than try to deal with timestamp conflicts
@@ -2554,6 +2554,36 @@ public void filteringOnStaticColumnTest() throws Throwable | |||
}); | |||
} | |||
|
|||
@Test | |||
public void filteringOnDeletedStaticColumnValue() throws Throwable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
part of
commit 4fc8bb29fcda935728d8863a4499fa0e9d924b82
Author: Sunil Ramchandra Pawar <[email protected]>
Date: Tue Jan 7 08:58:48 2025 -0800
IndexOutOfBoundsException when accessing partition where the column was deleted
patch by Sunil Ramchandra Pawar; reviewed by Caleb Rackliffe, David Capwell for CASSANDRA-20108
@@ -45,4 +55,42 @@ public void dnsDomainName() | |||
{ | |||
qt().forAll(Generators.DNS_DOMAIN_NAME).checkAssert(InternetDomainName::from); | |||
} | |||
|
|||
@Test | |||
public void asciiDeterministic() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I found a deterministic issue with text but it ended up being an issue with IntelliJ displaying texts... these tests didn't solve any problem but did tell me that could be the issue...
by default text types now display a descriptor rather than the raw text, and lets you override and show the text with a flag... one issue is that the text displayed by IntelliJ might not be the exact string which can make repos harder....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think i finally found the issue... when the utf-8 strings have control chars this can cause intellij to produce bad output... I added logic to convert those to escaped chars so the string output is safe. This also makes it more clear what chars are present as
could be anything
|
||
import org.agrona.collections.Object2IntHashMap; | ||
|
||
public class ImmutableUniqueList<T> extends AbstractList<T> implements RandomAccess |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
java doesn't allow a List
to also be a Set
as they have method conflicts... so this List
has the same properties of a Set
but also maintain the insertion order dependent properties of List
.
LinkedHashSet
wasn't enough as the accesses pattern of index -> Value
was cumbersome...
ec4d401
to
d4639b2
Compare
import org.apache.cassandra.distributed.Cluster; | ||
import org.apache.cassandra.service.consensus.TransactionalMode; | ||
|
||
public class MultiNodeTableWalkTest extends SingleNodeTableWalkTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test is currently not stable.... filed 3 tickets last night due to this test...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing really earth shattering found.
test/distributed/org/apache/cassandra/distributed/shared/ClusterUtils.java
Outdated
Show resolved
Hide resolved
test/distributed/org/apache/cassandra/distributed/shared/ClusterUtils.java
Outdated
Show resolved
Hide resolved
test/distributed/org/apache/cassandra/distributed/shared/ClusterUtils.java
Outdated
Show resolved
Hide resolved
else | ||
{ | ||
NavigableSet<Clustering<ByteBuffer>> clusteringKeys = partition.clusteringKeys(); | ||
Clustering<ByteBuffer> clusteringKey = rs.pickOrderedSet(clusteringKeys); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ranges of clustering keys or is that not a priority RN because Accord doesn't interact with clustering keys much?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't ranges. We have selected a partition we wish to query, we look at all the clustering keys (aka rows) present in the partition, and we select one of them.
The goal of this else
block is to pick a "row" to query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh my suggestion was to add ranges of clustering keys, not implying that it currently does that. We can call it out of scope for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we actually had range support, and between... i dropped from this PR but its in #3844
the big issue is the existence of bugs on trunk.
Ill leave a TODO to add partition restricted clustering key filter command... WHERE pk=? and ck BETWEEN ? AND ?
test/distributed/org/apache/cassandra/distributed/test/cql3/SingleNodeTableWalkTest.java
Show resolved
Hide resolved
test/harry/main/org/apache/cassandra/harry/model/ASTSingleTableModel.java
Outdated
Show resolved
Hide resolved
test/harry/main/org/apache/cassandra/harry/model/ASTSingleTableModel.java
Outdated
Show resolved
Hide resolved
test/harry/main/org/apache/cassandra/harry/model/BytesPartitionState.java
Show resolved
Hide resolved
test/harry/main/org/apache/cassandra/harry/model/BytesPartitionState.java
Show resolved
Hide resolved
@@ -223,7 +232,7 @@ private RowState updateRowState(RowState currentState, IntFunction<Bijections.Bi | |||
|
|||
assert lts >= currentState.lts[i] : String.format("Out-of-order LTS: %d. Max seen: %s", lts, currentState.lts[i]); // sanity check; we're iterating in lts order | |||
|
|||
if (currentState.lts[i] == lts) | |||
if (lts != MagicConstants.NO_TIMESTAMP && currentState.lts[i] == lts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"down track"?
87a06ed
to
9ad2fc4
Compare
5bbc4ae
to
e0f6237
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 TY only thing left is adding that comment like you said
3bd93d0
to
1f48fdd
Compare
@@ -77,4 +78,24 @@ public static List<InetSocketAddress> buildContactPoints(ICluster<? extends IIns | |||
.map(ClusterUtils::getNativeInetSocketAddress) | |||
.collect(Collectors.toList()); | |||
} | |||
|
|||
public static ConsistencyLevel toDriverCL(org.apache.cassandra.distributed.api.ConsistencyLevel cl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unused here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not used anymore. This was moved out of StatefulASTBase
. In trunk i have a test to repo a history, so had to refactor that out
neededPks.addAll(partitionColumns); | ||
} | ||
|
||
public static List<ColumnMetadata> safeColumns(TableMetadata metadata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to allColumnsInSelectOrder
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you had the same comment with ASTGenerators.safeColumns
... let me unify this stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushed this to TableMetadata
and removed this function and the one in ASTGenerators
} | ||
} | ||
protected static final EnumSet<KnownIssue> IGNORED_ISSUES = EnumSet.allOf(KnownIssue.class); | ||
protected static boolean CQL_DEBUG_APPLY_OPERATOR = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do? Does it evaluate expressions before logging them to simplify? Maybe add a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ill add a comment... this is only something i understand =D
So, we generate stuff like 4 + 4
but when things fail you have the resolved value of 8
. When you look at the history you can't use grep
to filter for 8
as 4 + 4
will get filtered out... this option will change the history to "apply" or "resolve" the operator so it shows 8
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushed this doc
/**
* mutations and selects will use operators (eg. {@code 4 + 4}, the + operator), and this will be reflected in the history output.
*
* When an issue is found its common to filter out insertions to different partitions/rows but this can become a problem
* as the issue is for {@code pk=8} but the insert is to {@code 4 + 4}!
*
* Setting this to {@code true} will cause all operators to be "applied" or "executored" and the CQL in the history
* will be the output (eg. {@code 4 + 4 } is replaced with {@code 8}).
*/
protected static boolean CQL_DEBUG_APPLY_OPERATOR = false;
… and removed the ; in the annotate as it doesnt help
…as they are not stable until next rebase against trunk
…g, and token range search bug fix
7b4c49e
to
57d9a38
Compare
merged |
No description provided.