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

Skip DB check in helpers when main process is running #1291

Merged
merged 3 commits into from
Sep 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix alternative options for radio type preferences when exporting a scan_config [#1278](http://github.com/greenbone/gvmd/pull/1278)
- Replace deprecated sys_siglist with strsignal [#1280](https://github.com/greenbone/gvmd/pull/1280)
- Copy instead of moving when migrating predefined report formats [#1286](https://github.com/greenbone/gvmd/pull/1286)
- Skip DB check in helpers when main process is running [#1291](https://github.com/greenbone/gvmd/pull/1291)
- For radio prefs in GMP exclude value and include default [#1296](https://github.com/greenbone/gvmd/pull/1296)

### Removed
Expand Down
17 changes: 14 additions & 3 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -16414,8 +16414,13 @@ init_manage_internal (GSList *log_config,

if (skip_db_check == 0)
{
/* This only happens for init_manage callers with skip_db_check set, so
* there is ultimately only one caller case, the main process. */
/* This only happens for init_manage callers with skip_db_check set to 0
* and init_manage_helper callers. So there are only 2 callers:
*
* 1 the main process
* 2 a helper processes (--create-user, --get-users, etc) when the
* main process is not running. */

ret = check_db (check_encryption_key);
if (ret)
return ret;
Expand Down Expand Up @@ -16517,7 +16522,13 @@ init_manage_helper (GSList *log_config, const gchar *database,
0, /* Default max_email_message_size */
0, /* Stop active tasks. */
NULL,
0, /* Skip DB check. */
/* Skip DB check if main process is running, to
* avoid locking issues when creating tables.
*
* Safe because main process did the check. */
lockfile_locked ("gvm-serving")
? 1 /* Skip DB check. */
: 0, /* Do DB check. */
0); /* Dummy. */
}

Expand Down