尽量服用,和优化采样区块,交易所在区块的资源参数 获取不需要每次获取有下单租赁订单都获取一遍,应该是全局异步获取是不是就可以,帮我设计合理方案。 和清理逻辑
This commit is contained in:
1 parent
13665668ac
commit
1538cd0819
24 files changed
+1894
-230
No files matched your search
@@ -0,0 +1,29 @@
|
||||
-- 已安装历史表的环境先执行本增量脚本,再部署清理器。MySQL 5.7+/8.0,可重复执行。
|
||||
-- 只增加历史清理租约字段及基线清理索引,不删数据、不修改订单及资金表。
|
||||
SET @rent_history_cleanup_sql = IF(
|
||||
EXISTS(SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE()
|
||||
AND TABLE_NAME='rent_history_cursor' AND COLUMN_NAME='cleanup_owner'),
|
||||
'SELECT 1',
|
||||
'ALTER TABLE rent_history_cursor ADD COLUMN cleanup_owner VARCHAR(64) NULL COMMENT ''清理器独立网络租约''');
|
||||
PREPARE rent_history_cleanup_stmt FROM @rent_history_cleanup_sql;
|
||||
EXECUTE rent_history_cleanup_stmt;
|
||||
DEALLOCATE PREPARE rent_history_cleanup_stmt;
|
||||
|
||||
-- 按网络/高度分批选择旧检查点,避免清理每批都排序整个地址对基线表。
|
||||
SET @rent_history_cleanup_sql = IF(
|
||||
EXISTS(SELECT 1 FROM information_schema.STATISTICS WHERE TABLE_SCHEMA=DATABASE()
|
||||
AND TABLE_NAME='rent_history_anchor' AND INDEX_NAME='idx_history_anchor_retention'),
|
||||
'SELECT 1',
|
||||
'ALTER TABLE rent_history_anchor ADD INDEX idx_history_anchor_retention (network,block_height)');
|
||||
PREPARE rent_history_cleanup_stmt FROM @rent_history_cleanup_sql;
|
||||
EXECUTE rent_history_cleanup_stmt;
|
||||
DEALLOCATE PREPARE rent_history_cleanup_stmt;
|
||||
|
||||
SET @rent_history_cleanup_sql = IF(
|
||||
EXISTS(SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE()
|
||||
AND TABLE_NAME='rent_history_cursor' AND COLUMN_NAME='cleanup_until'),
|
||||
'SELECT 1',
|
||||
'ALTER TABLE rent_history_cursor ADD COLUMN cleanup_until DATETIME(3) NULL COMMENT ''清理租约UTC截止''');
|
||||
PREPARE rent_history_cleanup_stmt FROM @rent_history_cleanup_sql;
|
||||
EXECUTE rent_history_cleanup_stmt;
|
||||
DEALLOCATE PREPARE rent_history_cleanup_stmt;
|
||||
Reference in new issue
Block a user