8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

27.4.5 事件调度器状态27.4.5 Event Scheduler Status

事件调度器会将以错误或警告终止的事件执行信息写入 MySQL 服务器的错误日志。请参见 第 27.4.6 节,“事件调度器与 MySQL 权限” 了解示例。The Event Scheduler writes information about event execution that terminates with an error or warning to the MySQL Server's error log. See Section 27.4.6, “The Event Scheduler and MySQL Privileges” for an example.

为了获取有关事件调度器状态的信息以进行调试和故障排除,请运行 mysqladmin debug(参见 第 6.5.2 节,“mysqladmin — MySQL 服务器管理程序”);运行此命令后,服务器的错误日志将包含与事件调度器相关的输出,类似于这里显示的内容:To obtain information about the state of the Event Scheduler for debugging and troubleshooting purposes, run mysqladmin debug (see Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”); after running this command, the server's error log contains output relating to the Event Scheduler, similar to what is shown here:

Events status:
LLA = Last Locked At  LUA = Last Unlocked At
WOC = Waiting On Condition  DL = Data Locked

Event scheduler status:
State      : INITIALIZED
Thread id  : 0
LLA        : n/a:0
LUA        : n/a:0
WOC        : NO
Workers    : 0
Executed   : 0
Data locked: NO

Event queue status:
Element count   : 0
Data locked     : NO
Attempting lock : NO
LLA             : init_queue:95
LUA             : init_queue:103
WOC             : NO
Next activation : never

在作为事件调度器执行的事件的一部分发生的语句中,诊断消息(不仅是错误,还有警告)会被写入错误日志,并且在 Windows 上,也会写入应用程序事件日志。对于频繁执行的事件,这可能会导致大量日志消息。例如,对于 SELECT ... INTO var_list 语句,如果查询没有返回任何行,将发生错误码为 1329 的警告(No data),并且变量值保持不变。如果查询返回多行,将发生错误 1172(Result consisted of more than one row)。对于任一情况,你可以通过声明条件处理程序来避免将警告记录在日志中;请参见 第 15.6.7.2 节,“DECLARE ... HANDLER 语句”。对于可能检索多行的语句,另一种策略是使用 LIMIT 1 将结果集限制为单行。In statements that occur as part of events executed by the Event Scheduler, diagnostics messages (not only errors, but also warnings) are written to the error log, and, on Windows, to the application event log. For frequently executed events, it is possible for this to result in many logged messages. For example, for SELECT ... INTO var_list statements, if the query returns no rows, a warning with error code 1329 occurs (No data), and the variable values remain unchanged. If the query returns multiple rows, error 1172 occurs (Result consisted of more than one row). For either condition, you can avoid having the warnings be logged by declaring a condition handler; see Section 15.6.7.2, “DECLARE ... HANDLER Statement”. For statements that may retrieve multiple rows, another strategy is to use LIMIT 1 to limit the result set to a single row.