Skip to content

Offer cartridge role #107

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Totktonada opened this issue Apr 22, 2022 · 2 comments · Fixed by #125
Closed

Offer cartridge role #107

Totktonada opened this issue Apr 22, 2022 · 2 comments · Fixed by #125
Assignees
Labels
feature A new functionality

Comments

@Totktonada
Copy link
Member

It'll easy setup periodical expiration in a cartridge application.

@oleg-jukovec
Copy link
Contributor

oleg-jukovec commented May 10, 2022

We had a pull request before. It's a simple role for tests:
#67

The role is not an independent unit. It just saves the states of expirationd's tasks. Tasks must be started from the client code manually.

So I propose an another approach:

  1. Launching tasks from a configuration file.
  2. Arguments for launching are similar as for expirationd.start + the role parameters.
  3. The role parameter can be: restart or try to restore from previous state? Something else?
expirationd:
  first_role_name:
    space_id: "space_id"
    is_expired: "is_expired_func"
    options:
       args: "arg"
       force: true
       full_scan_delay: 1
       etc
    resume: true
  second_role_name:
    space_id: "space_id_second"
    is_expired: "is_expired_func_second"
    options:
       args: "arg"
       force: true
       full_scan_delay: 1
       etc
    resume: false

We can load functions by name from _G table:

local function load_function(func_name)
    if func_name == nil or type(func_name) ~= 'string' then
        return nil
    end

    local func = rawget(_G, func_name)
    if func == nil or type(func) ~= 'function' then
        return nil
    end
    return func
end

The role function stop will be very simple:

local function stop()
    for _, task in tasks_list do
        log.info('stop expirationd task: %s', task)
        expirationd.kill(task)
    end
    tasks_list = {}
    return true
end

validate_config and apply_config will be much more complicated. We must to validate very many parameters in validate_config. apply_config is a good place to start/realod tasks. Something like that:

local function apply_config(conf, opts) -- luacheck: no unused args
    local conf = conf[role_name] or {}

    stop()
    if opts.is_master then
        start(conf)
    end

    return true
end

I have two questions:

  1. What additional parameters are needed for the role? Do we need to try to resume tasks, or is it enough just to start it? Do we need a parameter for this?
  2. Do we need additional methods for configuration from a client code, as it is done in metrics.lua?

But I propose to start with a simple implementation. And add additional parameters/functions later.

@no1seman
Copy link

no1seman commented Jun 7, 2022

  • register expirationd as a cartridge service for easy access to API: cartridge.service_get('expiratind')
  • stop all tasks on stop
  • optionally start/stop tasks on apply config according to is_master state

@Totktonada Totktonada added the 3sp label Jun 18, 2022
oleg-jukovec added a commit that referenced this issue Jul 22, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Jul 25, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Jul 25, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Jul 25, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Jul 27, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Jul 27, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Jul 27, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Aug 3, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Aug 3, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Aug 3, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Aug 3, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Aug 4, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Aug 4, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Aug 4, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Aug 4, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Aug 4, 2022
The patch adds a Tarantool Cartridge role with features:

* expirationd as a Tarantool Cartridge service for easy access to
  all API calls.
* The role stops all expirationd tasks on an instance on the role
  termination.
* It can automatically start and kill old tasks from the role
  congiguration.

Closes #107
oleg-jukovec added a commit that referenced this issue Aug 4, 2022
Overview

    This release adds a Tarantool Cartridge role for expirationd
    package and improves the default behavior.

Breaking changes

    None.

New features

    Continue a task from a last tuple (#54).

    Decrease tarantool-checks dependency from 3.1 to 2.1 (#124).

    Process a task on a writable space by default (#42).

    Wait until a space or an index is created (#68, #116).

    Tarantool Cartridge role (#107).

Bugfixes

    Fix build and installation of rpm/deb packages (#124).

    Do not restart work fiber if index does not exist (#64).

    Update changelogs for rpm/deb packages.

Testing

    Shuffle tests (#118).

    Fix test_mvcc_vinyl_tx_conflict (#104, #105).

    Fix flaky 'simple expires test' (#90).

Other

    Add GitHub Actions workflow with debug Tarantool build (#102).

    Add GitHub Actions workflow for deploying module packages to S3
    based repositories (#43).
oleg-jukovec added a commit that referenced this issue Aug 4, 2022
Overview

    This release adds a Tarantool Cartridge role for expirationd
    package and improves the default behavior.

Breaking changes

    None.

New features

    Continue a task from a last tuple (#54).

    Decrease tarantool-checks dependency from 3.1 to 2.1 (#124).

    Process a task on a writable space by default (#42).

    Wait until a space or an index is created (#68, #116).

    Tarantool Cartridge role (#107).

Bugfixes

    Fix build and installation of rpm/deb packages (#124).

    Do not restart a work fiber if an index does not exist (#64).

    Update changelogs for rpm/deb packages.

Testing

    Shuffle tests (#118).

    Fix test_mvcc_vinyl_tx_conflict (#104, #105).

    Fix flaky 'simple expires test' (#90).

Other

    Add GitHub Actions workflow with debug Tarantool build (#102).

    Add GitHub Actions workflow for deploying module packages to S3
    based repositories (#43).
oleg-jukovec added a commit that referenced this issue Aug 5, 2022
Overview

    This release adds a Tarantool Cartridge role for expirationd
    package and improves the default behavior.

Breaking changes

    None.

Deprecated

    Obsolete functions: task_stats, kill_task, get_task, get_tasks, run_task,
    show_task_list.

New features

    Continue a task from a last tuple (#54).

    Decrease tarantool-checks dependency from 3.1 to 2.1 (#124).

    Process a task on a writable space by default (#42).

    Wait until a space or an index is created (#68, #116).

    Tarantool Cartridge role (#107).

Bugfixes

    Fix build and installation of rpm/deb packages (#124).

    Do not restart a work fiber if an index does not exist (#64).

    Update changelogs for rpm/deb packages.

Testing

    Shuffle tests (#118).

    Fix test_mvcc_vinyl_tx_conflict (#104, #105).

    Fix flaky 'simple expires test' (#90).

Other

    Add GitHub Actions workflow with debug Tarantool build (#102).

    Add GitHub Actions workflow for deploying module packages to S3
    based repositories (#43).
oleg-jukovec added a commit that referenced this issue Aug 11, 2022
Overview

    This release adds a Tarantool Cartridge role for expirationd
    package and improves the default behavior.

Breaking changes

    None.

Deprecated

    Obsolete functions: task_stats, kill_task, get_task, get_tasks, run_task,
    show_task_list.

New features

    Continue a task from a last tuple (#54).

    Decrease tarantool-checks dependency from 3.1 to 2.1 (#124).

    Process a task on a writable space by default (#42).

    Wait until a space or an index is created (#68, #116).

    Tarantool Cartridge role (#107).

Bugfixes

    Fix build and installation of rpm/deb packages (#124).

    Do not restart a work fiber if an index does not exist (#64).

    Update changelogs for rpm/deb packages.

Testing

    Shuffle tests (#118).

    Fix test_mvcc_vinyl_tx_conflict (#104, #105).

    Fix flaky 'simple expires test' (#90).

Other

    expirationd.start() parameter `space_id` has been renamed to
    `space` (#112).

    Add GitHub Actions workflow with debug Tarantool build (#102).

    Add GitHub Actions workflow for deploying module packages to S3
    based repositories (#43).
oleg-jukovec added a commit that referenced this issue Aug 11, 2022
Overview

    This release adds a Tarantool Cartridge role for expirationd
    package and improves the default behavior.

Breaking changes

    None.

Deprecated

    Obsolete functions: task_stats, kill_task, get_task, get_tasks, run_task,
    show_task_list.

New features

    Continue a task from a last tuple (#54).

    Decrease tarantool-checks dependency from 3.1 to 2.1 (#124).

    Process a task on a writable space by default (#42).

    Wait until a space or an index is created (#68, #116).

    Tarantool Cartridge role (#107).

Bugfixes

    Fix build and installation of rpm/deb packages (#124).

    Do not restart a work fiber if an index does not exist (#64).

    Update changelogs for rpm/deb packages.

Testing

    Shuffle tests (#118).

    Fix test_mvcc_vinyl_tx_conflict (#104, #105).

    Fix flaky 'simple expires test' (#90).

Other

    expirationd.start() parameter `space_id` has been renamed to
    `space` (#112).

    Add GitHub Actions workflow with debug Tarantool build (#102).

    Add GitHub Actions workflow for deploying module packages to S3
    based repositories (#43).
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature A new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants