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

fix(src): validation log with notice level #49

Merged
merged 7 commits into from
Nov 24, 2023
Merged

Conversation

chronolaw
Copy link
Contributor

@chronolaw chronolaw commented Nov 15, 2023

#34 introduced a new directive lmdb_validation_tag, but the mismatch log level WARN is too high,
this PR change the log level to NOTICE.

This may fix the ci test: https://github.com/Kong/kong/actions/runs/6876582885/job/18702488766

Related PR: Kong/kong#12026

@chronolaw chronolaw marked this pull request as draft November 20, 2023 09:18
@@ -539,7 +539,7 @@ static ngx_int_t ngx_lua_resty_lmdb_init(ngx_cycle_t *cycle)
if (ngx_lua_resty_lmdb_validate(cycle, lcf) != NGX_OK) {
ngx_lua_resty_lmdb_close_file(cycle, lcf);

ngx_log_error(NGX_LOG_WARN, cycle->log, 0,
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0,
Copy link
Member

Choose a reason for hiding this comment

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

I want this to be more visible as wiping the database is a destructive operation. Why would this message occur in our tests anyway? We are not testing the upgrade in integration tests.

Also, could you test by changing the .requirments file to point to this branch and shows the test passes? I want to make sure this PR is good before merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When kong first start, there is no tag in lmdb, and we have set validation tag in nginx-kong.conf, so the C module will wipe the lmdb database and leave a log message.

If the log is warning level, it will break the test case in spec/02-integration/02-cmd/02-start_stop_spec.lua.

assert.logfile().has.no.line("[warn]", true)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PR Kong/kong#12026 is using this branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps we could add another condition:
if the lmdb database is empty then write the tag into database and don't think it is an warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

Copy link
Member

Choose a reason for hiding this comment

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

if the lmdb database is empty then write the tag into database and don't think it is an warning.

THis should not be necessary, for our use case we can assume lack of tag = empty database. We do not concern compatibility with other LMDB using applications.

@chronolaw chronolaw marked this pull request as ready for review November 22, 2023 11:46
@dndx dndx merged commit 19a6da0 into master Nov 24, 2023
5 checks passed
@dndx dndx deleted the fix/change_log_to_notice branch November 24, 2023 08:27
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.

3 participants