Skip to content
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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

ohadzeliger
Copy link
Contributor

No description provided.

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: 6c231d5
  • Duration 0:52:50
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@ohadzeliger ohadzeliger marked this pull request as ready for review January 11, 2025 00:46
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
Copy link
Contributor

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()?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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());
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

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

Copy link
Contributor Author

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a ticket

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: fffc169
  • Duration 0:55:30
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@@ -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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean "continuation"?

Suggested change
// 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).

Copy link
Contributor Author

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
Copy link
Contributor

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());
Copy link
Contributor

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()) {
Copy link
Contributor

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?

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: 898846b
  • Duration 0:55:51
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: 4db6a16
  • Duration 0:01:38
  • Result: ❌ FAILED
  • Error: Error while executing command: ./gradlew --no-daemon --console=plain -b ./build.gradle build destructiveTest -PcoreNotStrict -PreleaseBuild=false -PpublishBuild=false -PspotbugsEnableHtmlReport. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: 6133e05
  • Duration 0:56:02
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

# Conflicts:
#	fdb-relational-grpc/fdb-relational-grpc.gradle
@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: 6133e05
  • Duration 0:36:53
  • Result: ❌ FAILED
  • Error: Error while executing command: ./gradlew --no-daemon --console=plain -b ./build.gradle build destructiveTest -PcoreNotStrict -PreleaseBuild=false -PpublishBuild=false -PspotbugsEnableHtmlReport. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: f8daa8f
  • Duration 0:53:19
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants