Open Ariznawlll opened 1 month ago
单机环境下恢复一个大约300w行的table 花费十几分钟
显示执行
mysql> begin;
Query OK, 0 rows affected (0.00 sec)
mysql> drop table if exists `bmsql_order_line`;
Query OK, 0 rows affected (0.05 sec)
mysql> use tpcc;
Database changed
mysql>
mysql> CREATE TABLE `bmsql_order_line` (
-> `ol_w_id` INT NOT NULL,
-> `ol_d_id` INT NOT NULL,
-> `ol_o_id` INT NOT NULL,
-> `ol_number` INT NOT NULL,
-> `ol_i_id` INT NOT NULL,
-> `ol_delivery_d` TIMESTAMP DEFAULT null,
-> `ol_amount` DECIMAL(6,2) DEFAULT null,
-> `ol_supply_w_id` INT DEFAULT null,
-> `ol_quantity` INT DEFAULT null,
-> `ol_dist_info` CHAR(24) DEFAULT null,
-> PRIMARY KEY (`ol_w_id`,`ol_d_id`,`ol_o_id`,`ol_number`)
-> ) partition by key algorithm = 2 (ol_w_id);
Query OK, 0 rows affected (0.03 sec)
mysql> insert into `tpcc`.`bmsql_order_line` SELECT * FROM `tpcc`.`bmsql_order_line` {snapshot = 'sp_01'};
Query OK, 2998810 rows affected (11 min 5.11 sec)
mysql> commit;
Query OK, 0 rows affected (5.93 sec)
恢复一个带主键的表insert 30w条只用1.93sec,但是insert300w行的分区表时间太慢了
mysql> begin;
Query OK, 0 rows affected (0.00 sec)
mysql> drop table if exists `bmsql_history`;
Query OK, 0 rows affected (0.01 sec)
mysql> use tpcc;
Database changed
mysql>
mysql> create table `bmsql_history` (`hist_id` INT NOT NULL AUTO_INCREMENT,`h_c_id` INT DEFAULT NULL,`h_c_d_id` INT DEFAULT NULL,`h_c_w_id` INT DEFAULT NULL,`h_d_id` INT DEFAULT NULL,`h_w_id` INT DEFAULT NULL,`h_date` TIMESTAMP DEFAULT NULL,`h_amount` DECIMAL(6,2) DEFAULT NULL,`h_data` VARCHAR(24) DEFAULT NULL,PRIMARY KEY (`hist_id`));
Query OK, 0 rows affected (0.02 sec)
mysql> insert into `tpcc`.`bmsql_history` SELECT * FROM `tpcc`.`bmsql_history` {snapshot = 'sp_01'};
Query OK, 300000 rows affected (1.93 sec)
mysql> commit;
Query OK, 0 rows affected (0.48 sec)
still working
集群环境 commit:0a99a7a5fc08c9927172bc34fd5089fe8538e4ea 系统租户向普通租户恢复数据 9w需要3min+
详细测试步骤,请联系我
still working
mysql> create snapshot sp01 for account sys;
Query OK, 0 rows affected (0.04 sec)
run tpcc test
mysql> restore account sys database tpcc_10 table bmsql_new_order from snapshot sp01;
mysql> insert into `bmsql_new_order_new` select * from `bmsql_new_order` {snapshot = 'sp01'};
Query OK, 90000 rows affected (0.34 sec)
mysql>
mysql> restore account sys database tpcc_10 table `bmsql_new_order` from snapshot sp01;
Query OK, 0 rows affected (1 min 47.18 sec)
和松哥沟通,挪到1.3.0进行解决
还在看
still
还在看
需要等这个https://github.com/matrixorigin/MO-Cloud/issues/3518 解决
mysql> select count(*) from bmsql_oorder;
+----------+
| count(*) |
+----------+
| 306280 |
+----------+
1 row in set (0.02 sec)
CREATE TABLE `bmsql_oorder_test` (
`o_w_id` INT NOT NULL,
`o_d_id` INT NOT NULL,
`o_id` INT NOT NULL,
`o_c_id` INT DEFAULT NULL,
`o_carrier_id` INT DEFAULT NULL,
`o_ol_cnt` INT DEFAULT NULL,
`o_all_local` INT DEFAULT NULL,
`o_entry_d` TIMESTAMP NULL DEFAULT NULL,
PRIMARY KEY (`o_w_id`,`o_d_id`,`o_id`)
);
mysql> insert into `bmsql_oorder_test` SELECT * FROM `tpcc_10`.`bmsql_oorder` {MO_TS = 1718781027351683000 };
Query OK, 306280 rows affected (3.49 sec)
但是 back execute
mysql> restore account sys database tpcc_10 table bmsql_oorder
from snapshot sp01;
Query OK, 0 rows affected (5 min 29.27 sec)
{"level":"INFO","time":"2024/06/19 15:27:20.624918 +0800","name":"log-service.frontend","caller":"frontend/snapshot.go:787","msg":"[sp01] insert select table: bmsql_oorder, insert sql: insert into tpcc_10
.bmsql_oorder
SELECT * FROM tpcc_10
.bmsql_oorder
{MO_TS = 1718781027351683000 }, cost: 5m28.657294416s","uuid":"7c4dccb4-4d3c-41f8-b482-5251dc7a41bf"}
@jensenojs 还是跟之前一样的问题
mysql> restore account sys database tpcc_10 table bmsql_oorder
from snapshot sp01;
Query OK, 0 rows affected (1 min 32.10 sec)
{"level":"INFO","time":"2024/06/19 16:23:54.340143 +0800","name":"log-service.frontend","caller":"frontend/snapshot.go:787","msg":"[sp01] insert select table: bmsql_oorder, cost: 1m31.718547458s","uuid":"7c4dccb4-4d3c-41f8-b482-5251dc7a41bf"}
还在看
mysql> restore account sys database tpcc_10 table bmsql_new_order from snapshot sp01; Query OK, 0 rows affected (6 min 13.66 sec)
{"level":"INFO","time":"2024/06/26 15:33:11.252127 +0800","name":"log-service.frontend","caller":"frontend/snapshot.go:787","msg":"[sp01] insert select table: bmsql_new_order, cost: 6m13.329385791s","uuid":"7c4dccb4-4d3c-41f8-b482-5251dc7a41bf"}
测试结果已经贴在pr中了,麻烦测试一下大数据量 @Ariznawlll
测试中
恢复测试,数据量大小为36.37G: 测试机器规模: https://github.com/matrixorigin/mo-nightly-regression/blob/big_data/big-data-tke.yaml
耗时:
测试记录
mysql> select git_version();
+---------------+
| git_version() |
+---------------+
| 5f72428 |
+---------------+
1 row in set (0.00 sec)
mysql> CREATE TABLE `table_basic_for_load_100m_new` (
-> `col1` TINYINT DEFAULT NULL,
-> `col2` SMALLINT DEFAULT NULL,
-> `col3` INT DEFAULT NULL,
-> `col4` BIGINT DEFAULT NULL,
-> `col5` TINYINT UNSIGNED DEFAULT NULL,
-> `col6` SMALLINT UNSIGNED DEFAULT NULL,
-> `col7` INT UNSIGNED DEFAULT NULL,
-> `col8` BIGINT UNSIGNED DEFAULT NULL,
-> `col9` FLOAT DEFAULT NULL,
-> `col10` DOUBLE DEFAULT NULL,
-> `col11` VARCHAR(255) DEFAULT NULL,
-> `col12` DATE DEFAULT NULL,
-> `col13` DATETIME DEFAULT NULL,
-> `col14` TIMESTAMP NULL DEFAULT NULL,
-> `col15` BOOL DEFAULT NULL,
-> `col16` DECIMAL(16,6) DEFAULT NULL,
-> `col17` TEXT DEFAULT NULL,
-> `col18` JSON DEFAULT NULL,
-> `col19` BLOB DEFAULT NULL,
-> `col20` BINARY(255) DEFAULT NULL,
-> `col21` VARBINARY(255) DEFAULT NULL,
-> `col22` VECF32(3) DEFAULT NULL,
-> `col23` VECF32(3) DEFAULT NULL,
-> `col24` VECF64(3) DEFAULT NULL,
-> `col25` VECF64(3) DEFAULT NULL
-> );
Query OK, 0 rows affected (0.12 sec)
mysql> select count(*) from `table_basic_for_load_100m`;
+-----------+
| count(*) |
+-----------+
| 100000000 |
+-----------+
1 row in set (17.02 sec)
mysql> insert into `table_basic_for_load_100m_new` select * from `table_basic_for_load_100m`;
Query OK, 100000000 rows affected (40.38 sec)
mysql> create snapshot dev_sp for account sys;
Query OK, 0 rows affected (0.20 sec)
mysql> restore account sys database big_data_test table `table_basic_for_load_100m` from snapshot dev_sp;
{"level":"INFO","time":"2024/07/01 05:27:43.074995 +0000","name":"cn-service.frontend","caller":"frontend/snapshot.go:845","msg":"[sp01] insert select table: table_basic_for_load_100m, cost: 2h34m4.986256277s","uuid":"34353333-6633-6262-3037-646336306538"}
从cpu的结果来看, gc占用的时间是绝对的大头.
看着这个行为似乎和下面这个issue观察到的一些现象相关, @YANGGMM 钊哥辛苦对比一下测试的commit和我在那个issue下观察到的一些值得关注的commit.
Is there an existing issue for the same bug?
Branch Name
main
Commit ID
4257dc620db76e22495241cab066cb807c092296
Other Environment Information
Actual Behavior
restore 一张 10亿数据量的表大约30min恢复了45539328(不到1/2).
Expected Behavior
No response
Steps to Reproduce
Additional information
No response