-
Notifications
You must be signed in to change notification settings - Fork 104
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
Server continuations #3030
base: main
Are you sure you want to change the base?
Server continuations #3030
Conversation
Result of fdb-record-layer-pr on Linux CentOS 7
|
...nal-grpc/src/main/java/com/apple/foundationdb/relational/jdbc/RelationalRpcContinuation.java
Outdated
Show resolved
Hide resolved
...nal-grpc/src/main/java/com/apple/foundationdb/relational/jdbc/RelationalRpcContinuation.java
Show resolved
Hide resolved
...ational-grpc/src/test/java/com/apple/foundationdb/relational/jdbc/AbstractMockResultSet.java
Outdated
Show resolved
Hide resolved
fdb-relational-grpc/src/test/java/com/apple/foundationdb/relational/jdbc/MockContinuation.java
Show resolved
Hide resolved
...ational-grpc/src/test/java/com/apple/foundationdb/relational/jdbc/MockResultSetMetadata.java
Show resolved
Hide resolved
...nal-grpc/src/test/java/com/apple/foundationdb/relational/jdbc/ResultSetContinuationTest.java
Outdated
Show resolved
Hide resolved
...nal-grpc/src/test/java/com/apple/foundationdb/relational/jdbc/ResultSetContinuationTest.java
Show resolved
Hide resolved
Assertions.assertEquals(expected.atBeginning(), actual.atBeginning()); | ||
Assertions.assertEquals(expected.atEnd(), actual.atEnd()); | ||
Assertions.assertEquals(expected.getReason(), actual.getReason()); | ||
// This, again, assumes that the entire inner continuation is serialized as the state |
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.
Why not call actual.serialize()
?
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.
Actual in this case is the RPC continuation (that wraps around the inner, server-side, continuation).
I can pull that out of the assert method to the test method, if that helps.
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.
If it's the RPC continuation, aren't actual.serialize()
and actual.getExecutionState()
the same?
serialize()
is the method that we use to send across the wire, and thus would get sent back in EXECUTE CONTINUATION
right? So that should be what we assert about?
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.
In this case the continuation is always RelationalRpcContinuation
and so they are always the same. Done.
ResultSet rsProto = TypeConversion.toProtobuf(resultSet); | ||
|
||
try (RelationalResultSetFacade deserializedResultSet = new RelationalResultSetFacade(rsProto)) { | ||
Assertions.assertThrows(SQLException.class, () -> deserializedResultSet.getContinuation()); |
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 only testing that it fails before getting any results. It seems like that is a good thing to test, but also that we should test after getting one.
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.
Done.
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 now asserts that it doesn't fail after getting all of them. I was thinking more like:
Assertions.assertThrows(SQLException.class, () -> deserializedResultSet.getContinuation());
assertTrue(convertedResultSet.next());
Assertions.assertThrows(SQLException.class, () -> deserializedResultSet.getContinuation());
toRow(convertedResultSet, numColumns); // row should be valid
assertTrue(convertedResultSet.next());
toRow(convertedResultSet, numColumns); // row should be valid
Assertions.assertThrows(SQLException.class, () -> deserializedResultSet.getContinuation());
assertFalse(convertedResultSet.next());
deserializedResultSet.getContinuation();
(Maybe with one more successful, and
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.
Yes, that's a good enhancement. Done.
This was also used to cover the off-by-one bug in the result set facade that only allowed continuations after the last row.
@@ -154,7 +153,7 @@ private static String appendWithContinuationIfPresent(@Nonnull String queryStrin | |||
if (!currentQuery.isEmpty() && currentQuery.charAt(currentQuery.length() - 1) == ';') { | |||
currentQuery = currentQuery.substring(0, currentQuery.length() - 1); | |||
} | |||
if (continuation instanceof ContinuationImpl) { | |||
if (continuation != null) { |
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.
Should we be adding any sort of assertions to the yaml test framework about the reason for the continuation?
Should we assert that we never get back the beginning continuation?
I don't think the yaml tests have a good way to cause TRANSACTION_LIMIT_REACHED
, but the others should be testable in an integrated way, which seems worthwhile.
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.
These are good enhancements. The unit tests do have assertions for that (see #3038 ) but YAML is somewhat limited in handling continuations (all is implicit).
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.
Created a ticket
Result of fdb-record-layer-pr on Linux CentOS 7
|
@@ -44,7 +44,7 @@ message ResultSet { | |||
repeated Struct row = 2; | |||
|
|||
// Optional continuation that can continue the query from the point the current results ended. | |||
// Not all queries support continuations. Null (or non existent) continuations means "no continuation". | |||
// A result set is non-null for the RelationalResultSet API but is not always supported (exception thrown when not). |
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.
Did you mean "continuation"?
// A result set is non-null for the RelationalResultSet API but is not always supported (exception thrown when not). | |
// A continuation is non-null for the RelationalResultSet API but is not always supported (exception thrown when not). |
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.
Done.
Assertions.assertEquals(expected.atBeginning(), actual.atBeginning()); | ||
Assertions.assertEquals(expected.atEnd(), actual.atEnd()); | ||
Assertions.assertEquals(expected.getReason(), actual.getReason()); | ||
// This, again, assumes that the entire inner continuation is serialized as the state |
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.
If it's the RPC continuation, aren't actual.serialize()
and actual.getExecutionState()
the same?
serialize()
is the method that we use to send across the wire, and thus would get sent back in EXECUTE CONTINUATION
right? So that should be what we assert about?
ResultSet rsProto = TypeConversion.toProtobuf(resultSet); | ||
|
||
try (RelationalResultSetFacade deserializedResultSet = new RelationalResultSetFacade(rsProto)) { | ||
Assertions.assertThrows(SQLException.class, () -> deserializedResultSet.getContinuation()); |
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 now asserts that it doesn't fail after getting all of them. I was thinking more like:
Assertions.assertThrows(SQLException.class, () -> deserializedResultSet.getContinuation());
assertTrue(convertedResultSet.next());
Assertions.assertThrows(SQLException.class, () -> deserializedResultSet.getContinuation());
toRow(convertedResultSet, numColumns); // row should be valid
assertTrue(convertedResultSet.next());
toRow(convertedResultSet, numColumns); // row should be valid
Assertions.assertThrows(SQLException.class, () -> deserializedResultSet.getContinuation());
assertFalse(convertedResultSet.next());
deserializedResultSet.getContinuation();
(Maybe with one more successful, and
@@ -225,6 +224,9 @@ void checkResultInternal(@Nonnull Object actual, @Nonnull String queryDescriptio | |||
var success = isExact ? getVal().equals(actualPlan) : actualPlan.contains((String) getVal()); | |||
if (success) { | |||
logger.debug("✅️ plan match!"); | |||
while (resultSet.next()) { |
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.
Yes, but why would there be more results? Shouldn't an explain always return one?
Result of fdb-record-layer-pr on Linux CentOS 7
|
Result of fdb-record-layer-pr on Linux CentOS 7
|
Result of fdb-record-layer-pr on Linux CentOS 7
|
4db6a16
to
6133e05
Compare
# Conflicts: # fdb-relational-grpc/fdb-relational-grpc.gradle
Result of fdb-record-layer-pr on Linux CentOS 7
|
Result of fdb-record-layer-pr on Linux CentOS 7
|
No description provided.