阿川 发表于 2024-2-4 20:22:51

版本:8.0.32-25

日志如下:

2024-02-04T19:54:59.582548+08:00 165043 Assertion failure: row0pread.cc:1350:is_queue_empty() thread 140267349989120
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/ ... nnodb-recovery.html
InnoDB: about forcing recovery.
2024-02-04T11:54:59Z UTC - mysqld got signal 6 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
BuildID=1a8a25a2dcba64e79241e5139fd32076a5d6459d

Build ID: 1a8a25a2dcba64e79241e5139fd32076a5d6459d
Server Version: 8.0.32-25 GreatSQL, Release 25, Revision db07cc5cb73

Thread pointer: 0x7f92a6254030
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f928991c9f0 thread_stack 0x80000
/data/mysql/bin/mysqld(my_print_stacktrace(unsigned char const*, unsigned long)+0x3d)
/data/mysql/bin/mysqld(print_fatal_signal(int)+0x3cf)
/data/mysql/bin/mysqld(my_server_abort()+0x7e)
/data/mysql/bin/mysqld(my_abort()+0xa)
/data/mysql/bin/mysqld(ut_dbg_assertion_failed(char const*, char const*, unsigned long)+0x31f)
/data/mysql/bin/mysqld(Parallel_reader::dispatch_ctx(row_prebuilt_t*)+0x405)
/data/mysql/bin/mysqld(ha_innobase::pq_worker_scan_next(void*, unsigned char*)+0x12b)
/data/mysql/bin/mysqld(handler::ha_pq_next(unsigned char*, void*)+0x270)
/data/mysql/bin/mysqld(PQblockScanIterator::Read()+0x25)
/data/mysql/bin/mysqld(FilterIterator::Read()+0x14)
/data/mysql/bin/mysqld(Query_expression::ExecuteIteratorQuery(THD*)+0x2ca)
/data/mysql/bin/mysqld(pq_worker_exec(void*)+0x90)
/data/mysql/bin/mysqld()
/lib64/libpthread.so.0(+0x7ea5)
/lib64/libc.so.6(clone+0x6d)

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f92b6ae2030): is an invalid pointer
Connection ID (thread ID): 165043
Status: NOT_KILLED

Please help us make Percona Server better by reporting any
bugs at https://bugs.percona.com/

You may download the Percona Server operations manual by visiting
http://www.percona.com/software/percona-server/. You may find information
in the manual which will help you identify the cause of the crash.

使用场景:
zabbix server数据库

配置文件:

#
# my.cnf example for GreatSQL
# last update, 2021/8/20
#
# 下面参数选项设置仅作为参考,且假设服务器可用内存为256G
#
#
#socket    = /data/GreatSQL/mysql.sock

loose-skip-binary-as-hex
prompt = "(\\D)[\\u@GreatSQL][\\d]>"
auto-rehash

log_error_verbosity = 2
transaction_isolation='read-committed'
secure_file_priv='null'
user    = mysql
port    = 3306
server_id = 3617
basedir = /data/mysql
datadir    = /data/mysql/data
socket    = /data/mysql/mysql.sock
pid-file = /data/mysql/mysql.pid
character-set-server = UTF8MB4
skip_name_resolve = 1
#若你的MySQL数据库主要运行在境外,请务必根据实际情况调整本参数
default_time_zone = "+8:00"
bind_address = "0.0.0.0"

#performance setttings
lock_wait_timeout = 3600
open_files_limit    = 65535
back_log = 1024
max_connections = 1024
max_connect_errors = 1000000
table_open_cache = 2048
table_definition_cache = 2048
thread_stack = 512K
sort_buffer_size = 4M
join_buffer_size = 4M
read_buffer_size = 8M
read_rnd_buffer_size = 4M
bulk_insert_buffer_size = 64M
thread_cache_size = 768
interactive_timeout = 600
wait_timeout = 600
tmp_table_size = 96M
max_heap_table_size = 96M
max_allowed_packet = 64M
net_buffer_shrink_interval = 180
#GIPK
loose-sql_generate_invisible_primary_key = ON
#log settings
log_timestamps = SYSTEM
log_error = /data/mysql/log/error.log
log_error_verbosity = 3
slow_query_log = 1
log_slow_extra = 1
slow_query_log_file = /data/mysql/log/slow.log
#设置slow log文件大小1G及总文件数10
max_slowlog_size = 1073741824
max_slowlog_files = 10
long_query_time = 1
log_queries_not_using_indexes = 0
log_throttle_queries_not_using_indexes = 60
min_examined_row_limit = 100
log_slow_admin_statements = 1
log_slow_replica_statements = 1
log_slow_verbosity = FULL
log_bin = /data/mysql/log/mysql-bin
binlog_format = ROW
sync_binlog = 1
binlog_cache_size = 4M
max_binlog_cache_size = 6G
max_binlog_size = 1G
#控制binlog总大小,避免磁盘空间被撑爆
binlog_space_limit = 100G
binlog_rows_query_log_events = 1
binlog_expire_logs_seconds = 604800
binlog_checksum = CRC32
gtid_mode = ON
enforce_gtid_consistency = TRUE
#myisam settings
key_buffer_size = 32M
myisam_sort_buffer_size = 128M
#replication settings
relay_log_recovery = 1
replica_parallel_type = LOGICAL_CLOCK
#并行复制线程数可以设置为逻辑CPU数量的2倍
replica_parallel_workers = 64
binlog_transaction_dependency_tracking = WRITESET
replica_preserve_commit_order = 1
replica_checkpoint_period = 2
#启用InnoDB并行查询优化功能
loose-force_parallel_execute = 1
#设置每个SQL语句的并行查询最大并发度
loose-parallel_default_dop = 8
#设置系统中总的并行查询线程数,可以和最大逻辑CPU数量一样
loose-parallel_max_threads = 64
#并行执行时leader线程和worker线程使用的总内存大小上限,可以设置物理内存的5-10%左右
loose-parallel_memory_limit = 12G
#parallel load data
loose-gdb_parallel_load_chunk_size = 4M
#mgr settings
#loose-plugin_load_add = 'mysql_clone.so'
#loose-plugin_load_add = 'group_replication.so'
#loose-group_replication_group_name = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa1"
##MGR本地节点IP:PORT,请自行替换
#loose-group_replication_local_address = "172.16.16.10:33061"
##MGR集群所有节点IP:PORT,请自行替换
#loose-group_replication_group_seeds = '172.16.16.10:33061,72.16.16.12:33061,72.16.16.12:33061'
#loose-group_replication_start_on_boot = ON
#loose-group_replication_bootstrap_group = OFF
#loose-group_replication_exit_state_action = READ_ONLY
#loose-group_replication_flow_control_mode = "DISABLED"
#loose-group_replication_single_primary_mode = ON
#loose-group_replication_enforce_update_everywhere_checks=0
#loose-group_replication_majority_after_mode = ON
#loose-group_replication_communication_max_message_size = 10M
#loose-group_replication_arbitrator = 0
#loose-group_replication_single_primary_fast_mode = 1
#loose-group_replication_request_time_threshold = 100
#loose-group_replication_primary_election_mode = GTID_FIRST
#loose-group_replication_unreachable_majority_timeout = 0
#loose-group_replication_member_expel_timeout = 5
#loose-group_replication_autorejoin_tries = 288
#loose-group_replication_recovery_get_public_key = ON
#mgr vip
#loose-plugin_load_add = 'greatdb_ha.so'
#loose-greatdb_ha_enable_mgr_vip = 0
#loose-greatdb_ha_mgr_vip_nic = 'eth0'
#loose-greatdb_ha_mgr_vip_ip = '172.16.0.252'
#loose-greatdb_ha_mgr_vip_mask = '255.255.255.0'
#loose-greatdb_ha_port = 33062
#loose-greatdb_ha_mgr_read_vip_ips = "172.16.0.251"
##loose-greatdb_ha_mgr_read_vip_ips = "172.16.0.251,172.16.0.252"
#loose-greatdb_ha_mgr_read_vip_floating_type = "TO_ANOTHER_SECONDARY"
#loose-greatdb_ha_send_arp_packge_times = 5
#report_host = 172.16.0.10
#report_port = 3306
#
##MGR切主后是否断开旧Priamry节点上的所有应用连接
#loose-greatdb_ha_mgr_exit_primary_kill_connection_mode = 0
#innodb settings
innodb_log_group_home_dir=/data/mysql/log
innodb_undo_directory=/data/mysql/log
innodb_buffer_pool_size = 1G
innodb_buffer_pool_instances = 8
innodb_data_file_path = ibdata1:12M:autoextend
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 32M
innodb_redo_log_capacity = 16G
innodb_doublewrite_files = 2
innodb_max_undo_log_size = 16G
# 根据您的服务器IOPS能力适当调整
# 一般配普通SSD盘的话,可以调整到 10000 - 20000
# 配置高端PCIe SSD卡的话,则可以调整的更高,比如 50000 - 80000
innodb_io_capacity = 10000
innodb_io_capacity_max = 10000
innodb_open_files = 65534
#提醒:当需要用CLONE加密特性时,不要选用O_DIRECT模式,否则会比较慢
innodb_flush_method = O_DIRECT_NO_FSYNC
innodb_lru_scan_depth = 1000
innodb_lock_wait_timeout = 10
innodb_rollback_on_timeout = 1
innodb_print_all_deadlocks = 1
innodb_online_alter_log_max_size = 4G
innodb_print_ddl_logs = 1
innodb_status_file = 1
innodb_status_output = 0
innodb_status_output_locks = 1
innodb_sort_buffer_size = 64M
innodb_adaptive_hash_index = 0
#开启NUMA支持
innodb_numa_interleave = ON
innodb_print_lock_wait_timeout_info = 1
#自动杀掉超过5分钟不活跃事务,避免行锁被长时间持有
kill_idle_transaction = 300
#异步清理大表
innodb_data_file_async_purge = ON
#innodb monitor settings
#innodb_monitor_enable = "module_innodb,module_server,module_dml,module_ddl,module_trx,module_os,module_purge,module_log,module_lock,module_buffer,module_index,module_ibuf_system,module_buffer_page,module_adaptive_hash"
#pfs settings
performance_schema = 1
#performance_schema_instrument = '%memory%=on'
performance_schema_instrument = '%lock%=on'
plugin-load=audit_log=audit_log.so
audit_log_to_table=1
audit_log_file='/data/mysql/log/audit.log'


单机数据库,故障发生时,只有zabbix在连接数据库


yejr 发表于 2024-2-4 20:32:42

请修改下面配置,关闭innodb pq特性
```
#启用InnoDB并行查询优化功能
loose-force_parallel_execute = 0
```
innodb pq个别情况下存在bug,默认不建议使用,可以考虑我们今天新发布的AP引擎 https://greatsql.cn/thread-622-1-1.html

阿川 发表于 2024-2-4 20:38:29

yejr 发表于 2024-2-4 20:32
请修改下面配置,关闭innodb pq特性
```
#启用InnoDB并行查询优化功能


感谢叶老师 我去学习下

yejr 发表于 2024-2-4 21:17:41

阿川 发表于 2024-2-4 20:38
感谢叶老师 我去学习下

不好意思,前面回复错了,是要设置 loose-force_parallel_execute = 0,原来写成1。

阿川 发表于 2024-2-6 10:26:00

yejr 发表于 2024-2-4 21:17
不好意思,前面回复错了,是要设置 loose-force_parallel_execute = 0,原来写成1。 ...

好的 我试试ap引擎的版本
页: [1]
查看完整版本: 版本:8.0.32-25