Skip to content

Add the "lazy start" technique to initialization stage #131

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

Merged
merged 2 commits into from
Oct 15, 2020

Conversation

LeonidVas
Copy link
Contributor

Previously, if an instance was started in read_only mode,
it could throw an error when initializing the queue module,
like this: "Can't modify data because this instance is in
read-only mode".
To avoid such behavior the "lazy start" technique has been added:
The queue module is loaded immediately if the instance was
configured with read_only = false. Otherwise, a start is delayed
until the instance will be configured with read_only = false.

Closes #122

ChangeLog: add the ability to start an instance with a loaded queue module in read-only mode. In this case, a start of the module will be delayed until the instance will be configured with read_only = false.

@LeonidVas LeonidVas self-assigned this Sep 3, 2020
@Totktonada
Copy link
Member

The similar problem: tarantool/expirationd#37

@LeonidVas LeonidVas requested review from Mons and ochaton September 7, 2020 13:50
@LeonidVas LeonidVas force-pushed the lvasiliev/gh-122-work-with-read-only-mode branch from 587c7a7 to 786c94f Compare September 9, 2020 15:58
Copy link
Member

@Totktonada Totktonada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, consider my doubts and fears below.

@LeonidVas LeonidVas force-pushed the lvasiliev/gh-122-work-with-read-only-mode branch from 786c94f to 7e982eb Compare October 9, 2020 16:05
When the script is long enough to contain multiple function, it's
nice to have a function like "main" instead of just a linear flow code.
The patch moves the initialization code of the queue module into
a separate function.
@LeonidVas LeonidVas force-pushed the lvasiliev/gh-122-work-with-read-only-mode branch from 7e982eb to 5c3f452 Compare October 9, 2020 16:06
Previously, if an instance was started in read_only mode,
it could throw an error when initializing the queue module,
like this: "Can't modify data because this instance is in
read-only mode".
To avoid such behavior the "lazy start" technique has been added:
The queue module is loaded immediately if the instance was
configured with read_only = false. Otherwise, a start is delayed
until the instance will be configured with read_only = false.

Closes #122
@LeonidVas LeonidVas force-pushed the lvasiliev/gh-122-work-with-read-only-mode branch from 5c3f452 to 6dc58a7 Compare October 15, 2020 17:37
Copy link
Member

@Totktonada Totktonada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot say that I'm comfortable with complexity we have there, but I don't want to push Leonid to experiment around different similar variants (given one with the __call metamethod replacing, with a proxy table whose __call invokes a real reconfiguration function, with registering a callback using box.on_reload_configuration) to understand what will looks better.

Since it should resolve the issue and I don't see anything that would lead to problems in use, it is okay for me.

@LeonidVas LeonidVas merged commit e4986c5 into master Oct 15, 2020
@LeonidVas LeonidVas deleted the lvasiliev/gh-122-work-with-read-only-mode branch October 15, 2020 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

require('queue') fails in read_only mode
3 participants