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

Resolve three scenarios that may cause workload to fail #422

Merged
merged 1 commit into from
Oct 30, 2023

Conversation

qinjingyuan
Copy link

resolve problems in describing #403.
using mothed:https://github.com/qinjingyuan/pgreplay-for-polardb

@polardb-bot
Copy link

polardb-bot bot commented Aug 25, 2023

Hi @qinjingyuan ~ Thanks for your contribution in this PR. ❤️

Please make sure that your PR conforms the standard, and has passed all the checks.

We will review your PR as soon as possible.

@polardb-bot
Copy link

polardb-bot bot commented Aug 25, 2023

Hey @qinjingyuan :

Congratulations~ 🎉 Your commit has passed all the checks. Please wait for further manual review.

@polardb-bot polardb-bot bot added the ci/success CI status is success label Aug 25, 2023
@polardb-bot
Copy link

polardb-bot bot commented Aug 31, 2023

Hey @qinjingyuan :

Congratulations~ 🎉 Your commit has passed all the checks. Please wait for further manual review.

@polardb-bot polardb-bot bot added ci/success CI status is success and removed ci/success CI status is success labels Aug 31, 2023
true,
NULL,NULL,NULL
},

Choose a reason for hiding this comment

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

新增参数一般放在末尾,同时sql 长度已经有参数 polar_auditlog_max_query_length 控制,所以这个参数可以去除

@@ -4333,6 +4352,28 @@ polar_write_audit_log(ErrorData *edata, const char *fmt, ...)
log_channel_write_buffer_pos);
log_channel_write_buffer_pos = 0;
polar_last_audit_log_flush_time = GetCurrentTimestamp();
// solving incomplete audit sql log problem

Choose a reason for hiding this comment

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

长度限制,直接去除

@@ -56,5 +57,5 @@ extern TupleDesc FetchPreparedStatementResultDesc(PreparedStatement *stmt);
extern List *FetchPreparedStatementTargetList(PreparedStatement *stmt);

extern void DropAllPreparedStatements(void);

extern char current_prepared_params_string[MAX_PREPARED_PARAMS_LEN];

Choose a reason for hiding this comment

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

这里采用固定长度的数组存储参数信息,存在不能动态扩容的限制。建议采用 MemoryContext 机制进行实现动态扩容,内存可以存放在 ErrorContext 中,正常情况下 log 完手动释放,报错时由系统自动释放。

对于 simple 协议的prepared 语句,sql 的执行会强依赖 定义的SQL。如果pgreplay 中没有这个定义语句,则相关的 SQL 都不能回放。为了解决这个限制,需要在输出参数的同时,也要附带语句的定义 SQL。

@@ -4246,7 +4262,8 @@ polar_construct_logdata_postprocess(StringInfoData *logbuf, ErrorData *edata)
else
{
// NOTE(wormhole.gl): make sure logbuf length is not larger than PIPE_MAX_PAYLOAD
polar_shrink_audit_log(logbuf, 0);
if (polar_auditlog_max_query_length_limit)

Choose a reason for hiding this comment

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

回退,不需要更改

@@ -2603,6 +2606,19 @@ log_line_prefix(StringInfo buf, ErrorData *edata)
appendStringInfoString(buf, formatted_log_time);
break;
/* POLAR: new format for polar */
case 'L':

Choose a reason for hiding this comment

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

这里利用 log_line_prefix 增加两个参数用来支持log search path 和 参数信息理论上是可以的。

但是考虑到新老版本兼容,以及周边生态的适配,如日志解析工具等,建议采用 直接将 上面两类信息和SQL文本一起输出。

在解析工具视角看,它就是一个SQL 文本,如果要适配,只需适配SQL 解析借口即可

Choose a reason for hiding this comment

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

利用两个 GUC 参数分别控制

@@ -116,8 +118,9 @@ char *Log_destination_string = NULL;
bool syslog_sequence_numbers = true;
bool syslog_split_messages = true;
/* POLAR */
#define LOG_CHANNEL_WRITE_BUFFER_SIZE 128 * 1024 /* 128k */
#define LOG_CHANNEL_WRITE_BUFFER_SIZE 64 * 1024 /* 64k */

Choose a reason for hiding this comment

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

无效更改,回退

@@ -226,6 +228,29 @@ ExecuteQuery(ExecuteStmt *stmt, IntoClause *intoClause,
/* Look it up in the hash table */
entry = FetchPreparedStatement(stmt->name, true);

// get prepare params for solving parameterization problem

Choose a reason for hiding this comment

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

这里需要改变实现方式,见 prepare.h 中的评论。

同时 对于 explain (analyze) execute s(1); 场景,也需要支持。

这里只是针对 走simple 协议的 prepared 场景,对于走 extended 协议的场景,也需要输出参数信息,见 exec_execute_message 函数

src/backend/commands/prepare.c Outdated Show resolved Hide resolved
@polardb-bot
Copy link

polardb-bot bot commented Oct 29, 2023

Hey @qinjingyuan :

Something wrong occuried during the checks of your commit 😟, please check the detail:

⚠️ build (centos7, oltp) View more details

@polardb-bot polardb-bot bot added ci/failure CI status is failure and removed ci/success CI status is success labels Oct 29, 2023
@polardb-bot
Copy link

polardb-bot bot commented Oct 29, 2023

Hey @qinjingyuan :

Something wrong occuried during the checks of your commit 😟, please check the detail:

⚠️ build (centos7, oltp) View more details

@polardb-bot polardb-bot bot added ci/failure CI status is failure and removed ci/failure CI status is failure labels Oct 29, 2023
@qinjingyuan qinjingyuan deleted the summer branch October 29, 2023 14:31
@qinjingyuan
Copy link
Author

reopen

@qinjingyuan
Copy link
Author

reopen pr

@qinjingyuan qinjingyuan reopened this Oct 29, 2023
@polardb-bot
Copy link

polardb-bot bot commented Oct 29, 2023

Hey @qinjingyuan :

Something wrong occuried during the checks of your commit 😟, please check the detail:

⚠️ build (centos7, oltp) View more details
⚠️ build (centos7, oltp) View more details

@polardb-bot polardb-bot bot added ci/failure CI status is failure and removed ci/failure CI status is failure labels Oct 29, 2023
@polardb-bot
Copy link

polardb-bot bot commented Oct 30, 2023

Hey @qinjingyuan :

Congratulations~ 🎉 Your commit has passed all the checks. Please wait for further manual review.

@polardb-bot polardb-bot bot added ci/success CI status is success and removed ci/failure CI status is failure labels Oct 30, 2023
analyze poalrdb log file and monitor db system info.
1. support log search_path info to log file.
2. support log paremeters type for parameterization SQL. Only parameters
type is logged for extended protocol. Parameters type and definnitation
    of SQL are logged for PREPARED simple protocol.
3. Add pgreplay tool. currently, this version pgreplay can
support polardb audit log and workload replay monitor function
4. Support extension protocol of pg execution and normal execution
when prepare is not present on pgreplay.
@polardb-bot
Copy link

polardb-bot bot commented Oct 30, 2023

Hey @qinjingyuan :

Congratulations~ 🎉 Your commit has passed all the checks. Please wait for further manual review.

@polardb-bot polardb-bot bot added ci/success CI status is success and removed ci/success CI status is success labels Oct 30, 2023
@mrdrivingduck
Copy link
Member

/rebase-and-merge

@polardb-bot polardb-bot bot merged commit 6071c25 into ApsaraDB:POLARDB_11_DEV Oct 30, 2023
5 checks passed
@polardb-bot
Copy link

polardb-bot bot commented Oct 30, 2023

@mrdrivingduck PR has been merged. 🍗

Thanks again for the contributors involved in this thread: ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/success CI status is success
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants