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

Fix RoutingInfo consistency #743

Merged
merged 15 commits into from
Jul 27, 2023

Commits on Jul 27, 2023

  1. scylla_cql: Impl TryFrom<u8> for BatchType

    This will be used in proxy, to inspect request frames from the driver.
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    fde10bb View commit details
    Browse the repository at this point in the history
  2. value: fix statements-value count mismatch message

    The generated error contained wrong value list count: it failed
    to include the number of value lists that were already paired with
    statements.
    As a bonus, a cleaner `count()` implementation was added to
    `BatchValuesIterator` trait, instead of using a dirty workaround.
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    a7ac062 View commit details
    Browse the repository at this point in the history
  3. scylla_cql: get rid of iterator in Batch

    The iterator is not an accurate choice: the Batch struct does not
    contain any iteration state, so a plain slice would be a better choice.
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    8b35084 View commit details
    Browse the repository at this point in the history
  4. scylla_cql: Cow gives requests flexible ownership

    Before, only borrowed requests were allowed (for instance, Query
    contained the borrowed query contents as &str). For convenient
    deserialization and for test purposes, owned requests are preferred,
    so the definitions are made contain `Cow`s.
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    04ba776 View commit details
    Browse the repository at this point in the history
  5. scylla_cql: derive test Debug for some requests

    This will be used in some tests.
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    58ea66e View commit details
    Browse the repository at this point in the history
  6. scylla_cql: derive test Eq for some types

    This is required for tests.
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    234b2ca View commit details
    Browse the repository at this point in the history
  7. scylla_cql: add deser capabilities for requests

    Introduces DeserializableRequest trait whose main goal is testing
    purposes.
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    c3c2270 View commit details
    Browse the repository at this point in the history
  8. scylla_cql: add tests for request deserialization

    One simply asserts that serialization composed with deserialization is
    identity. Another makes sure that unknown flags lead to frame rejection
    (as deserializing frame containing unknown flags will likely lead to
    misinterpretation of some unknown protocol extensions).
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    ac9166f View commit details
    Browse the repository at this point in the history
  9. scylla_cql: rename Request to SerializableRequest

    The mentioned trait essentially serves the purpose of serialization, so
    the change is justified. The name `Request` will be used for an umbrella
    enum containing various types of requests.
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    92800d4 View commit details
    Browse the repository at this point in the history
  10. scylla_cql: introduce Request umbrella enum

    This enum provided unified interface over CQL requests, useful for
    testing. Now, it supports only Query, Execute and Batch (it panics if
    attempted to deserialize a different opcode) and provided getters for
    Consistency and SerialConsistency. In the future, it can be extended for
    further test checks.
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    eb935d8 View commit details
    Browse the repository at this point in the history
  11. integration: add tests for [serial] consistency

    One test checks for each [serial] possible consistency that the request
    frame indeed contains the specified [serial] consistency.
    Another test checks that RoutingInfo's consistencies match the specified
    ones. As the latter test confirmed the bug in Session regarding
    RoutingInfo, it is temporarily marked as ignored. The mark will be
    removed in the next commit, after the bug is fixed.
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    7bc2af7 View commit details
    Browse the repository at this point in the history
  12. session: fix: set correct consistency in RoutingInfo

    The test added in the previous commit proves that the routing info has
    wrong Consistency and SerialConsistency set. Therefore,
    Session::query_paged(), execute_paged() and batch() are all fixed
    to respect correct consistencies.
    The test's "ignore" mark is henceforth removed.
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    8120294 View commit details
    Browse the repository at this point in the history
  13. session: pass exec profile to Session::run_query()

    As access to the execution profile is anyway needed in the callers of
    `Session::run_query()` (in order to put correct Consistency and
    SerialConsistency into RoutingInfo), the acquired
    Arc<ExecutionProfileInner> is passed to `Session::run_query()` as
    another argument. This prevents duplication of Arc cloning.
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    f97b7b2 View commit details
    Browse the repository at this point in the history
  14. session: ExecuteQueryContext::consistency -> ...set_on_statement

    There are three levels of consistency that are taken into account by
    the Session: default exec profile's, per-statement exec profile's
    and per-statement one. To avoid confusion, we should use naming that
    clearly distinguishes them. Therefore, ExecuteQueryContext's field is
    renamed from the vague `consistency` to `consistency_set_on_statement`
    (the one directly set), as it is exactly its semantics.
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    ed5d2bb View commit details
    Browse the repository at this point in the history
  15. iterator: fix: set correct consistency in RoutingInfo

    Apparently, routing info had wrong Consistency and SerialConsistency set
    in iterator, too.
    wprzytula committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    b1664a7 View commit details
    Browse the repository at this point in the history