-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[skip-ci] [WIP] feat: implement PostgreSQL cluster synchronization with architectural improvements #5234
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-ci] [WIP] feat: implement PostgreSQL cluster synchronization with architectural improvements #5234
Changes from all commits
b67c7c1
d96be35
e0dec1c
958d250
7a08167
87a64b7
187b71e
697b68e
2444456
1d73967
9ec6bef
a3130ca
e2d6411
2c9bb51
2c08e77
c2a05ae
c97cca0
c37481a
4503c58
1beb5b9
a8a7b56
ab2c4f3
5af4011
1b58c78
086edfe
d64b4c8
d11620e
777a829
5d61766
ddf3aa0
3618e01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -639,3 +639,33 @@ const pgsql_variable_validator pgsql_variable_validator_search_path = { | |
| .validate = &pgsql_variable_validate_search_path, | ||
| .params = {} | ||
| }; | ||
|
|
||
|
|
||
| /** | ||
| * @brief Validates an integer variable for PostgreSQL. | ||
| * | ||
| * This function checks if the provided value is a valid integer representation | ||
| * and falls within the specified range. The range is defined by the params | ||
| * parameter. | ||
| * | ||
| * @param value The value to validate. | ||
| * @param params The parameter structure containing the integer range. | ||
| * @param session Unused parameter. | ||
| * @param transformed_value If not null, will be set to null. | ||
| * @return true if the value is a valid integer representation within the specified range, false otherwise. | ||
| */ | ||
| bool pgsql_variable_validate_integer(const char* value, const params_t* params, PgSQL_Session* session, char** transformed_value) { | ||
| (void)session; | ||
| if (transformed_value) *transformed_value = nullptr; | ||
| char* end = nullptr; | ||
| long num = strtol(value, &end, 10); | ||
| if (end == value || *end != '\0') return false; | ||
| if (num < params->int_range.min || num > params->int_range.max) return false; | ||
| return true; | ||
| } | ||
|
Comment on lines
+657
to
+665
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing
Compare with Proposed fix bool pgsql_variable_validate_integer(const char* value, const params_t* params, PgSQL_Session* session, char** transformed_value) {
(void)session;
if (transformed_value) *transformed_value = nullptr;
char* end = nullptr;
+ errno = 0;
long num = strtol(value, &end, 10);
- if (end == value || *end != '\0') return false;
+ if (end == value || *end != '\0' || errno == ERANGE) return false;
if (num < params->int_range.min || num > params->int_range.max) return false;
return true;
}π€ Prompt for AI Agents |
||
|
|
||
| const pgsql_variable_validator pgsql_variable_validator_integer = { | ||
| .type = VARIABLE_TYPE_INT, | ||
| .validate = &pgsql_variable_validate_integer, | ||
| .params = {} | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
flush_mysql_variables___database_to_runtime, a second query forpgsqlvariables is appended to themysqlquery stringq, separated by a semicolon. Theadmindb->execute_statementmethod is unlikely to support multiple SQL statements in a single call and return a combined result set; it typically prepares and executes only the first statement. As a result, the checksum formysql_variableswill be calculated incorrectly as it won't include thepgsql_variables. This logic should be separated, likely into theflush_pgsql_variables___database_to_runtimefunction.