Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<dependency>
<groupId>com.scylladb</groupId>
<artifactId>native-protocol</artifactId>
<version>1.5.2.0</version>
<version>1.5.2.1</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import com.datastax.oss.driver.api.core.metrics.DefaultSessionMetric;
import com.datastax.oss.driver.api.core.servererrors.InvalidQueryException;
import com.datastax.oss.driver.api.core.type.DataTypes;
import com.datastax.oss.driver.api.testinfra.ScyllaOnly;
import com.datastax.oss.driver.api.testinfra.ccm.CcmBridge;
import com.datastax.oss.driver.api.testinfra.ccm.CcmRule;
import com.datastax.oss.driver.api.testinfra.requirement.BackendRequirement;
Expand Down Expand Up @@ -681,6 +682,38 @@ private void should_return_null_routing_information_when_single_partition_key_is
assertThat(boundStatement.getRoutingKey()).isNull();
}

/**
* Verifies driver behavior when a prepared statement is created on a node that does not support
* the metadata ID feature, but later executed on a node that does. In this scenario, the metadata
* ID is {@code null}, yet the feature flag is enabled. The test ensures that such a mixed-node
* situation is handled gracefully without errors.
*/
@Test
@ScyllaOnly
@SuppressWarnings("ConstantConditions")
public void should_handle_empty_metadata_id_when_executing_statement_when_supported() {
// given
CqlSession session = sessionRule.session();
PreparedStatement preparedStatement =
session.prepare("SELECT * FROM prepared_statement_test WHERE a = ?");
if (hasNoScyllaMetadataIdSupport()) {
assertThat(preparedStatement.getResultMetadataId()).isNull();
} else {
assertThat(preparedStatement.getResultMetadataId()).isNotNull();
preparedStatement.setResultMetadata(null, preparedStatement.getResultSetDefinitions());
}

// when
session.execute(preparedStatement.bind(1));

// then
if (hasNoScyllaMetadataIdSupport()) {
assertThat(preparedStatement.getResultMetadataId()).isNull();
} else {
assertThat(preparedStatement.getResultMetadataId()).isNotNull();
}
}

private static Iterable<Row> firstPageOf(CompletionStage<AsyncResultSet> stage) {
return CompletableFutures.getUninterruptibly(stage).currentPage();
}
Expand Down
Loading