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

Investigate how to support the use-cases from indexpiration #48

Open
2 of 4 tasks
akudiyar opened this issue Apr 12, 2021 · 2 comments
Open
2 of 4 tasks

Investigate how to support the use-cases from indexpiration #48

akudiyar opened this issue Apr 12, 2021 · 2 comments
Assignees
Milestone

Comments

@akudiyar
Copy link

akudiyar commented Apr 12, 2021

Currently, expirationd does not support iteration over a (secondary) index (since the expriration check callback must be applied to each tuple from a space). This creates a situation where a full scan is applied instead of selecting tuples from some start index value.

TODO:

  • Investigate how indices are used in the current expirationd implementation (check how the primary index is used, is it possible to iterate over a complex primary index, simple or complex secondary index)
  • Propose a RFC for changing the API to support iterating over a specified index or a field (the minimal satisfying index must be chosen in this case if it exists)
  • Check how the module is initialized: is it possible to reload the configuration and any created fibers or the internal state at runtime, thus supporting the "hot reload" feature
  • Propose a RFC for changes to support the "hot reload" feature
@akudiyar akudiyar added this to the Q2 2021 milestone Apr 12, 2021
@ArtDu
Copy link
Contributor

ArtDu commented Apr 13, 2021

The result of analyzing the existing code:

  1. Now there is a hardcode implementation of iterations by index zero, i.e. by primary.
    Secondary or complex indexes cannot be used at this time.
    local tuples = scan_space.index[0]:select({}, params)
    while #tuples > 0 do
    last_id = tuples[#tuples]
    for _, tuple in ipairs(tuples) do
    expiration_process(task, tuple)
    end
    suspend(scan_space, task)
    local key = construct_key(scan_space.id, last_id)
    tuples = scan_space.index[0]:select(key, params)
    end
  2. hot reload of the configuration is possible, since we have direct access to the variables that are used in the fibers.
    local task_list = {}

    and so we already have a function to reload the expirationd module - update ().

    expirationd/expirationd.lua

    Lines 515 to 519 in 29d1a25

    -- Update expirationd version in running tarantool
    -- * remove expirationd from package.loaded
    -- * require new expirationd
    -- * restart all tasks
    local function expirationd_update()
  • need to write a test for hot reload

@Mons
Copy link

Mons commented Apr 13, 2021

We don't need this, since there is indexpiration already.
These modules have strongly different approaches: by index and by callback.
Mixing them up in one module will lead to many misuses.

I see no reason to implement it in expirationd. Different modules cause the user to choose between patterns: either full-scan with the arbitrary condition inside user function or very precise index scan by index with a timestamp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants