Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitrijs Goloscapovs <dmitrijs.goloscapovs@zabbix.com>2022-04-19 17:25:03 +0300
committerDmitrijs Goloscapovs <dmitrijs.goloscapovs@zabbix.com>2022-04-19 17:25:03 +0300
commit420fd498f3772429e93f7c1323d0e1edb6190122 (patch)
tree9d6ae32f40716a9a01bbd39b2f43e6bd0c4072d9
parent13ce76576f4c37a7a1e6f4c67060b7241c0fdada (diff)
.......PS. [ZBX-20638] fixed dbversion_status flush when exiting due to unsupporetd elasticdb version
-rw-r--r--include/zbxhistory.h2
-rw-r--r--src/libs/zbxhistory/history.c4
-rw-r--r--src/libs/zbxhistory/history.h2
-rw-r--r--src/libs/zbxhistory/history_elastic.c5
-rw-r--r--src/zabbix_server/server.c2
5 files changed, 7 insertions, 8 deletions
diff --git a/include/zbxhistory.h b/include/zbxhistory.h
index 8f3e85cfb0b..d0fdaa7d157 100644
--- a/include/zbxhistory.h
+++ b/include/zbxhistory.h
@@ -61,7 +61,7 @@ int zbx_history_get_values(zbx_uint64_t itemid, int value_type, int start, int c
zbx_vector_history_record_t *values);
int zbx_history_requires_trends(int value_type);
-void zbx_history_check_version(struct zbx_json *json);
+void zbx_history_check_version(struct zbx_json *json, int *result);
#define FLUSH_SUCCEED 0
#define FLUSH_FAIL -1
diff --git a/src/libs/zbxhistory/history.c b/src/libs/zbxhistory/history.c
index d3470902bd1..173dfeab6bb 100644
--- a/src/libs/zbxhistory/history.c
+++ b/src/libs/zbxhistory/history.c
@@ -435,10 +435,10 @@ void zbx_history_value2variant(const history_value_t *value, unsigned char value
* functions *
* *
******************************************************************************/
-void zbx_history_check_version(struct zbx_json *json)
+int zbx_history_check_version(struct zbx_json *json, int *result)
{
if (NULL != CONFIG_HISTORY_STORAGE_URL)
{
- zbx_elastic_version_extract(json);
+ zbx_elastic_version_extract(json, result);
}
}
diff --git a/src/libs/zbxhistory/history.h b/src/libs/zbxhistory/history.h
index 5f715c7ed50..0311f893a4a 100644
--- a/src/libs/zbxhistory/history.h
+++ b/src/libs/zbxhistory/history.h
@@ -52,7 +52,7 @@ int zbx_history_sql_init(zbx_history_iface_t *hist, unsigned char value_type, ch
/* elastic hist */
int zbx_history_elastic_init(zbx_history_iface_t *hist, unsigned char value_type, char **error);
-void zbx_elastic_version_extract(struct zbx_json *json);
+void zbx_elastic_version_extract(struct zbx_json *json, int *result);
zbx_uint32_t zbx_elastic_version_get(void);
#endif
diff --git a/src/libs/zbxhistory/history_elastic.c b/src/libs/zbxhistory/history_elastic.c
index 1eaf20eda76..8aacdb5558b 100644
--- a/src/libs/zbxhistory/history_elastic.c
+++ b/src/libs/zbxhistory/history_elastic.c
@@ -998,7 +998,7 @@ int zbx_history_elastic_init(zbx_history_iface_t *hist, unsigned char value_type
* the response string *
* *
************************************************************************************/
-void zbx_elastic_version_extract(struct zbx_json *json)
+void zbx_elastic_version_extract(struct zbx_json *json, int *result)
{
#define RIGHT2(x) ((int)((zbx_uint32_t)(x) - ((zbx_uint32_t)((x)/100))*100))
zbx_httppage_t page;
@@ -1115,8 +1115,7 @@ out:
zabbix_log(LOG_LEVEL_ERR, " ");
db_version_info.flag = DB_VERSION_HIGHER_THAN_MAXIMUM_ERROR;
-
- exit(EXIT_FAILURE);
+ *result = FAIL;
}
else
{
diff --git a/src/zabbix_server/server.c b/src/zabbix_server/server.c
index fdbd92200fe..480592958a3 100644
--- a/src/zabbix_server/server.c
+++ b/src/zabbix_server/server.c
@@ -1187,7 +1187,7 @@ static void zbx_check_db(void)
zbx_db_version_json_create(&db_version_json, &db_version_info);
if (SUCCEED == result)
- zbx_history_check_version(&db_version_json);
+ zbx_history_check_version(&db_version_json, &result);
DBflush_version_requirements(db_version_json.buffer);
zbx_json_free(&db_version_json);