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

config: fix missing and stuck alerts #9598

Merged

Conversation

Totktonada
Copy link
Member

There are cases, when an alert is not reported, when it should (#9586). There are cases, when an alert is present, but its reason is already gone (#9574). These problems are fixed in this patchset. See details in the commit messages.

Fixes #9574
Fixes #9586

@Totktonada Totktonada requested review from a team as code owners January 16, 2024 17:37
@coveralls
Copy link

coveralls commented Jan 16, 2024

Coverage Status

coverage: 86.874% (-0.006%) from 86.88%
when pulling 6da09c1 on Totktonada:gh-9574-gh-9586-config-alert-fixes
into 557567e
on tarantool:master
.

Copy link
Contributor

@Serpentian Serpentian left a comment

Choose a reason for hiding this comment

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

Thank you for the patch! Looks great, just one minor comment

src/box/lua/config/utils/aboard.lua Outdated Show resolved Hide resolved
Copy link
Contributor

@Lord-KA Lord-KA left a comment

Choose a reason for hiding this comment

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

Thanks for the patchset, see my 8 comments below.

src/box/lua/config/utils/aboard.lua Outdated Show resolved Hide resolved
src/box/lua/config/utils/aboard.lua Outdated Show resolved Hide resolved
src/box/lua/config/utils/aboard.lua Show resolved Hide resolved
src/box/lua/config/utils/aboard.lua Show resolved Hide resolved
src/box/lua/config/utils/aboard.lua Show resolved Hide resolved
src/box/lua/config/applier/credentials.lua Outdated Show resolved Hide resolved
src/box/lua/config/applier/credentials.lua Outdated Show resolved Hide resolved
src/box/lua/config/applier/credentials.lua Outdated Show resolved Hide resolved
@Totktonada Totktonada marked this pull request as draft January 25, 2024 13:50
@Totktonada
Copy link
Member Author

I've marked this PR as draft to work on it a bit more.

I'll answer to the discussions, but some changes are only in my local copy at the moment. I'll sync everything a bit later and will notify the participants by a message here.

@Totktonada Totktonada force-pushed the gh-9574-gh-9586-config-alert-fixes branch 3 times, most recently from c701892 to 6ae9a0a Compare January 27, 2024 00:27
@Totktonada
Copy link
Member Author

I've addressed all the comments (or answered to them). I've changed a solution for #9574 (see details here), so I'm going to re-request reviews.

@Totktonada Totktonada marked this pull request as ready for review January 27, 2024 00:41
src/box/lua/config/utils/aboard.lua Show resolved Hide resolved
src/box/lua/config/utils/aboard.lua Outdated Show resolved Hide resolved
src/box/lua/config/utils/aboard.lua Outdated Show resolved Hide resolved
src/box/lua/config/utils/aboard.lua Outdated Show resolved Hide resolved
@Totktonada Totktonada force-pushed the gh-9574-gh-9586-config-alert-fixes branch from 6ae9a0a to f806f86 Compare January 30, 2024 17:39
@Totktonada Totktonada marked this pull request as draft January 30, 2024 17:50
@Totktonada Totktonada force-pushed the gh-9574-gh-9586-config-alert-fixes branch from f806f86 to ac095cf Compare February 1, 2024 16:56
@Totktonada Totktonada marked this pull request as ready for review February 1, 2024 17:04
Copy link
Contributor

@Lord-KA Lord-KA left a comment

Choose a reason for hiding this comment

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

Thanks for the patchset! Everything looks great, besides a few grammar-nazi nits above. LGTM

It encapsulates all the alerts manipulation in one place, splits it from
the main config logic and simplifies reading of the relevant code.

Several tests are updated to use the public API instead of the internal
one.

Part of tarantool#9574
Part of tarantool#9586

NO_DOC=refactoring, no user-visible changes
NO_CHANGELOG=see NO_DOC
NO_TEST=see NO_DOC
Before this patch `config:info().alerts` reports only last alert of a
certain type, while others are skipped. It is a regression from commit
fa97cc0 ("config: introduce droppable alerts").

The idea of the fix is to eliminate a key from all the alerts that are
not to be dropped later except on configuration reloading.

Fixes tarantool#9586

NO_DOC=bugfix
@Totktonada Totktonada force-pushed the gh-9574-gh-9586-config-alert-fixes branch 2 times, most recently from 36727e4 to dc61d17 Compare February 2, 2024 13:39
The declarative configuration has the `credentials` section that
describes users and their privileges. It is OK to have privileges for a
space/function/sequence that does not exist. Such a privilege will lead
to an alert that states that the privilege will be granted, when the
object is created.

The problem that is fixed by this commit is that such an alert was not
dropped, when the object is created and the relevant privileges are
granted.

There are several ways to solve the problem. Let's look on them.

1. When a privilege is granted, drop an alert if any.
2. After the config-database privilege synchronization, revisit alerts
   to drop all obsolete ones.
3. Drop all the alerts regarding missed privileges before the
   config-database privilege synchronization and issue actual alerts
   afterwards.

The first way is the simplest, but it doesn't cover one specific
scenario: an object rename.

Let's assume that the object T has privileges declared in the
configuration and the object doesn't exist. There is an alert regarding
it. Now, object S is renamed to T. Let's assume that S had some or all
the privileges needed for T according to the configuration.

In the given scenario, we don't need to grant some or all of the
privileges and, so, the first solution doesn't work. We don't reach the
code that grants the privileges and, so, dropping alerts at this point
has no effect.

The second and the third solutions are similar and mainly differs in how
complicated the code is. The third one is implemented here with idea of
simplifying the code.

The internal `aboard` module has the following changes.

1. The `aboard` module now ignores underscored fields of an alert on its
   serialization to allow a caller to store a machine-readable
   information in them.
2. The new method `:drop_if()` is added to perform a conditional alert
   drop.

Several unit test cases are updated, because now we always need
initialized `config._aboard` for testing of the credentials applier.

Fixes tarantool#9574

NO_DOC=bugfix
@Totktonada Totktonada force-pushed the gh-9574-gh-9586-config-alert-fixes branch from dc61d17 to 6da09c1 Compare February 2, 2024 14:46
@Totktonada Totktonada added the full-ci Enables all tests for a pull request label Feb 2, 2024
@Totktonada Totktonada merged commit 1c1ee4d into tarantool:master Feb 2, 2024
91 checks passed
@Totktonada Totktonada deleted the gh-9574-gh-9586-config-alert-fixes branch February 2, 2024 19:56
@Totktonada
Copy link
Member Author

Pushed to master, it is future 3.1.0.

Backported to release/3.0 (future 3.0.2) in PR #9645.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full-ci Enables all tests for a pull request
Projects
None yet
7 participants