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

Add support for more session variables #3731 #3761 #2702 #3754

Merged
merged 7 commits into from
Apr 28, 2022

Conversation

renecannao
Copy link
Contributor

@renecannao renecannao commented Jan 12, 2022

@renecannao renecannao marked this pull request as draft January 12, 2022 11:48
@renecannao
Copy link
Contributor Author

Implementation is not done yet. This is just a skeleton.

- aurora_read_replica_read_committed
- group_replication_consistency
- query_cache_type
@renecannao renecannao changed the title Add support for group_replication_consistency #3731 Add support for more session variables #3731 #3761 #2702 Feb 3, 2022
@renecannao
Copy link
Contributor Author

retest this please

1 similar comment
@renecannao
Copy link
Contributor Author

retest this please

@renecannao
Copy link
Contributor Author

retest this please

@renecannao
Copy link
Contributor Author

retest this please

@renecannao renecannao marked this pull request as ready for review February 21, 2022 19:18
// FIXME: but we need to switch to SQL_NAME_LAST_HIGH_WM
int idx = SQL_NAME_LAST_LOW_WM; // FIXME: here we work on absent variables
for (int i=0; i<SQL_NAME_LAST_LOW_WM; i++) {
if (
Copy link
Contributor

Choose a reason for hiding this comment

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

Could use the errno macros here from mariadb at deps/mariadb-client/include/mysqld_error.h. So that it could read if (myerr == ER_PARSE_ERROR || myerr == ER_UNKNOWN_SYSTEM_VARIABLE || myerr == ER_QUERY_CACHE_DISABLED). These macros are safer against typos, and the names match those in the official mysql documentation for verification as well. Fewer lines of code, and self documenting.

value1 = "0";
} else if (strcasecmp(value1.c_str(),"on")==0 || strcasecmp(value1.c_str(),"true")==0) {
value1 = "1";
} else if (strcasecmp(value1.c_str(),"demand")==0 || strcasecmp(value1.c_str(),"true")==0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The second or condition is already handled in the previous else if. If strcasecmp(value1.c_str(),"true")==0 condition is true, then it would be handled in the second case, always resulting in value1 = "1"; Should be removed.

@@ -108,6 +108,19 @@ void add_value_j(std::string& j, const std::string& s, variable *v) {
}


void add_values_and_quotes(const std::string& name, const std::vector<std::string>& values) {
for (std::vector<std::string>::const_iterator it = values.begin(); it != values.end(); it++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If using iterators this way, could write it for (auto it = values.begin(); it != values.end(); it++) shorter. Since all values here are iterated, an even simpler ranged based for loop could be used for (auto& value : values) which might also save some keystrokes, in this instance, no de-referencing *it would be needed, could write value instead.

Consider renaming s to quoted_val or quoted_value for the variable name describing what the string would hold.

vars["query_cache_type"] = new variable("query_cache_type", true, true, false);
vars["query_cache_type"]->add(bool_values);
vars["query_cache_type"]->add("2");
add_values_and_quotes("query_cache_type", {"DeMaNd"});
Copy link
Contributor

Choose a reason for hiding this comment

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

"demand" or "DEMAND" would be easier to read.

@@ -70,6 +70,19 @@ std::vector<std::string> forgotten_vars {};

#include "set_testing.h"

class var_counter {
Copy link
Contributor

Choose a reason for hiding this comment

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

For a class like this, could write struct var_counter which would is equivalent to a public access class by default, so wouldn't have to write public:. For incremental only counters, unsigned (uint64_t?) maybe better. For the constructor, could write var_counter() : count(0), unknown(0) {} and perform direct initialization.

}
};

//std::unordered_map<std::string,int> unknown_var_counters;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused comment, should remove.

@@ -428,5 +472,8 @@ int main(int argc, char *argv[]) {
for (unsigned int i=0; i<num_threads; i++) {
pthread_join(thi[i], NULL);
}
for (std::unordered_map<std::string,var_counter>::iterator it = vars_counters.begin(); it!=vars_counters.end(); it++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

auto for iterator type

@pondix
Copy link
Contributor

pondix commented Mar 10, 2022

Automated message: PR pending admin approval for build testing

@renecannao
Copy link
Contributor Author

retest this please

1 similar comment
@renecannao
Copy link
Contributor Author

retest this please

@renecannao renecannao merged commit ea721ff into v2.x Apr 28, 2022
@renecannao renecannao deleted the v2.x-group_replication_consistency branch April 30, 2022 16:07
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.

GR consistency: Unable to parse unknown SET query from client <ip:port>. Setting lock_hostgroup.
3 participants