From: ildumi95 Date: Mon, 7 Feb 2022 15:06:50 +0000 (+0100) Subject: New upstream version 2.0.45 X-Git-Tag: archive/raspbian/2.0.45-1+rpi1^2~4^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ba7c0337777d4242a9aad521f1bda6cf9aef55b4;p=siridb-server.git New upstream version 2.0.45 --- diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..9daf0b0f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,30 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Create a database with the following configuration '...' +2. Do the following action '....' +3. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Machine/OS (please complete the following information):** + - OS: [e.g. Debian] + - Version [e.g. Buster, AMD64] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..11fc491e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..ffc2bab6 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +info@siridb.net. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/debian/changelog b/debian/changelog index f7657064..ab11df12 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +siridb-server (2.0.45-0~tt1) unstable; urgency=medium + + * New upstream release + - Compatibility with libcleri v1.x + - Prioritize replication + + -- Jeroen van der Heijden Thu, 13 Jan 2022 11:37:26 +0100 + siridb-server (2.0.44-0~tt1) unstable; urgency=medium * New upstream release diff --git a/include/siri/db/access.h b/include/siri/db/access.h index 8587f18d..ea8a7353 100644 --- a/include/siri/db/access.h +++ b/include/siri/db/access.h @@ -44,6 +44,7 @@ typedef struct siridb_access_repr_s siridb_access_repr_t; #include +#include uint32_t siridb_access_from_strn(const char * str, size_t n); diff --git a/include/siri/grammar/gramp.h b/include/siri/grammar/gramp.h index df8d81f9..439ccb10 100644 --- a/include/siri/grammar/gramp.h +++ b/include/siri/grammar/gramp.h @@ -24,9 +24,17 @@ #define HELP_OFFSET CLERI_GID_HELP_ACCESS #define HELP_COUNT CLERI_GID_HELP_TIMEZONES + 1 - HELP_OFFSET +#if CLERI_VERSION_MAJOR >= 1 +typedef struct cleri_node_s cleri_children_t; +#define cleri_gn(__child) (__child) + +#else +#define cleri_gn(__child) (__child)->node +#endif + -#if CLERI_VERSION_MINOR >= 12 +#if CLERI_VERSION_MAJOR >= 1 || CLERI_VERSION_MINOR >= 12 #if SIRIDB_IS64BIT #define CLERI_NODE_DATA(__node) ((int64_t)(__node)->data) #define CLERI_NODE_DATA_ADDR(__node) ((int64_t *) &(__node)->data) diff --git a/include/siri/version.h b/include/siri/version.h index a08aabab..7915f2cf 100644 --- a/include/siri/version.h +++ b/include/siri/version.h @@ -6,7 +6,7 @@ #define SIRIDB_VERSION_MAJOR 2 #define SIRIDB_VERSION_MINOR 0 -#define SIRIDB_VERSION_PATCH 44 +#define SIRIDB_VERSION_PATCH 45 /* * Use SIRIDB_VERSION_PRE_RELEASE for alpha release versions. diff --git a/src/cexpr/cexpr.c b/src/cexpr/cexpr.c index 81b82d5f..113862c6 100644 --- a/src/cexpr/cexpr.c +++ b/src/cexpr/cexpr.c @@ -532,10 +532,10 @@ static cexpr_t * CEXPR_walk_node( cleri_children_t * current = node->children; - while (current != NULL && current->node != NULL) + while (current != NULL && cleri_gn(current) != NULL) { cexpr = CEXPR_walk_node( - current->node, + cleri_gn(current), cexpr, list, condition, diff --git a/src/siri/db/access.c b/src/siri/db/access.c index 8cc862c2..0c34946b 100644 --- a/src/siri/db/access.c +++ b/src/siri/db/access.c @@ -2,6 +2,7 @@ * access.c - Access constants and functions. */ #include +#include #include #include @@ -54,8 +55,8 @@ uint32_t siridb_access_from_children(cleri_children_t * children) while (children != NULL) { access_bit |= siridb_access_from_strn( - children->node->str, - children->node->len); + cleri_gn(children)->str, + cleri_gn(children)->len); if (children->next == NULL) break; children = children->next->next; diff --git a/src/siri/db/aggregate.c b/src/siri/db/aggregate.c index 8ff99dbf..2dad9014 100644 --- a/src/siri/db/aggregate.c +++ b/src/siri/db/aggregate.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -216,15 +217,16 @@ vec_t * siridb_aggregate_list(cleri_children_t * children, char * err_msg) /* Loop over all aggregations */ while (1) { - gid = children->node->children->node->cl_obj->gid; + gid = cleri_gn(cleri_gn(children)->children)->cl_obj->gid; switch (gid) { case CLERI_GID_F_LIMIT: AGGR_NEW { - int64_t limit = CLERI_NODE_DATA(children->node->children->node-> - children->next->next->node); + int64_t limit = CLERI_NODE_DATA( + cleri_gn(cleri_gn(cleri_gn(children) + ->children)->children->next->next)); if (limit <= 0) { @@ -238,9 +240,9 @@ vec_t * siridb_aggregate_list(cleri_children_t * children, char * err_msg) aggr->limit = limit; - gid = children->node->children->node->children->next-> - next->next->next->node->children->node-> - cl_obj->gid; + gid = cleri_gn(cleri_gn(cleri_gn( + cleri_gn(children)->children)->children->next-> + next->next->next)->children)->cl_obj->gid; switch (gid) { @@ -329,23 +331,21 @@ vec_t * siridb_aggregate_list(cleri_children_t * children, char * err_msg) AGGR_NEW { cleri_node_t * onode; - if ( children->node->children->node->children-> + if ( cleri_gn(cleri_gn(children)->children)->children-> next->next->next->next == NULL) { aggr->filter_opr = CEXPR_EQ; - onode = children->node->children->node-> - children->next->next->node-> - children->node; + onode = cleri_gn(cleri_gn(cleri_gn(cleri_gn(children) + ->children)->children->next->next)->children); } else { aggr->filter_opr = cexpr_operator_fn( - children->node->children->node-> - children->next->next->node-> - children->node); - onode = children->node->children->node-> - children->next->next->next->node-> - children->node; + cleri_gn(cleri_gn(cleri_gn(cleri_gn(children) + ->children)->children->next->next)->children)); + onode = cleri_gn(cleri_gn(cleri_gn(cleri_gn(children) + ->children)->children->next->next->next)-> + children); } if (AGGREGATE_init_filter(aggr, onode, err_msg)) { @@ -362,14 +362,14 @@ vec_t * siridb_aggregate_list(cleri_children_t * children, char * err_msg) case CLERI_GID_F_DERIVATIVE: AGGR_NEW { - cleri_node_t * dlist = children->node->children-> - node->children->next->next->node; + cleri_node_t * dlist = cleri_gn(cleri_gn(cleri_gn(children) + ->children)->children->next->next); - if (dlist->children != NULL && dlist->children->node != NULL) + if (dlist->children != NULL && cleri_gn(dlist->children) != NULL) { /* result is at least positive, checked earlier */ aggr->timespan = - (double) CLERI_NODE_DATA(dlist->children->node); + (double) CLERI_NODE_DATA(cleri_gn(dlist->children)); if (!aggr->timespan) { @@ -385,7 +385,7 @@ vec_t * siridb_aggregate_list(cleri_children_t * children, char * err_msg) { /* result is always positive */ aggr->group_by = CLERI_NODE_DATA( - dlist->children->next->next->node); + cleri_gn(dlist->children->next->next)); if (!aggr->group_by) { @@ -421,14 +421,13 @@ vec_t * siridb_aggregate_list(cleri_children_t * children, char * err_msg) case CLERI_GID_F_FIRST: case CLERI_GID_F_LAST: AGGR_NEW - if (children->node->children->node->children-> - next->next->next != NULL) + if (cleri_gn(cleri_gn(children)->children) + ->children->next->next->next != NULL) { /* result is always positive, checked earlier */ aggr->group_by = CLERI_NODE_DATA( - children->node->children->node-> - children->next->next->node->children-> - node); + cleri_gn(cleri_gn(cleri_gn(cleri_gn(children) + ->children)->children->next->next)->children)); if (!aggr->group_by) { @@ -487,8 +486,8 @@ void siridb_aggregate_list_free(vec_t * alist) */ int siridb_aggregate_can_skip(cleri_children_t * children) { - cleri_node_t * nd = \ - children->node->children->node->children->node->children->node; + cleri_node_t * nd = cleri_gn(cleri_gn(cleri_gn(cleri_gn(children) + ->children)->children)->children); switch (nd->cl_obj->gid) { diff --git a/src/siri/db/listener.c b/src/siri/db/listener.c index 9dc65e30..ec42c8c9 100644 --- a/src/siri/db/listener.c +++ b/src/siri/db/listener.c @@ -578,8 +578,8 @@ static void enter_alter_group(uv_async_t * handle) MASTER_CHECK_ACCESSIBLE(siridb) - cleri_node_t * group_node = - query->nodes->node->children->next->node; + cleri_node_t * group_node = \ + cleri_gn(query->nodes->node->children->next); siridb_group_t * group; char name[group_node->len - 1]; @@ -611,7 +611,7 @@ static void enter_alter_tag(uv_async_t * handle) MASTER_CHECK_ACCESSIBLE(siridb) - cleri_node_t * tag_node = query->nodes->node->children->next->node; + cleri_node_t * tag_node = cleri_gn(query->nodes->node->children->next); siridb_tag_t * tag; char name[tag_node->len - 1]; @@ -655,7 +655,7 @@ static void enter_alter_server(uv_async_t * handle) query_alter_t * q_alter = (query_alter_t *) query->data; siridb_server_t * server = siridb_server_from_node( siridb, - query->nodes->node->children->next->node->children->node, + cleri_gn(cleri_gn(query->nodes->node->children->next)->children), query->err_msg); if (server == NULL) @@ -716,7 +716,7 @@ static void enter_alter_user(uv_async_t * handle) MASTER_CHECK_ACCESSIBLE(siridb) cleri_node_t * user_node = - query->nodes->node->children->next->node; + cleri_gn(query->nodes->node->children->next); query_alter_t * q_alter = (query_alter_t *) query->data; siridb_user_t * user; @@ -845,7 +845,7 @@ static void enter_grant_user(uv_async_t * handle) MASTER_CHECK_ACCESSIBLE(siridb) cleri_node_t * user_node = - query->nodes->node->children->next->node; + cleri_gn(query->nodes->node->children->next); siridb_user_t * user; char username[user_node->len - 1]; xstr_extract_string(username, user_node->str, user_node->len); @@ -1003,7 +1003,7 @@ static void enter_limit_expr(uv_async_t * handle) siridb_query_t * query = handle->data; siridb_t * siridb = query->client->siridb; query_list_t * qlist = (query_list_t *) query->data; - int64_t limit = CLERI_NODE_DATA(query->nodes->node->children->next->node); + int64_t limit = CLERI_NODE_DATA(cleri_gn(query->nodes->node->children->next)); if (limit <= 0 || limit > siridb->list_limit) { @@ -1059,7 +1059,7 @@ static void enter_merge_as(uv_async_t * handle) { siridb_query_t * query = handle->data; query_select_t * q_select = query->data; - cleri_node_t * node = query->nodes->node->children->next->next->node; + cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next); q_select->merge_as = malloc(node->len - 1); if (q_select->merge_as == NULL) @@ -1072,8 +1072,9 @@ static void enter_merge_as(uv_async_t * handle) if (IS_MASTER && query->nodes->node->children->next->next->next != NULL) { q_select->mlist = siridb_aggregate_list( - query->nodes->node->children->next->next->next->node-> - children->node->children->next->node->children, + cleri_gn(cleri_gn(cleri_gn( + query->nodes->node->children->next->next->next)-> + children)->children->next)->children, query->err_msg); if (q_select->mlist == NULL) @@ -1095,7 +1096,7 @@ static void enter_revoke_user(uv_async_t * handle) MASTER_CHECK_ACCESSIBLE(siridb) cleri_node_t * user_node = - query->nodes->node->children->next->node; + cleri_gn(query->nodes->node->children->next); siridb_user_t * user; char username[user_node->len - 1]; xstr_extract_string(username, user_node->str, user_node->len); @@ -1156,7 +1157,7 @@ static void enter_select_stmt(uv_async_t * handle) NULL : imap_new(); /* child is always the ',' and child->next the node */ - child = query->nodes->node->children->next->node->children; + child = cleri_gn(query->nodes->node->children->next)->children; skip_get_points = siridb_aggregate_can_skip(child); child = child->next; @@ -1192,7 +1193,7 @@ static void enter_set_expression(uv_async_t * handle) { siridb_query_t * query = handle->data; siridb_t * siridb = query->client->siridb; - cleri_node_t * node = query->nodes->node->children->next->next->node; + cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next); query_alter_t * q_alter = (query_alter_t *) query->data; if (siridb_group_update_expression( @@ -1215,7 +1216,8 @@ static void enter_set_ignore_threshold(uv_async_t * handle) siridb_query_t * query = handle->data; query_wrapper_t * q_wrapper = (query_wrapper_t *) query->data; - if ( query->nodes->node->children->next->next->node->children->node-> + if ( cleri_gn(cleri_gn( + query->nodes->node->children->next->next)->children)-> cl_obj->gid == CLERI_GID_K_TRUE) { q_wrapper->flags |= QUERIES_IGNORE_DROP_THRESHOLD; @@ -1229,7 +1231,7 @@ static void enter_set_name(uv_async_t * handle) siridb_query_t * query = handle->data; siridb_t * siridb = query->client->siridb; cleri_node_t * name_node = - query->nodes->node->children->next->next->node; + cleri_gn(query->nodes->node->children->next->next); char name[name_node->len - 1]; xstr_extract_string(name, name_node->str, name_node->len); @@ -1286,7 +1288,7 @@ static void enter_set_password(uv_async_t * handle) siridb_user_t * user = ((query_alter_t *) query->data)->via.user; cleri_node_t * pw_node = - query->nodes->node->children->next->next->node; + cleri_gn(query->nodes->node->children->next->next); char password[pw_node->len - 1]; xstr_extract_string(password, pw_node->str, pw_node->len); @@ -1631,7 +1633,7 @@ static void enter_series_setopr(uv_async_t * handle) siridb_query_t * query = handle->data; query_wrapper_t * q_wrapper = query->data; - switch (query->nodes->node->children->node->cl_obj->gid) + switch (cleri_gn(query->nodes->node->children)->cl_obj->gid) { case CLERI_GID_K_UNION: q_wrapper->update_cb = &imap_union_ref; @@ -1700,7 +1702,7 @@ static void enter_tag_series(uv_async_t * handle) MASTER_CHECK_VERSION(siridb, "2.0.38") cleri_node_t * tag_node = - query->nodes->node->children->next->node; + cleri_gn(query->nodes->node->children->next); siridb_tag_t * tag; char name[tag_node->len - 1]; xstr_extract_string(name, tag_node->str, tag_node->len); @@ -1819,7 +1821,7 @@ static void enter_untag_series(uv_async_t * handle) MASTER_CHECK_VERSION(siridb, "2.0.38") cleri_node_t * tag_node = - query->nodes->node->children->next->node; + cleri_gn(query->nodes->node->children->next); siridb_tag_t * tag; char name[tag_node->len - 1]; @@ -1889,7 +1891,7 @@ static void enter_where_xxx(uv_async_t * handle) { siridb_query_t * query = handle->data; cexpr_t * cexpr = - cexpr_from_node(query->nodes->node->children->next->node); + cexpr_from_node(cleri_gn(query->nodes->node->children->next)); if (cexpr == NULL) { @@ -1920,12 +1922,12 @@ static void enter_xxx_columns(uv_async_t * handle) { qp_add_raw( query->packer, - (const unsigned char *) columns->node->str, - columns->node->len); + (const unsigned char *) cleri_gn(columns)->str, + cleri_gn(columns)->len); if (vec_append_safe( &qlist->props, - &columns->node->children->node->cl_obj->gid)) + &cleri_gn(cleri_gn(columns)->children)->cl_obj->gid)) { MEM_ERR_RET } @@ -1950,7 +1952,7 @@ static void exit_after_expr(uv_async_t * handle) siridb_query_t * query = handle->data; ((query_select_t *) query->data)->start_ts = (uint64_t *) CLERI_NODE_DATA_ADDR( - query->nodes->node->children->next->node); + cleri_gn(query->nodes->node->children->next)); SIRIPARSER_NEXT_NODE } @@ -2046,7 +2048,7 @@ static void exit_before_expr(uv_async_t * handle) ((query_select_t *) query->data)->end_ts = (uint64_t *) CLERI_NODE_DATA_ADDR( - query->nodes->node->children->next->node); + cleri_gn(query->nodes->node->children->next)); SIRIPARSER_NEXT_NODE } @@ -2057,10 +2059,10 @@ static void exit_between_expr(uv_async_t * handle) query_select_t * q_select = query->data; q_select->start_ts = (uint64_t *) CLERI_NODE_DATA_ADDR( - query->nodes->node->children->next->node); + cleri_gn(query->nodes->node->children->next)); q_select->end_ts = (uint64_t *) CLERI_NODE_DATA_ADDR( - query->nodes->node->children->next->next->next->node); + cleri_gn(query->nodes->node->children->next->next->next)); if (*q_select->start_ts > *q_select->end_ts) { @@ -2658,10 +2660,10 @@ static void exit_create_group(uv_async_t * handle) siridb_query_t * query = handle->data; siridb_t * siridb = query->client->siridb; cleri_node_t * name_nd = - query->nodes->node->children->next->node; + cleri_gn(query->nodes->node->children->next); cleri_node_t * for_nd = - query->nodes->node->children->next->next->next->node; + cleri_gn(query->nodes->node->children->next->next->next); MASTER_CHECK_ACCESSIBLE(siridb) @@ -2721,7 +2723,7 @@ static void exit_create_user(uv_async_t * handle) siridb_t * siridb = query->client->siridb; siridb_user_t * user = ((query_alter_t *) query->data)->via.user; cleri_node_t * user_node = - query->nodes->node->children->next->node; + cleri_gn(query->nodes->node->children->next); /* both name and packer should be NULL at this point */ assert(user->name == NULL); @@ -2787,7 +2789,7 @@ static void exit_drop_group(uv_async_t * handle) MASTER_CHECK_ACCESSIBLE(siridb) cleri_node_t * group_node = - query->nodes->node->children->next->node; + cleri_gn(query->nodes->node->children->next); char name[group_node->len - 1]; @@ -2936,7 +2938,7 @@ static void exit_drop_server(uv_async_t * handle) siridb_t * siridb = query->client->siridb; siridb_server_t * server = siridb_server_from_node( siridb, - query->nodes->node->children->next->node->children->node, + cleri_gn(cleri_gn(query->nodes->node->children->next)->children), query->err_msg); MASTER_CHECK_REINDEXING(siridb) @@ -3109,7 +3111,7 @@ static void exit_drop_tag(uv_async_t * handle) MASTER_CHECK_ACCESSIBLE(siridb) cleri_node_t * tag_node = - query->nodes->node->children->next->node; + cleri_gn(query->nodes->node->children->next); char name[tag_node->len - 1]; @@ -3148,7 +3150,7 @@ static void exit_drop_user(uv_async_t * handle) MASTER_CHECK_ACCESSIBLE(siridb) cleri_node_t * user_node = - query->nodes->node->children->next->node; + cleri_gn(query->nodes->node->children->next); char username[user_node->len - 1]; xstr_extract_string(username, user_node->str, user_node->len); @@ -3973,7 +3975,7 @@ static void exit_select_aggregate(uv_async_t * handle) if (q_select->series_map->len) { q_select->alist = siridb_aggregate_list( - query->nodes->node->children->node->children, + cleri_gn(query->nodes->node->children)->children, query->err_msg); if (q_select->alist == NULL) { @@ -4096,7 +4098,7 @@ static void exit_set_address(uv_async_t * handle) { siridb_query_t * query = handle->data; siridb_server_t * server = ((query_alter_t *) query->data)->via.server; - cleri_node_t * node = query->nodes->node->children->next->next->node; + cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next); siridb_t * siridb = query->client->siridb; if (siridb->server == server || server->client != NULL) @@ -4146,8 +4148,9 @@ static void exit_set_backup_mode(uv_async_t * handle) siridb_server_t * server = ((query_alter_t *) query->data)->via.server; - int backup_mode = query->nodes->node->children->next->next->node-> - children->node->cl_obj->gid == CLERI_GID_K_TRUE; + int backup_mode = cleri_gn(cleri_gn( + query->nodes->node->children->next->next)-> + children)->cl_obj->gid == CLERI_GID_K_TRUE; if (backup_mode ^ ((server->flags & SERVER_FLAG_BACKUP_MODE) != 0)) { @@ -4242,7 +4245,7 @@ static void exit_set_drop_threshold(uv_async_t * handle) MASTER_CHECK_ACCESSIBLE(siridb) - cleri_node_t * node = query->nodes->node->children->next->next->node; + cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next); double drop_threshold = xstr_to_double(node->str); @@ -4307,7 +4310,7 @@ static void exit_set_expiration_xxx( MASTER_CHECK_ACCESSIBLE(siridb) MASTER_CHECK_VERSION(siridb, "2.0.35") - cleri_node_t * node = query->nodes->node->children->next->next->node; + cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next); uint64_t expiration = (uint64_t) CLERI_NODE_DATA(node); if (IS_MASTER && expiration) @@ -4421,7 +4424,7 @@ static void exit_set_list_limit(uv_async_t * handle) MASTER_CHECK_ACCESSIBLE(siridb) MASTER_CHECK_VERSION(siridb, "2.0.17") - cleri_node_t * node = query->nodes->node->children->next->next->node; + cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next); uint64_t limit = xstr_to_uint64(node->str, node->len); @@ -4484,8 +4487,8 @@ static void exit_set_log_level(uv_async_t * handle) assert (query->data != NULL); - cleri_node_t * node = - query->nodes->node->children->next->next->node->children->node; + cleri_node_t * node = cleri_gn(cleri_gn( + query->nodes->node->children->next->next)->children); int log_level; @@ -4622,7 +4625,7 @@ static void exit_set_port(uv_async_t * handle) { siridb_query_t * query = handle->data; siridb_server_t * server = ((query_alter_t *) query->data)->via.server; - cleri_node_t * node = query->nodes->node->children->next->next->node; + cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next); siridb_t * siridb = query->client->siridb; if (siridb->server == server || server->client != NULL) @@ -4679,7 +4682,7 @@ static void exit_set_select_points_limit(uv_async_t * handle) MASTER_CHECK_ACCESSIBLE(siridb) MASTER_CHECK_VERSION(siridb, "2.0.17") - cleri_node_t * node = query->nodes->node->children->next->next->node; + cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next); uint64_t limit = xstr_to_uint64(node->str, node->len); @@ -4742,8 +4745,8 @@ static void exit_set_tee_pipe_name(uv_async_t * handle) assert (query->data != NULL); - cleri_node_t * node = - query->nodes->node->children->next->next->node->children->node; + cleri_node_t * node = cleri_gn(cleri_gn( + query->nodes->node->children->next->next)->children); char pipe_name[node->len - 1]; char * p_pipe_name = NULL; @@ -4872,7 +4875,7 @@ static void exit_set_tee_pipe_name(uv_async_t * handle) static void exit_set_timezone(uv_async_t * handle) { siridb_query_t * query = handle->data; - cleri_node_t * node = query->nodes->node->children->next->next->node; + cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next); siridb_t * siridb = query->client->siridb; MASTER_CHECK_ACCESSIBLE(siridb) @@ -4941,8 +4944,8 @@ static void exit_show_stmt(uv_async_t * handle) siridb_user_t * db_user = query->client->origin; SIRIPARSER_MASTER_CHECK_ACCESS(db_user, SIRIDB_ACCESS_SHOW) - cleri_children_t * children = - query->nodes->node->children->next->node->children; + cleri_children_t * children = cleri_gn( + query->nodes->node->children->next)->children; siridb_props_cb prop_cb; assert (query->packer == NULL); @@ -4961,7 +4964,7 @@ static void exit_show_stmt(uv_async_t * handle) /* set props.h (who_am_i) to current db_name */ props_set_who_am_i(db_user->name); - if (children == NULL || children->node == NULL) + if (children == NULL || cleri_gn(children) == NULL) { /* show all properties */ int i; @@ -4981,7 +4984,7 @@ static void exit_show_stmt(uv_async_t * handle) while (1) { /* get the callback */ - prop_cb = props_get_cb(children->node->children->node-> + prop_cb = props_get_cb(cleri_gn(cleri_gn(children)->children)-> cl_obj->gid - KW_OFFSET); assert (prop_cb != NULL); /* all props are implemented */ prop_cb(siridb, query->packer, 1); diff --git a/src/siri/db/presuf.c b/src/siri/db/presuf.c index 4de324ca..2c8e1394 100644 --- a/src/siri/db/presuf.c +++ b/src/siri/db/presuf.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -63,29 +64,29 @@ siridb_presuf_t * siridb_presuf_add( { while (children != NULL) { - ps_children = children->node->children->node->children; - switch (ps_children->node->cl_obj->gid) + ps_children = cleri_gn(cleri_gn(children)->children)->children; + switch (cleri_gn(ps_children)->cl_obj->gid) { case CLERI_GID_K_PREFIX: - nps->prefix = malloc(ps_children->next->node->len + 1); + nps->prefix = malloc(cleri_gn(ps_children->next)->len + 1); if (nps->prefix != NULL) { /* not critical if suffix is still NULL */ nps->len += xstr_extract_string( nps->prefix, - ps_children->next->node->str, - ps_children->next->node->len); + cleri_gn(ps_children->next)->str, + cleri_gn(ps_children->next)->len); } break; case CLERI_GID_K_SUFFIX: - nps->suffix = malloc(ps_children->next->node->len + 1); + nps->suffix = malloc(cleri_gn(ps_children->next)->len + 1); if (nps->suffix != NULL) { /* not critical if suffix is still NULL */ nps->len += xstr_extract_string( nps->suffix, - ps_children->next->node->str, - ps_children->next->node->len); + cleri_gn(ps_children->next)->str, + cleri_gn(ps_children->next)->len); } break; default: diff --git a/src/siri/db/query.c b/src/siri/db/query.c index 941614a7..3077c8fa 100644 --- a/src/siri/db/query.c +++ b/src/siri/db/query.c @@ -620,7 +620,7 @@ static void QUERY_parse(uv_async_t * handle) #if SIRIDB_EXPR_ALLOC query, #endif - query->pr->tree->children->node, + cleri_gn(query->pr->tree->children), walker))) { switch (rc) @@ -682,7 +682,7 @@ static int QUERY_to_packer(qp_packer_t * packer, siridb_query_t * query) rc = QUERY_rebuild( siridb, - query->pr->tree->children->node, + cleri_gn(query->pr->tree->children), buffer, &size, packer->alloc_size); @@ -748,7 +748,7 @@ static int QUERY_walk( /* we can have nested integer and time expressions */ if ((rc = QUERY_time_expr( - node->children->node, + cleri_gn(node->children), walker, buffer, &size))) @@ -789,7 +789,7 @@ static int QUERY_walk( size_t size = EXPR_MAX_SIZE; if ((rc = QUERY_int_expr( - node->children->node, + cleri_gn(node->children), buffer, &size))) { @@ -820,21 +820,21 @@ static int QUERY_walk( else { current = node->children; - while (current != NULL && current->node != NULL) + while (current != NULL && cleri_gn(current) != NULL) { /* * We should not simple walk because THIS has no * cl_obj->cl_obj and THIS is save to skip. */ - while (current->node->cl_obj->tp == CLERI_TP_THIS) + while (cleri_gn(current)->cl_obj->tp == CLERI_TP_THIS) { - current = current->node->children; + current = cleri_gn(current)->children; } if ((rc = QUERY_walk( #if SIRIDB_EXPR_ALLOC query, #endif - current->node, + cleri_gn(current), walker))) { return rc; @@ -948,10 +948,10 @@ static int QUERY_time_expr( cleri_children_t * current; current = node->children; - while (current != NULL && current->node != NULL) + while (current != NULL && cleri_gn(current) != NULL) { if ((rc = QUERY_time_expr( - current->node, + cleri_gn(current), walker, buf, size))) @@ -992,10 +992,10 @@ static int QUERY_int_expr(cleri_node_t * node, char * buf, size_t * size) cleri_children_t * current; current = node->children; - while (current != NULL && current->node != NULL) + while (current != NULL && cleri_gn(current) != NULL) { if ((rc = QUERY_int_expr( - current->node, + cleri_gn(current), buf, size))) { @@ -1042,7 +1042,7 @@ static int QUERY_rebuild( { siridb_server_t * server = siridb_server_from_node( siridb, - node->children->node, + cleri_gn(node->children), NULL); if (server != NULL) { @@ -1088,11 +1088,11 @@ static int QUERY_rebuild( cleri_children_t * current; current = node->children; - while (current != NULL && current->node != NULL) + while (current != NULL && cleri_gn(current) != NULL) { if ((rc = QUERY_rebuild( siridb, - current->node, + cleri_gn(current), buf, size, max_size))) diff --git a/src/siri/db/replicate.c b/src/siri/db/replicate.c index 91a4bde5..cea0181e 100644 --- a/src/siri/db/replicate.c +++ b/src/siri/db/replicate.c @@ -15,7 +15,8 @@ #include #include -#define REPLICATE_SLEEP 10 /* 10 milliseconds * active tasks */ +/* Changed in v2.0.45: from 10 -> 0 milliseconds to prioritize replication */ +#define REPLICATE_SLEEP 0 /* 0 milliseconds * active tasks */ #define REPLICATE_TIMEOUT 300000 /* 5 minutes */ static void REPLICATE_work(uv_timer_t * handle); @@ -126,7 +127,7 @@ void siridb_replicate_start(siridb_replicate_t * replicate) uv_timer_start( replicate->timer, REPLICATE_work, - REPLICATE_SLEEP, + 10, /* initial sleep */ 0); } else