pt-online-schema-change报错

今天在对一个大表加索引的时候失败了,具体如下:

SELECT /*!40001 SQL_NO_CACHE */ `goods_id` FROM `rosegal_db`.`eload_goods` FORCE INDEX(`PRIMARY`) WHERE ((`goods_id` >= ?)) ORDER BY `goods_id` LIMIT ?, 2 /*next chunk boundary*/

2016-01-05T23:32:28 Dropping triggers...

DROP TRIGGER IF EXISTS `rosegal_db`.`pt_osc_rosegal_db_eload_goods_del`;

DROP TRIGGER IF EXISTS `rosegal_db`.`pt_osc_rosegal_db_eload_goods_upd`;

DROP TRIGGER IF EXISTS `rosegal_db`.`pt_osc_rosegal_db_eload_goods_ins`;

2016-01-05T23:32:28 Dropped triggers OK.

2016-01-05T23:32:28 Dropping new table...

DROP TABLE IF EXISTS `rosegal_db`.`_eload_goods_new`;

2016-01-05T23:32:28 Dropped new table OK.

`rosegal_db`.`eload_goods` was not altered.

2016-01-05T23:32:28 Error copying rows from `rosegal_db`.`eload_goods` to `rosegal_db`.`_eload_goods_new`: Threads_running=52 exceeds its critical threshold 50

从提示上可以看出是Threads_running 超过了警告的阀值,查看官方文档,有两种方式来设置这个参数:

--critical-load
type: Array; default: Threads_running=50
Examine SHOW GLOBAL STATUS after every chunk, 
and abort if the load is too high. The option accepts a comma-separated list of MySQL status variables and thresholds. 
An optional =MAX_VALUE (or :MAX_VALUE) can follow each variable. If not given, 
the tool determines a threshold by examining the current value at startup and doubling it.
See --max-load for further details. These options work similarly, 
except that this option will abort the tool’s operation instead of pausing it,
 and the default value is computed differently if you specify no threshold. 
 The reason for this option is as a safety check in case the triggers on the
 original table add so much load to the server that it causes downtime. 
 There is probably no single value of Threads_running that is wrong for 
 every server, but a default of 50 seems likely to be unacceptably high
 for most servers, indicating that the operation should be canceled immediately.

大致的意思如下:
每次chunk操作前后,会根据show global status统计指定的状态量的变化,默认是统计Thread_running。
目的是为了安全,防止原始表上的触发器引起负载过高。这也是为了防止在线DDL对线上的影响。
超过设置的阀值,就会终止操作,在线DDL就会中断。提示的异常如上报错信息。

--max-load
type: Array; default: Threads_running=25
Examine SHOW GLOBAL STATUS after every chunk, and pause if any status variables are higher than their thresholds. 
The option accepts a comma-separated list of MySQL status variables. An optional =MAX_VALUE (or :MAX_VALUE) can 
follow each variable. If not given, the tool determines a threshold by examining the current value and increasing it by 20%.

For example, if you want the tool to pause when Threads_connected gets too high, you can specify “Threads_connected”,
 and the tool will check the current value when it starts working and add 20% to that value. If the current value is 100, 
 then the tool will pause when Threads_connected exceeds 120, and resume working when it is below 120 again. If you want to
 specify an explicit threshold, such as 110, you can use either “Threads_connected:110” or “Threads_connected=110”.

The purpose of this option is to prevent the tool from adding too much load to the server. If the data-copy queries are 
intrusive, or if they cause lock waits, then other queries on the server will tend to block and queue. This will typically 
cause Threads_running to increase, and the tool can detect that by running SHOW GLOBAL STATUS immediately after each query finishes. 
If you specify a threshold for this variable, then you can instruct the tool to wait until queries are running normally again. This will 
not prevent queueing, however; it will only give the server a chance to recover from the queueing. If you notice queueing, it is best to decrease the chunk time.

--max-load 选项定义一个阀值,在每次chunk操作后,查看show global status状态值是否高于指定的阀值。该参数接受一个mysql status状态变量以及一个阀值,
如果没有给定阀值,则定义一个阀值为为高于当前值的20%。
注意这个参数不会像--critical-load终止操作,而只是暂停操作。当status值低于阀值时,则继续往下操作。
是暂停还是终止操作这是--max-load和--critical-load的差别。

参数值为列表形式,可以指定show global status出现的状态值。比如,Thread_connect 等等。
格式如下:--critical-load="Threads_running=200"  或者--critical-load="Threads_running:200"。

时间: 2024-08-09 06:32:30

pt-online-schema-change报错的相关文章

xmlns:amq="http://activemq.apache.org/schema/core"报错

如题,项目集成ActiveMQ是配置文件报错 原因是:Spring命名空间配置错误,缺少相应的spring-bean.很显然,引用不到就是没有jar包啊. 我的解决办法,早pom.xml引用依赖 <dependency> <groupId>org.apache.activemq</groupId> <artifactId>activemq-core</artifactId> <version>5.5.0</version>

华硕笔记本U盘启动系统/WinPE报错。Windows failed to start. A Recent hardware or software change might be the cause.

最近在整一台华硕笔记本,大概有5年寿命了吧,质量还行,由于系统出了问题,打算用自制U盘WinPE进去修复一下.按照个人经验,在主板设置里启用了USB启动选项,并且设置USB启动顺序为第一个,可是进系统居然报错,如下图所示. Windows failed to start. A Recent hardware or software change might be the cause. To fix the problem: 1. Insert your windows installation

(转)解决dubbox-demo-provider.xml报错的问题:提示Failed to read schema document

背景:在eclipse项目中,经常会遇到xml文件提示找不到.xsd文件的情况.很有必要弄清xsd文件的加载过程! 1 解决过程 dubbo-demo-provider导入eclipse后dubbox-demo-provider.xml报错详情: Multiple annotations found at this line: - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be

报错&#39;cannot change visible in onshow or onhide&#39;

问题描述: 关闭程序的时候需要修改modalresult值, 原来把加载的事件写在MailForm的onshow事件里总是报'cannot change visible in onshow or onhide': 解决方法: 不要把事件写在onshow里面,改到oncreate事件里即可:   关闭窗体通过修改modalresult值的方法: procedure TFLogin.FormCloseQuery(Sender: TObject; var CanClose: Boolean); beg

mysql报错Packet for query is too large (12238 &gt; 1024). You can change this value

今天将项目部署到linux服务器的时候莫名其妙的报一些错误,可是在本地啥错没有,通过实时查看tomcat 的日志之后发现报错是: 实时查看日志: 1.先切换到:cd usr/local/tomcat5/logs 2.tail -f catalina.out 3.这样运行时就可以实时查看运行日志了 发现错误: rg.springframework.dao.TransientDataAccessResourceException: ### Error querying database. Cause

Spring AOP schema找不到报错 原

转自:https://my.oschina.net/zetaplusae/blog/144821 使用jersey+spring构建RESTful服务,并将应用部署在不能连接外网的服务器上.部署时,报错信息如下, WARNING: Ignored XML validation warning org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springfra

ssh登录locale报错:cannot change locale (zh_CN.UTF-8): No such file or directory

一.登录ssh报错: Last login: Tue Apr 23 03:42:01 2019 from 172.28.146.109 -bash: warning: setlocale: LC_ALL: cannot change locale (en_CN.UTF-8): No such file or directory -bash: warning: setlocale: LC_ALL: cannot change locale (en_CN.UTF-8) -bash: warning:

mysql workbench 报错:Can&#39;t analyze file, please try to change encoding type...

workbench 识别csv第一行作为column名,column名不能为中文,所以报错.解决方法:csv第一行改为英文列名,再进行导入. mysql workbench 报错:Can't analyze file, please try to change encoding type... 原文地址:https://www.cnblogs.com/HeartBlood/p/11888165.html

Sass Loader报错:ValidationError: Invalid options object. Sass Loader has been initialised using an options object that does not match the API schema.

在vue.config.js中引入sass全局配置后报错vue.config.js代码如下: module.exports = { devServer: { port: 3333, open: true }, css: { loaderOptions: { sass: { data: `@import "@/assets/scss/_variable.scss";` } } } } _variable.scss的代码如下: $theme-color: #33aef0; 组件中的scss

【软件工程 - SSM网页制作】报错解决 - Description Resource Path Location Type Cannot change version of project fac(导入maven项目出现红叉问题)

MAVEN项目报错解决 问题描述 导入项目时候出现 Description Resource Path Location Type Cannot change version of project facet Dynamic Web Module to 2.5错误 分析与解答 这是由于你的 Maven 编译级别是 jdk太低了 1.在eclipse的工程上选择属性,在选择Project Facets里面中选择Dynamic web Module,将版本改成2.5 如下图: 2.在工程目录下(项目