Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cilium/statedb
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.3.0
Choose a base ref
...
head repository: cilium/statedb
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.3.1
Choose a head ref
  • 9 commits
  • 40 files changed
  • 1 contributor

Commits on Sep 30, 2024

  1. testutils: Add script-based test utilities

    Add generic testscript commands for testing against
    StateDB tables.
    
    This allows implementing tests as scripts, which becomes useful when
    tests perform multiple steps on tables and need to verify the output
    each step.
    
    Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
    joamaki committed Sep 30, 2024
    Configuration menu
    Copy the full SHA
    da44c74 View commit details
    Browse the repository at this point in the history

Commits on Oct 7, 2024

  1. Add a quickcheck test for StateDB

    Add a test using testing/quick for StateDB to validate queries against
    unique and non-unique indexes.
    
    This catches the two issues with non-unique indexes:
    - Prefix and LowerBound did not properly seek according to the search key
      (e.g. secondary key) and matched against the composite instead, e.g.
      if we have composite keys <a><aa><1> ("aaa1") and <aa><b><2> (aab2)
      and prefix search for "aa" we'll yield the object with composite key
      <a><aa><1> incorrectly as we did not check if the secondary key length
      (1) matches with search key "aa" (2).
    
      (non-unique keys are encoded as <secondary><primary><secondary length>,
       see encodeNonUniqueKey for details)
    
    - Since there's no separator between the secondary and primary key in the
      encoding, the iteration order for <a><z><1> and <aa><a><2> will be
      <aa><a><2>, <a><z><1>, but it should be <a><z><1>, <aa><a><2> since
      "a" < "aa".
    
    Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
    joamaki committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    1ab5622 View commit details
    Browse the repository at this point in the history
  2. Add regression test for non-unique searches

    Add a regression test to validate searching non-unique indexes.
    This more clearly shows the issues found by the TestDB_Quick that
    was added by the previous commit. See the previous commit for more
    details.
    
    Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
    joamaki committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    af31f0a View commit details
    Browse the repository at this point in the history
  3. Fix Prefix and LowerBound on non-unique indexes

    Prefix and LowerBound searches did not properly deal with non-unique
    indexes. In these indexes the keys are encoded as <secondary><primary><secondary len>,
    and prefix searching needs to make sure the secondary key length on the results
    is equal or longer than the search key as otherwise we might match into the primary
    key.
    
    For example if the object is struct{A, B string}, with A being primary and we have
    {"a", "a"}, then the secondary index is key'd as "aa<1>". A prefix search with "aa"
    must not match since the secondary index contains only an object with key "a".
    
    Fix this by using a special iteration on non-unique indexes that checks the length
    of the secondary key and ignores any other matches that are due to matching into the
    primary key.
    
    Another issue with non-unique indexes was due to having no separator between the
    secondary and primary key, leading to the primary key having an effect on the iteration
    order. Fix this by adding '\0' as a separator and base64+sha256'ing the primary key.
    
    Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
    joamaki committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    62157fc View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2024

  1. go.mod: Bump hive dependency

    Bring in the new hive version that includes the script support.
    Fix the API usage.
    
    Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
    joamaki committed Oct 10, 2024
    Configuration menu
    Copy the full SHA
    0f24f74 View commit details
    Browse the repository at this point in the history
  2. part: Add YAML support to Set and Map

    To allow using part.Set[] and part.Map[] types with the YAML marshalling/unmarshalling
    in the StateDB script commands, add the custom YAML marshalling and unmarshalling methods
    for these types.
    
    Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
    joamaki committed Oct 10, 2024
    Configuration menu
    Copy the full SHA
    70dced9 View commit details
    Browse the repository at this point in the history
  3. Reimplement script commands against hive script

    Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
    joamaki committed Oct 10, 2024
    Configuration menu
    Copy the full SHA
    232e3d0 View commit details
    Browse the repository at this point in the history
  4. reconciler: Implement tests using scripttest

    Reimplement the reconciler tests using scripttest. This significantly
    simplifies the test-suite and allows easier verification of more complex
    scenarios.
    
    To allow for Status JSON and YAML marshalling, define custom UnmarshalJSON
    and UnmarshalYAML that also fill in the 'id'. The 'id' is used with StatusSet
    to efficiently allow multiple reconcilers to manipulate the status without
    conflicts, e.g. if the object status id is the same it can still be updated
    with the reconciliation result even if the object conflicted due to other
    reconciler's update to its status.
    
    Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
    joamaki committed Oct 10, 2024
    Configuration menu
    Copy the full SHA
    43587d4 View commit details
    Browse the repository at this point in the history
  5. index: Add *String functions

    Add *String counterparts (Int32 => Int32String) for implementing FromString
    in Index[].
    
    Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
    joamaki committed Oct 10, 2024
    Configuration menu
    Copy the full SHA
    c6862eb View commit details
    Browse the repository at this point in the history
Loading