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

Use prepared statement result metadata to decode rows #925

Merged
merged 6 commits into from
Feb 16, 2024

Conversation

muzarski
Copy link
Contributor

@muzarski muzarski commented Feb 1, 2024

Fixes: #169

Motivation

Currently, the driver does not make a use of an optimization that CQL protocol offers during exeuction of prepared statements. The client is allowed to provide SKIP_METADATA flag during Session::execute, so the server doesn't attach a result set metadata. The driver can use the cached metadata (received in response to Session::prepare) to deserialize the results.

Changes

PreparedStatement

As mentioned previously, the driver can cache the prepared statement's result metadata. This is why we extend the PreparedStatementSharedData by result_metadata field which holds the metadata. The metadata is obtained from the server during statement preparation (Session::prepare). This metadata is eventually passed to the function which deserializes the results of query execution.

Schema changes

Before introducing the optimization, the driver was immune to the problems related to prepared statement's result metadata and schema changes.

After some schema change, Scylla and Cassandra invalidate the server-side caches and discard all of the prepared statements. When the driver executes a prepared statement after the schema change for the first time, it receives the UNPREPARED error frame (server does not recognize the id of the prepared statement since it was discarded). Currently, Scylla drivers handle such case by repreparation of the statement. Notice that after the schema change, the result metadata may be changed (depends on the actual change of schema). Without the optimization, Scylla always provides a valid (updated during repreparation) result metadata in the response to statement execution so we don't need to worry about it.

This raises an issue when we try to cache the metadata on the client side. It should be mutable so the driver holds a metadata that is always up to date (should be updated during reprepares). However, looking at the other drivers we can see that the client-side metadata caches are immutable. This is why we follow the same approach and not care about the schema changes.

Config

Extended and StatementConfig by skip_result_metadata boolean flag which defaults to false. When set to true, it enables the optimization. Thanks to that, the users can enable the optimization per-statement.

Points to discuss

  • should maybe skip_result_metadata flag be enabled by default? Since it's an optimization, it might make sense for it to be enabled by default.

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • I added relevant tests for new features and bug fixes.
  • All commits compile, pass static checks and pass test.
  • PR description sums up the changes and reasons why they should be introduced.
  • I have provided docstrings for the public items that I want to introduce.
  • I have adjusted the documentation in ./docs/source/.
  • I added appropriate Fixes: annotations to PR description.

@muzarski
Copy link
Contributor Author

muzarski commented Feb 1, 2024

I need to adjust the test case so we alter the table in some other way. The logs from CI:

thread 'transport::session_test::test_use_prepared_result_metadata' panicked at scylla/src/transport/session_test.rs:2017:10:
called `Result::unwrap()` on an `Err` value: DbError(Invalid, "Altering column types is no longer supported")

@piodul
Copy link
Collaborator

piodul commented Feb 1, 2024

Changes

I would prefer if you summarized your changes using prose and not a bulleted list. As a reviewer, I'm interested in:

  • The motivation behind the PR (A single link to an issue doesn't count),
  • An overview of the solution and how it addresses the motivation,
  • Decisions that you made and the rationale behind them.

Your bullet points don't give me this information, not easily at least. They concentrate too much on the details. For example, this point:

  • added result_metadata: ArcSwap<ResultMetadata> field to PreparedStatementSharedData

doesn't give any justification what it is for. After some adjustments it would serve well as a commit title (which should also be accompanied with a description unless the title itself is descriptive enough).

After reading all the bullet points I can form some idea about how the whole thing looks like, given that I'm familiar with the codebase and I created the issue that is being fixed here. However, other developers who will want to modify your code in the future might not have that luxury.

Besides helping maintainers, reviewers and other developers in the long run, I believe that preparing such a summary gives one a good opportunity to reflect on their proposed changes and help convince oneself that their changes make sense (or decide that they don't).

@muzarski
Copy link
Contributor Author

muzarski commented Feb 1, 2024

Changes

I would prefer if you summarized your changes using prose and not a bulleted list. As a reviewer, I'm interested in:

* The motivation behind the PR (A single link to an issue doesn't count),

* An overview of the solution and how it addresses the motivation,

* Decisions that you made and the rationale behind them.

Your bullet points don't give me this information, not easily at least. They concentrate too much on the details. For example, this point:

  • added result_metadata: ArcSwap<ResultMetadata> field to PreparedStatementSharedData

doesn't give any justification what it is for. After some adjustments it would serve well as a commit title (which should also be accompanied with a description unless the title itself is descriptive enough).

After reading all the bullet points I can form some idea about how the whole thing looks like, given that I'm familiar with the codebase and I created the issue that is being fixed here. However, other developers who will want to modify your code in the future might not have that luxury.

Besides helping maintainers, reviewers and other developers in the long run, I believe that preparing such a summary gives one a good opportunity to reflect on their proposed changes and help convince oneself that their changes make sense (or decide that they don't).

Thank you for the feedback, I'll make sure to adjust the PR description as well as commit messages that are not descriptive enough.

Copy link
Collaborator

@piodul piodul left a comment

Choose a reason for hiding this comment

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

I'd like to know more about how the driver behaves when a signal to reprepare is missed (i.e. some other application reprepares and this one misses it). The scenario with SELECT * and adding a column is known, but I wonder what happens if we have a UDT column or a tuple and we add a field to the UDT/tuple. I think this case might actually be quite common contrary to SELECT * so I'm wondering whether other drivers handle it correctly and if we handle it correctly.

Could you do a test and see how our driver behaves in this scenario? I'd also like to know how other drivers handle it, for example the Java driver - it seems the most mature of the drivers I know.

scylla/src/transport/session.rs Outdated Show resolved Hide resolved
scylla-cql/src/frame/response/result.rs Show resolved Hide resolved
scylla/src/statement/prepared_statement.rs Show resolved Hide resolved
scylla-cql/src/frame/response/result.rs Show resolved Hide resolved
@muzarski
Copy link
Contributor Author

muzarski commented Feb 7, 2024

I'd like to know more about how the driver behaves when a signal to reprepare is missed (i.e. some other application reprepares and this one misses it). The scenario with SELECT * and adding a column is known, but I wonder what happens if we have a UDT column or a tuple and we add a field to the UDT/tuple. I think this case might actually be quite common contrary to SELECT * so I'm wondering whether other drivers handle it correctly and if we handle it correctly.

Could you do a test and see how our driver behaves in this scenario? I'd also like to know how other drivers handle it, for example the Java driver - it seems the most mature of the drivers I know.

So I've tested the UDT case you provided with both rust and java drivers. The key thing to notice is that java driver actually does NOT update the result metadata of the prepared statement during repreparations. The metadata is immutable - set only once during the first preparation of the statement. In result, the scenario you described fails even when only one client connects to the database.

The demo (on scylla-4.x branch):

import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.api.core.data.UdtValue;

public class CreateAndPopulateKeyspace {

  public static void main(String[] args) {

    CreateAndPopulateKeyspace client = new CreateAndPopulateKeyspace();

    try {
      client.connect();
      client.createSchema();
      client.prepareStatement();
      client.alterSchema();
      client.reprepareStatement();

    } catch (Exception ex) {
      ex.printStackTrace();
    } finally {
      client.close();
    }
  }

  private CqlSession session;
  private PreparedStatement preparedStatement;

  public void connect() {
    session = CqlSession.builder().build();

    System.out.printf("Connected session: %s%n", session.getName());
  }

  public void createSchema() {

    session.execute("DROP KEYSPACE IF EXISTS simplex");

    session.execute(
        "CREATE KEYSPACE IF NOT EXISTS simplex WITH replication "
            + "= {'class':'SimpleStrategy', 'replication_factor':1};");

    session.execute("CREATE TYPE simplex.my_type (a int)");

    session.execute(
        "CREATE TABLE simplex.tab (a int PRIMARY KEY, b int, c simplex.my_type)");

    session.execute("INSERT INTO simplex.tab (a, b, c) VALUES (1, 2, { a: 1 })");
  }

  public void prepareStatement() {
    preparedStatement = session.prepare("SELECT c FROM simplex.tab");
  }

  public void alterSchema() {
    session.execute("ALTER TYPE simplex.my_type ADD d blob");
  }

  public void reprepareStatement() {
    Row row = session.execute(preparedStatement.bind()).one();

    UdtValue udtValue = row.getUdtValue("c");
    System.out.println(udtValue);
  }
  
  public void close() {
    if (session != null) {
      session.close();
    }
  }
}

The output:

Using Scylla optimized driver!!!
08:36:27.544 [main] INFO  c.d.o.d.a.c.session.SessionBuilder - Using Scylla optimized driver!!!
08:36:27.770 [main] INFO  c.d.o.d.i.c.DefaultMavenCoordinates - DataStax Java driver for Apache Cassandra(R) (com.scylladb:java-driver-core) version 4.17.0.1-SNAPSHOT
08:36:27.859 [main] INFO  c.d.o.d.i.c.c.CqlPrepareAsyncProcessor - Adding handler to invalidate cached prepared statements on type changes
08:36:28.139 [s0-admin-0] INFO  c.d.o.d.internal.core.time.Clock - Using native clock for microsecond precision
Connected session: s0
08:36:36.463 [s0-io-4] WARN  c.d.o.d.i.core.cql.CqlRequestHandler - [s0|1848289347|0] Statement 0xf4bf63c95f8a8b21c40745cbc1055ff9 is not prepared on Node(endPoint=/127.0.0.1:9042, hostId=d99848a9-2754-43e9-9aa1-0d708514c8b3, hashCode=4c3d379d), repreparing
java.lang.IllegalArgumentException: Too many fields in encoded UDT value, expected 1
	at com.datastax.oss.driver.internal.core.type.codec.UdtCodec.decode(UdtCodec.java:109)
	at com.datastax.oss.driver.internal.core.type.codec.UdtCodec.decode(UdtCodec.java:32)
	at com.datastax.oss.driver.api.core.data.GettableByIndex.get(GettableByIndex.java:90)
	at com.datastax.oss.driver.api.core.data.GettableByIndex.get(GettableByIndex.java:127)
	at com.datastax.oss.driver.api.core.data.GettableByIndex.getUdtValue(GettableByIndex.java:550)
	at com.datastax.oss.driver.api.core.data.GettableByName.getUdtValue(GettableByName.java:650)
	at com.datastax.oss.driver.examples.basic.CreateAndPopulateKeyspace.reprepareStatement(CreateAndPopulateKeyspace.java:99)
	at com.datastax.oss.driver.examples.basic.CreateAndPopulateKeyspace.main(CreateAndPopulateKeyspace.java:35)

Process finished with exit code 0

This is the exact same reason why SELECT * prepared statement won't work when we add/drop the column to the table after statement preparation (even in 1-client scenario).

The same test case that uses rust driver works since we update the client-side result metadata after statement repreparation. However, this won't work in the following 2-client scenario:

  • [CLIENT 1]: Prepare schema - create keyspace, udt, table (as in java example).
  • [CLIENT 1]: Prepare the SELECT c FROM simplex.tab statement
  • [CLIENT 2]: Prepare the SELECT c FROM simplex.tab statement
  • [CLIENT 1]: Alter the user-defined type
  • [CLIENT 1]: Execute the prepared statement - the repreparation takes a place, server caches the id of the prepared statement
  • [CLIENT 2]: Execute the prepared statement - the server already holds an id of the prepared statement, we miss the reprepare and so we make use of the outdated metadata to deserialize the result. We end up with deserialization error (expected 1 field of UDT, received 2 fields).

Now the question is whether we want to follow the java driver's approach and make result_metadata immutable (then we can get rid of ArcSwap as well).

Unfortunately, no solution to the multi-client scenario comes to my mind. Since java driver is vulnerable to this as well, I believe there is no reasonable solution to the problem. AFAIK, the 5th version of CQL protocol offers some solution where the server informs all of its clients about the change of metadata.

@piodul
Copy link
Collaborator

piodul commented Feb 7, 2024

Thanks for checking.

I think it makes more sense to make the result metadata immutable. The approach with ArcSwap works OK only if you have only one instance of PreparedStatement for a given potentially-problematic query across all running applications that share the same cluster. I also think there might be some issues if you try to execute the same PreparedStatement instance and one of them gets reprepared... All in all, it only works in very specific circumstances which might be hard for the user to ensure. I think an incorrect but consistent behavior in the form of returning metadata that was returned at first prepare is better.

@muzarski muzarski force-pushed the use_prepared_metadata_to_decode_rows branch from 217f794 to aa2ff61 Compare February 7, 2024 15:02
@muzarski
Copy link
Contributor Author

muzarski commented Feb 7, 2024

v2: rebased on top of master

@github-actions github-actions bot added the semver-checks-breaking cargo-semver-checks reports that this PR introduces breaking API changes label Feb 7, 2024
Copy link

github-actions bot commented Feb 7, 2024

cargo semver-checks detected some API incompatibilities in this PR.
See the following report for details:

cargo semver-checks output
./scripts/semver-checks.sh --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
+ cargo semver-checks -p scylla -p scylla-cql --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
     Cloning 799f9a40b180d866662e186caf386d1c7855e00a
     Parsing scylla v0.12.0 (current)
      Parsed [  23.328s] (current)
     Parsing scylla v0.12.0 (baseline)
      Parsed [  22.066s] (baseline)
    Checking scylla v0.12.0 -> v0.12.0 (no change)
     Checked [   0.059s] 58 checks; 58 passed, 0 unnecessary
    Finished [  45.496s] scylla
     Parsing scylla-cql v0.1.0 (current)
      Parsed [  12.155s] (current)
     Parsing scylla-cql v0.1.0 (baseline)
      Parsed [  12.327s] (baseline)
    Checking scylla-cql v0.1.0 -> v0.1.0 (no change)
     Checked [   0.052s] 58 checks; 55 passed, 3 failed, 0 unnecessary

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field QueryParameters.skip_metadata in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/request/query.rs:66

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/function_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::result::deserialize now takes 2 parameters instead of 1, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/result.rs:961

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/method_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::Response::deserialize now takes 4 parameters instead of 3, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/mod.rs:43
     Summary semver requires new major version: 3 major and 0 minor checks failed
    Finished [  24.570s] scylla-cql
make: *** [Makefile:53: semver-rev] Error 1

@muzarski muzarski force-pushed the use_prepared_metadata_to_decode_rows branch from aa2ff61 to e19421a Compare February 7, 2024 16:44
Copy link

github-actions bot commented Feb 7, 2024

cargo semver-checks detected some API incompatibilities in this PR.
See the following report for details:

cargo semver-checks output
./scripts/semver-checks.sh --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
+ cargo semver-checks -p scylla -p scylla-cql --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
     Cloning 799f9a40b180d866662e186caf386d1c7855e00a
     Parsing scylla v0.12.0 (current)
      Parsed [  22.966s] (current)
     Parsing scylla v0.12.0 (baseline)
      Parsed [  21.768s] (baseline)
    Checking scylla v0.12.0 -> v0.12.0 (no change)
     Checked [   0.057s] 58 checks; 57 passed, 1 failed, 0 unnecessary

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/inherent_method_missing.ron

Failed in:
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  44.837s] scylla
     Parsing scylla-cql v0.1.0 (current)
      Parsed [  12.301s] (current)
     Parsing scylla-cql v0.1.0 (baseline)
      Parsed [  12.414s] (baseline)
    Checking scylla-cql v0.1.0 -> v0.1.0 (no change)
     Checked [   0.052s] 58 checks; 55 passed, 3 failed, 0 unnecessary

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field QueryParameters.skip_metadata in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/request/query.rs:66

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/function_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::result::deserialize now takes 2 parameters instead of 1, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/result.rs:961

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/method_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::Response::deserialize now takes 4 parameters instead of 3, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/mod.rs:43
     Summary semver requires new major version: 3 major and 0 minor checks failed
    Finished [  24.805s] scylla-cql
make: *** [Makefile:53: semver-rev] Error 1

@muzarski
Copy link
Contributor Author

muzarski commented Feb 7, 2024

v3 - addressed review comments:

  • made result_metadata immutable - in result got rid of ArcSwap
  • moved skip_result_metadata flag from SessionConfig to StatementConfig
  • adjusted getters and setters for two types of metadata contained in PreparedStatementSharedData

Question related to tests:

  • since the previously introduced test case tested whether the client-side metadata is updated during reprepare, we got rid of this test case as we made result_metadata immutable. What is the best way to test our solution? I believe we could maybe use scylla-proxy crate and check whether the server does not attach the metadata in the response when client sents SKIP_METADATA flag. Correct me if I'm wrong, as I don't have any experience with the proxy.

Note: there is still an issue with metadata.clone() mentioned in the review comment. I'm still investigating the issue.

@muzarski muzarski force-pushed the use_prepared_metadata_to_decode_rows branch from e19421a to 312556b Compare February 7, 2024 17:06
@muzarski
Copy link
Contributor Author

muzarski commented Feb 7, 2024

v4: adjusted docstrings so the CI passes

Copy link

github-actions bot commented Feb 7, 2024

cargo semver-checks detected some API incompatibilities in this PR.
See the following report for details:

cargo semver-checks output
./scripts/semver-checks.sh --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
+ cargo semver-checks -p scylla -p scylla-cql --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
     Cloning 799f9a40b180d866662e186caf386d1c7855e00a
     Parsing scylla v0.12.0 (current)
      Parsed [  22.314s] (current)
     Parsing scylla v0.12.0 (baseline)
      Parsed [  21.987s] (baseline)
    Checking scylla v0.12.0 -> v0.12.0 (no change)
     Checked [   0.056s] 58 checks; 57 passed, 1 failed, 0 unnecessary

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/inherent_method_missing.ron

Failed in:
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  44.400s] scylla
     Parsing scylla-cql v0.1.0 (current)
      Parsed [  12.323s] (current)
     Parsing scylla-cql v0.1.0 (baseline)
      Parsed [  12.205s] (baseline)
    Checking scylla-cql v0.1.0 -> v0.1.0 (no change)
     Checked [   0.051s] 58 checks; 55 passed, 3 failed, 0 unnecessary

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field QueryParameters.skip_metadata in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/request/query.rs:66

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/function_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::result::deserialize now takes 2 parameters instead of 1, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/result.rs:961

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/method_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::Response::deserialize now takes 4 parameters instead of 3, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/mod.rs:43
     Summary semver requires new major version: 3 major and 0 minor checks failed
    Finished [  24.615s] scylla-cql
make: *** [Makefile:53: semver-rev] Error 1

@piodul
Copy link
Collaborator

piodul commented Feb 8, 2024

  • since the previously introduced test case tested whether the client-side metadata is updated during reprepare, we got rid of this test case as we made result_metadata immutable. What is the best way to test our solution? I believe we could maybe use scylla-proxy crate and check whether the server does not attach the metadata in the response when client sents SKIP_METADATA flag. Correct me if I'm wrong, as I don't have any experience with the proxy.

Yes, the proxy would be the right tool for this kind of test.

@piodul
Copy link
Collaborator

piodul commented Feb 8, 2024

And - thanks for adding the descriptions as I requested. I really appreciate that.

Don't forget to update it when you make changes to the implementation that would make it outdated (I see that it mentions ArcSwap right now, but AFAIK you got rid of it).

Copy link

github-actions bot commented Feb 8, 2024

cargo semver-checks detected some API incompatibilities in this PR.
See the following report for details:

cargo semver-checks output
./scripts/semver-checks.sh --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
+ cargo semver-checks -p scylla -p scylla-cql --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
     Cloning 799f9a40b180d866662e186caf386d1c7855e00a
     Parsing scylla v0.12.0 (current)
      Parsed [  22.735s] (current)
     Parsing scylla v0.12.0 (baseline)
      Parsed [  21.423s] (baseline)
    Checking scylla v0.12.0 -> v0.12.0 (no change)
     Checked [   0.056s] 58 checks; 57 passed, 1 failed, 0 unnecessary

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/inherent_method_missing.ron

Failed in:
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  44.256s] scylla
     Parsing scylla-cql v0.1.0 (current)
      Parsed [  12.256s] (current)
     Parsing scylla-cql v0.1.0 (baseline)
      Parsed [  12.195s] (baseline)
    Checking scylla-cql v0.1.0 -> v0.1.0 (no change)
     Checked [   0.051s] 58 checks; 55 passed, 3 failed, 0 unnecessary

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field QueryParameters.skip_metadata in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/request/query.rs:66

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/function_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::result::deserialize now takes 2 parameters instead of 1, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/result.rs:961

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/method_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::Response::deserialize now takes 4 parameters instead of 3, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/mod.rs:43
     Summary semver requires new major version: 3 major and 0 minor checks failed
    Finished [  24.538s] scylla-cql
make: *** [Makefile:53: semver-rev] Error 1

@muzarski muzarski force-pushed the use_prepared_metadata_to_decode_rows branch from 9500189 to db33284 Compare February 8, 2024 15:20
Copy link

github-actions bot commented Feb 8, 2024

cargo semver-checks detected some API incompatibilities in this PR.
See the following report for details:

cargo semver-checks output
./scripts/semver-checks.sh --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
+ cargo semver-checks -p scylla -p scylla-cql --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
     Cloning 799f9a40b180d866662e186caf386d1c7855e00a
     Parsing scylla v0.12.0 (current)
      Parsed [  24.356s] (current)
     Parsing scylla v0.12.0 (baseline)
      Parsed [  21.652s] (baseline)
    Checking scylla v0.12.0 -> v0.12.0 (no change)
     Checked [   0.056s] 58 checks; 57 passed, 1 failed, 0 unnecessary

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/inherent_method_missing.ron

Failed in:
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  46.105s] scylla
     Parsing scylla-cql v0.1.0 (current)
      Parsed [  12.621s] (current)
     Parsing scylla-cql v0.1.0 (baseline)
      Parsed [  12.855s] (baseline)
    Checking scylla-cql v0.1.0 -> v0.1.0 (no change)
     Checked [   0.057s] 58 checks; 55 passed, 3 failed, 0 unnecessary

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field QueryParameters.skip_metadata in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/request/query.rs:66

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/function_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::result::deserialize now takes 2 parameters instead of 1, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/result.rs:961

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/method_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::Response::deserialize now takes 4 parameters instead of 3, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/mod.rs:43
     Summary semver requires new major version: 3 major and 0 minor checks failed
    Finished [  25.574s] scylla-cql
make: *** [Makefile:53: semver-rev] Error 1

@muzarski muzarski force-pushed the use_prepared_metadata_to_decode_rows branch from db33284 to 50560e4 Compare February 8, 2024 15:34
Copy link

github-actions bot commented Feb 8, 2024

cargo semver-checks detected some API incompatibilities in this PR.
See the following report for details:

cargo semver-checks output
./scripts/semver-checks.sh --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
+ cargo semver-checks -p scylla -p scylla-cql --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
     Cloning 799f9a40b180d866662e186caf386d1c7855e00a
     Parsing scylla v0.12.0 (current)
      Parsed [  23.826s] (current)
     Parsing scylla v0.12.0 (baseline)
      Parsed [  21.835s] (baseline)
    Checking scylla v0.12.0 -> v0.12.0 (no change)
     Checked [   0.057s] 58 checks; 57 passed, 1 failed, 0 unnecessary

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/inherent_method_missing.ron

Failed in:
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  45.761s] scylla
     Parsing scylla-cql v0.1.0 (current)
      Parsed [  12.115s] (current)
     Parsing scylla-cql v0.1.0 (baseline)
      Parsed [  12.095s] (baseline)
    Checking scylla-cql v0.1.0 -> v0.1.0 (no change)
     Checked [   0.051s] 58 checks; 55 passed, 3 failed, 0 unnecessary

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field QueryParameters.skip_metadata in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/request/query.rs:66

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/function_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::result::deserialize now takes 2 parameters instead of 1, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/result.rs:961

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/method_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::Response::deserialize now takes 4 parameters instead of 3, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/mod.rs:43
     Summary semver requires new major version: 3 major and 0 minor checks failed
    Finished [  24.301s] scylla-cql
make: *** [Makefile:53: semver-rev] Error 1

@muzarski muzarski force-pushed the use_prepared_metadata_to_decode_rows branch from 50560e4 to 46b59b7 Compare February 8, 2024 16:24
Copy link

github-actions bot commented Feb 8, 2024

cargo semver-checks detected some API incompatibilities in this PR.
See the following report for details:

cargo semver-checks output
./scripts/semver-checks.sh --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
+ cargo semver-checks -p scylla -p scylla-cql --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
     Cloning 799f9a40b180d866662e186caf386d1c7855e00a
     Parsing scylla v0.12.0 (current)
      Parsed [  25.499s] (current)
     Parsing scylla v0.12.0 (baseline)
      Parsed [  21.612s] (baseline)
    Checking scylla v0.12.0 -> v0.12.0 (no change)
     Checked [   0.056s] 58 checks; 57 passed, 1 failed, 0 unnecessary

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/inherent_method_missing.ron

Failed in:
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  47.208s] scylla
     Parsing scylla-cql v0.1.0 (current)
      Parsed [  11.999s] (current)
     Parsing scylla-cql v0.1.0 (baseline)
      Parsed [  12.154s] (baseline)
    Checking scylla-cql v0.1.0 -> v0.1.0 (no change)
     Checked [   0.053s] 58 checks; 55 passed, 3 failed, 0 unnecessary

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field QueryParameters.skip_metadata in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/request/query.rs:66

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/function_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::result::deserialize now takes 2 parameters instead of 1, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/result.rs:961

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/method_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::Response::deserialize now takes 4 parameters instead of 3, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/mod.rs:43
     Summary semver requires new major version: 3 major and 0 minor checks failed
    Finished [  24.240s] scylla-cql
make: *** [Makefile:53: semver-rev] Error 1

@muzarski muzarski force-pushed the use_prepared_metadata_to_decode_rows branch from 5519635 to e8b792a Compare February 8, 2024 16:46
Copy link

github-actions bot commented Feb 8, 2024

cargo semver-checks detected some API incompatibilities in this PR.
See the following report for details:

cargo semver-checks output
./scripts/semver-checks.sh --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
+ cargo semver-checks -p scylla -p scylla-cql --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
     Cloning 799f9a40b180d866662e186caf386d1c7855e00a
     Parsing scylla v0.12.0 (current)
      Parsed [  23.943s] (current)
     Parsing scylla v0.12.0 (baseline)
      Parsed [  22.138s] (baseline)
    Checking scylla v0.12.0 -> v0.12.0 (no change)
     Checked [   0.058s] 58 checks; 57 passed, 1 failed, 0 unnecessary

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/inherent_method_missing.ron

Failed in:
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  46.185s] scylla
     Parsing scylla-cql v0.1.0 (current)
      Parsed [  12.421s] (current)
     Parsing scylla-cql v0.1.0 (baseline)
      Parsed [  12.824s] (baseline)
    Checking scylla-cql v0.1.0 -> v0.1.0 (no change)
     Checked [   0.054s] 58 checks; 55 passed, 3 failed, 0 unnecessary

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field QueryParameters.skip_metadata in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/request/query.rs:66

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/function_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::result::deserialize now takes 2 parameters instead of 1, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/result.rs:961

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/method_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::Response::deserialize now takes 4 parameters instead of 3, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/mod.rs:43
     Summary semver requires new major version: 3 major and 0 minor checks failed
    Finished [  25.337s] scylla-cql
make: *** [Makefile:53: semver-rev] Error 1

@muzarski muzarski force-pushed the use_prepared_metadata_to_decode_rows branch from e8b792a to 46b59b7 Compare February 9, 2024 09:51
Copy link

github-actions bot commented Feb 9, 2024

cargo semver-checks detected some API incompatibilities in this PR.
See the following report for details:

cargo semver-checks output
./scripts/semver-checks.sh --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
+ cargo semver-checks -p scylla -p scylla-cql --baseline-rev 799f9a40b180d866662e186caf386d1c7855e00a
     Cloning 799f9a40b180d866662e186caf386d1c7855e00a
     Parsing scylla v0.12.0 (current)
      Parsed [  24.431s] (current)
     Parsing scylla v0.12.0 (baseline)
      Parsed [  21.259s] (baseline)
    Checking scylla v0.12.0 -> v0.12.0 (no change)
     Checked [   0.057s] 58 checks; 57 passed, 1 failed, 0 unnecessary

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/inherent_method_missing.ron

Failed in:
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-799f9a40b180d866662e186caf386d1c7855e00a/ad20b59a9a0ac21fe2b1fcc456f8a39f0c6d4e71/scylla/src/statement/prepared_statement.rs:305
     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  45.789s] scylla
     Parsing scylla-cql v0.1.0 (current)
      Parsed [  12.131s] (current)
     Parsing scylla-cql v0.1.0 (baseline)
      Parsed [  12.218s] (baseline)
    Checking scylla-cql v0.1.0 -> v0.1.0 (no change)
     Checked [   0.052s] 58 checks; 55 passed, 3 failed, 0 unnecessary

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field QueryParameters.skip_metadata in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/request/query.rs:66

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/function_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::result::deserialize now takes 2 parameters instead of 1, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/result.rs:961

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/method_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::Response::deserialize now takes 4 parameters instead of 3, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/mod.rs:43
     Summary semver requires new major version: 3 major and 0 minor checks failed
    Finished [  24.437s] scylla-cql
make: *** [Makefile:53: semver-rev] Error 1

@muzarski muzarski force-pushed the use_prepared_metadata_to_decode_rows branch from 85efa6a to a55c246 Compare February 13, 2024 01:49
Copy link

cargo semver-checks detected some API incompatibilities in this PR.
See the following report for details:

cargo semver-checks output
./scripts/semver-checks.sh --baseline-rev 56dd37619a6951d171cb0e1e88e39c8990ee5961
+ cargo semver-checks -p scylla -p scylla-cql --baseline-rev 56dd37619a6951d171cb0e1e88e39c8990ee5961
     Cloning 56dd37619a6951d171cb0e1e88e39c8990ee5961
     Parsing scylla v0.12.0 (current)
      Parsed [  22.932s] (current)
     Parsing scylla v0.12.0 (baseline)
      Parsed [  21.774s] (baseline)
    Checking scylla v0.12.0 -> v0.12.0 (no change)
     Checked [   0.057s] 58 checks; 57 passed, 1 failed, 0 unnecessary

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/inherent_method_missing.ron

Failed in:
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-56dd37619a6951d171cb0e1e88e39c8990ee5961/487164d9e2379539a9dfb6dd2836044db9919ae7/scylla/src/statement/prepared_statement.rs:305
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-56dd37619a6951d171cb0e1e88e39c8990ee5961/487164d9e2379539a9dfb6dd2836044db9919ae7/scylla/src/statement/prepared_statement.rs:305
     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  44.804s] scylla
     Parsing scylla-cql v0.1.0 (current)
      Parsed [  12.127s] (current)
     Parsing scylla-cql v0.1.0 (baseline)
      Parsed [  12.231s] (baseline)
    Checking scylla-cql v0.1.0 -> v0.1.0 (no change)
     Checked [   0.052s] 58 checks; 55 passed, 3 failed, 0 unnecessary

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field QueryParameters.skip_metadata in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/request/query.rs:66

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/function_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::result::deserialize now takes 2 parameters instead of 1, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/result.rs:961

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/method_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::Response::deserialize now takes 4 parameters instead of 3, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/mod.rs:43
     Summary semver requires new major version: 3 major and 0 minor checks failed
    Finished [  24.447s] scylla-cql
make: *** [Makefile:53: semver-rev] Error 1

@muzarski muzarski requested a review from piodul February 13, 2024 02:00
@muzarski
Copy link
Contributor Author

Rebased on top of main, so the CI passes

scylla/src/statement/batch.rs Outdated Show resolved Hide resolved
scylla/src/statement/prepared_statement.rs Outdated Show resolved Hide resolved
scylla/tests/integration/skip_metadata_optimization.rs Outdated Show resolved Hide resolved
@muzarski muzarski force-pushed the use_prepared_metadata_to_decode_rows branch from a55c246 to 6a871cc Compare February 15, 2024 11:14
@muzarski
Copy link
Contributor Author

v5: addressed review comments

@muzarski muzarski requested a review from piodul February 15, 2024 11:17
Copy link

cargo semver-checks detected some API incompatibilities in this PR.
See the following report for details:

cargo semver-checks output
./scripts/semver-checks.sh --baseline-rev 56dd37619a6951d171cb0e1e88e39c8990ee5961
+ cargo semver-checks -p scylla -p scylla-cql --baseline-rev 56dd37619a6951d171cb0e1e88e39c8990ee5961
     Cloning 56dd37619a6951d171cb0e1e88e39c8990ee5961
     Parsing scylla v0.12.0 (current)
      Parsed [  22.896s] (current)
     Parsing scylla v0.12.0 (baseline)
      Parsed [  21.889s] (baseline)
    Checking scylla v0.12.0 -> v0.12.0 (no change)
     Checked [   0.061s] 58 checks; 57 passed, 1 failed, 0 unnecessary

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/inherent_method_missing.ron

Failed in:
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-56dd37619a6951d171cb0e1e88e39c8990ee5961/487164d9e2379539a9dfb6dd2836044db9919ae7/scylla/src/statement/prepared_statement.rs:305
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-56dd37619a6951d171cb0e1e88e39c8990ee5961/487164d9e2379539a9dfb6dd2836044db9919ae7/scylla/src/statement/prepared_statement.rs:305
     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  44.892s] scylla
     Parsing scylla-cql v0.1.0 (current)
      Parsed [  12.339s] (current)
     Parsing scylla-cql v0.1.0 (baseline)
      Parsed [  12.396s] (baseline)
    Checking scylla-cql v0.1.0 -> v0.1.0 (no change)
     Checked [   0.055s] 58 checks; 55 passed, 3 failed, 0 unnecessary

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field QueryParameters.skip_metadata in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/request/query.rs:66

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/function_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::result::deserialize now takes 2 parameters instead of 1, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/result.rs:961

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/method_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::Response::deserialize now takes 4 parameters instead of 3, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/mod.rs:43
     Summary semver requires new major version: 3 major and 0 minor checks failed
    Finished [  24.830s] scylla-cql
make: *** [Makefile:53: semver-rev] Error 1

@muzarski muzarski force-pushed the use_prepared_metadata_to_decode_rows branch from 6a871cc to 030a5f4 Compare February 15, 2024 12:19
Hidden the `PreparedMetadata` getter, as it's a low-level struct.
Exposed two getters for the information that might be useful to the
users:
- column specs of bind variables
- partition key indexes of bind variables
Added a `result_metadata` to `PreparedStatementSharedData` struct so
the driver caches the result metadata provided by the server after
statement preparation.
Added a new integration test which tests whether the SKIP_METADATA
optimization works correctly when executing prepared statements.

The test case does two things:
- executes a statement without SKIP_METADATA flag. Using the proxy,
  it verifies that server sent metadata in the response.
- executes a statement with SKIP_METADATA flag. Using the proxy,
  it verifies that the server did not attach metadata in the response.
@muzarski muzarski force-pushed the use_prepared_metadata_to_decode_rows branch from 030a5f4 to 58a9885 Compare February 15, 2024 12:27
@muzarski
Copy link
Contributor Author

v6:

  • resolved conflicts with main
  • changed the name of the parameter of StatementConfig::set_use_cached_result_metadata from should_skip to use_cached_metadata

Copy link

cargo semver-checks detected some API incompatibilities in this PR.
See the following report for details:

cargo semver-checks output
./scripts/semver-checks.sh --baseline-rev 29f6744b363ad3ac3d9cbe6d9c6f33eabd1bfba2
+ cargo semver-checks -p scylla -p scylla-cql --baseline-rev 29f6744b363ad3ac3d9cbe6d9c6f33eabd1bfba2
     Cloning 29f6744b363ad3ac3d9cbe6d9c6f33eabd1bfba2
     Parsing scylla v0.12.0 (current)
      Parsed [  22.767s] (current)
     Parsing scylla v0.12.0 (baseline)
      Parsed [  20.393s] (baseline)
    Checking scylla v0.12.0 -> v0.12.0 (no change)
     Checked [   0.058s] 58 checks; 57 passed, 1 failed, 0 unnecessary

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/inherent_method_missing.ron

Failed in:
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-29f6744b363ad3ac3d9cbe6d9c6f33eabd1bfba2/8b68243085a8ea6915c5f642f2d681fd8dbaaa3b/scylla/src/statement/prepared_statement.rs:305
  PreparedStatement::get_prepared_metadata, previously in file /home/runner/work/scylla-rust-driver/scylla-rust-driver/target/semver-checks/git-29f6744b363ad3ac3d9cbe6d9c6f33eabd1bfba2/8b68243085a8ea6915c5f642f2d681fd8dbaaa3b/scylla/src/statement/prepared_statement.rs:305
     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  43.266s] scylla
     Parsing scylla-cql v0.1.0 (current)
      Parsed [  10.121s] (current)
     Parsing scylla-cql v0.1.0 (baseline)
      Parsed [  10.214s] (baseline)
    Checking scylla-cql v0.1.0 -> v0.1.0 (no change)
     Checked [   0.055s] 58 checks; 55 passed, 3 failed, 0 unnecessary

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field QueryParameters.skip_metadata in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/request/query.rs:66

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/function_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::result::deserialize now takes 2 parameters instead of 1, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/result.rs:961

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/method_parameter_count_changed.ron

Failed in:
  scylla_cql::frame::response::Response::deserialize now takes 4 parameters instead of 3, in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/mod.rs:63
     Summary semver requires new major version: 3 major and 0 minor checks failed
    Finished [  20.429s] scylla-cql
make: *** [Makefile:53: semver-rev] Error 1

muzarski added a commit to muzarski/scylla-rust-driver that referenced this pull request Feb 15, 2024
Re-exported types that should be exposed to users.
Re-exported types:
- ColumnSpec
- ColumnType
- CqlValue
- PartitionKeyIndex
- Row
- TableSpec

Note for reviewers: As mentioned in
scylladb#925 (comment),
we should not expose the `PreparedMetadata` structure. I believe
the same applies to `ResultMetadata`. That's why I decided not to
re-export them.
@piodul piodul merged commit 8a5be0a into scylladb:main Feb 16, 2024
11 checks passed
muzarski added a commit to muzarski/scylla-rust-driver that referenced this pull request Feb 19, 2024
Re-exported types that should be exposed to users.
Re-exported types:
- ColumnSpec
- ColumnType
- CqlValue
- PartitionKeyIndex
- Row
- TableSpec

Note for reviewers: As mentioned in
scylladb#925 (comment),
we should not expose the `PreparedMetadata` structure. I believe
the same applies to `ResultMetadata`. That's why I decided not to
re-export them.
muzarski added a commit to muzarski/scylla-rust-driver that referenced this pull request Mar 27, 2024
Re-exported types that should be exposed to users.
Re-exported types:
- ColumnSpec
- ColumnType
- CqlValue
- PartitionKeyIndex
- Row
- TableSpec

Note for reviewers: As mentioned in
scylladb#925 (comment),
we should not expose the `PreparedMetadata` structure. I believe
the same applies to `ResultMetadata`. That's why I decided not to
re-export them.
@Lorak-mmk Lorak-mmk mentioned this pull request May 9, 2024
@muzarski muzarski deleted the use_prepared_metadata_to_decode_rows branch October 29, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-checks-breaking cargo-semver-checks reports that this PR introduces breaking API changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use prepared statement metadata to decode results of prepared statements
2 participants