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

test: align space_index_test with the transactional DDL #157

Merged
merged 1 commit into from
Sep 15, 2023
Merged

test: align space_index_test with the transactional DDL #157

merged 1 commit into from
Sep 15, 2023

Commits on Sep 15, 2023

  1. test: align space_index_test with the transactional DDL

    If the tarantool/tarantool#8751 is merged, the space drop is
    transactional, so it only yields once on the space drop operation
    finish. This causes the test fail [1] because of unexpected state
    in the expirationd task.
    
    This patch fixes the problem by wrapping space drop and recreation
    into a transaction.
    
    More informative description of what the issue is:
    
    Consider the following facts:
    a. If the PR mentioned above is merged, the space drop yields on
       the full DDL operation end. After that point, the space is
       dropped entirely (no indexes or entries in the `_space` space
       exist).
    b. If the expirationd task's `atomic_iteration` option is set to
       false (which is the default used in the test), each tuple drop
       causes the expirationd task fiber yield.
    
    So here's what happens if the fact 'a' is false (the PR mentioned
    above is not merged):
    1. The test fiber creates the expirationd task and yields into it.
    2. The expirationd task drops the first tuple from the given space
       and yields back to the test fiber.
    3. The test fiber does the `space:drop()`, which is not atomic, so
    4. the drop yields on the primary index drop. Control is returned
       to the expirationd task.
    5. The expirationd task:
       1. Finishes the space iteration (there was only one tuple in the
          given space)
       2. Uses the space (`box.space[task.space].engine == "vinyl"`) we
          wanted to drop in the test fiber.
       3. Goes sleep, which yields to the test fiber.
    6. The test fiber continues the space drop, finishes it (the next
       yields happening during the space drop do not return the control
       back to the expirationd task though, because it sleeps and it's
       sleep timer hasn't expired yet).
    7. The test fiber recreates the space, and finally, when it's time
       to switch back to the expirationd task, the space exists again
       like no space drop happened.
    
    But if the space drop is atomic things change starting from the
    step 3: the space drop only yields on the whole DDL transaction
    commit. After that point, the space does not exist anymore. So:
    
    4. The atomic space drop yields to the expirationd task on commit.
    5. The expirationd task:
       1. Finishes the iteration and checks if the space's engine is
          vinyl in order to update the vinyl_assumed_space_len, but
          the space does not exist anymore, so it fails. This causes
          the expirationd task restart.
    
    The last mentioned step increments the restart counter so the test
    check fails.
    
    In order to mitigate that the patch wraps the space drop and
    recreation into a transaction, so the test fiber only yields
    when all the required changes are applied, so the expirationd
    task does not see the dropped space and only works with the
    original or recreated space.
    
    The tranactioning is only done for Tarantool version 2.2.1 or
    newer because in the version the single-yield transactional DDL
    had been introduced.
    
    1. https://github.com/tarantool/tarantool/actions/runs/6186475380/job/16795081554
    mkostoevr committed Sep 15, 2023
    Configuration menu
    Copy the full SHA
    2dfcb89 View commit details
    Browse the repository at this point in the history