Mysql corruption on MacBook Pro - mysql

The last few days I am experiencing constant MySQL crashes looks like the database corrupts and then MySQL constantly restarts but is unable to be stable. I have checked the disk but looks ok. I would need some advice on how to read this error and what to check?
in the error log, I have found this error
2019-05-22T13:29:28.226689Z 0 [System] [MY-010116] [Server] /usr/local/opt/mysql/bin/mysqld (mysqld 8.0.16) starting as process 88218
2019-05-22T13:29:28.232672Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-05-22T13:29:28.326779Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
2019-05-22T13:29:29.326903Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
2019-05-22T13:29:30.401687Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
2019-05-22T13:29:31.475526Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
2019-05-22T13:29:32.545354Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
2019-05-22T13:29:33.637548Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
2019-05-22T13:29:33.637575Z 1 [ERROR] [MY-013183] [InnoDB] Assertion failure: fil0fil.cc:2509:success thread 123145356632064
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/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
13:29:33 UTC - mysqld got signal 6 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
Thread pointer: 0x7fabcb081400
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 = 7000033cdea0 thread_stack 0x46000
0 mysqld 0x000000010b9d7443 my_print_stacktrace(unsigned char*, unsigned long) + 60
1 mysqld 0x000000010b0a98d6 handle_fatal_signal + 438
2 libsystem_platform.dylib 0x00007fff6d9b6b5d _sigtramp + 29
3 ??? 0x000000010ff19b76 0x0 + 4562459510
4 libsystem_c.dylib 0x00007fff6d8706a6 abort + 127
5 mysqld 0x000000010bccabdc ut_dbg_assertion_failed(char const*, char const*, unsigned long) + 332
6 mysqld 0x000000010bb1ba53 Fil_shard::open_file(fil_node_t*, bool) + 791
7 mysqld 0x000000010bb1d79d Fil_shard::open_system_tablespaces(unsigned long, unsigned long*) + 159
8 mysqld 0x000000010bb1d86d Fil_system::open_all_system_tablespaces() + 57
9 mysqld 0x000000010bc951a6 srv_start(bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 3002
10 mysqld 0x000000010bb9180d innobase_ddse_dict_init(dict_init_mode_t, unsigned int, List<dd::Object_table const>*, List<Plugin_tablespace const>*) + 451
11 mysqld 0x000000010b89cdba dd::bootstrap::DDSE_dict_init(THD*, dict_init_mode_t, unsigned int) + 108
12 mysqld 0x000000010b9bdbae dd::upgrade_57::do_pre_checks_and_initialize_dd(THD*) + 1805
13 mysqld 0x000000010ad5e92a bootstrap::handle_bootstrap(void*) + 185
14 mysqld 0x000000010bd1eea0 pfs_spawn_thread(void*) + 320
15 libsystem_pthread.dylib 0x00007fff6d9bf2eb _pthread_body + 126
16 libsystem_pthread.dylib 0x00007fff6d9c2249 _pthread_start + 66
17 libsystem_pthread.dylib 0x00007fff6d9be40d thread_start + 13
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0):
Connection ID (thread ID): 1
Status: NOT_KILLED

I've gotten multiple (5+) MySQL 8 non-recoverable innodb crashes on three different computers (two macbook pros, 1 iMac) on macOS over the last year.
Most recently today:
2021-06-21T13:12:44.863980Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.25_1/bin/mysqld (mysqld 8.0.25) starting as process 46771
2021-06-21T13:12:44.866651Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2021-06-21T13:12:44.909851Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-06-21T13:12:44.992890Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-06-21T13:12:45.069896Z 1 [ERROR] [MY-013183] [InnoDB] Assertion failure: dict0dict.cc:3343:for_table || ref_table thread 0x7000063a7000
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/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
13:12:45 UTC - mysqld got signal 6 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
Thread pointer: 0x7fa8b0023c00
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 = 7000063a6f50 thread_stack 0x46000
0 mysqld 0x0000000101d5a9fe my_print_stacktrace(unsigned char const*, unsigned long) + 60
1 mysqld 0x0000000101365a34 handle_fatal_signal + 434
2 libsystem_platform.dylib 0x00007fff2052dd7d _sigtramp + 29
3 ??? 0x0000000000004cba 0x0 + 19642
4 libsystem_c.dylib 0x00007fff2043d411 abort + 120
5 mysqld 0x0000000102013b34 ut_dbg_assertion_failed(char const*, char const*, unsigned long) + 394
6 mysqld 0x0000000101dfdc15 dict_foreign_add_to_cache(dict_foreign_t*, char const**, bool, bool, dict_err_ignore_t) + 1159
7 mysqld 0x0000000101e0de73 dd_table_load_fk_from_dd(dict_table_t*, dd::Table const*, char const**, dict_err_ignore_t, bool) + 1630
8 mysqld 0x0000000101e0dfeb dd_table_load_fk(dd::cache::Dictionary_client*, char const*, char const**, dict_table_t*, dd::Table const*, THD*, bool, bool, std::__1::deque<char const*, ut_allocator<char const*> >*) + 75
9 mysqld 0x0000000101e12074 dict_table_t* dd_open_table_one<dd::Table>(dd::cache::Dictionary_client*, TABLE const*, char const*, dd::Table const*, THD*, std::__1::deque<char const*, ut_allocator<char const*> >&) + 6405
10 mysqld 0x0000000101e066aa dict_table_t* dd_open_table<dd::Table>(dd::cache::Dictionary_client*, TABLE const*, char const*, dd::Table const*, THD*) + 60
11 mysqld 0x0000000101e064dd dd_table_open_on_dd_obj(THD*, dd::cache::Dictionary_client*, dd::Table const&, dd::Partition const*, char const*, dict_table_t*&, TABLE const*) + 1397
12 mysqld 0x0000000101e072e2 dd_table_open_on_id_low(THD*, MDL_ticket**, unsigned long long) + 1246
13 mysqld 0x0000000101e06c29 dd_table_open_on_id(unsigned long long, THD*, MDL_ticket**, bool, bool) + 1335
14 mysqld 0x0000000101f392c5 MetadataRecover::apply() + 69
15 mysqld 0x0000000101fdc2e8 srv_dict_recover_on_restart() + 144
16 mysqld 0x0000000101eb7bae innobase_dict_recover(dict_recovery_mode_t, unsigned int) + 1506
17 mysqld 0x0000000101c0fec4 dd::bootstrap::restart(THD*) + 248
18 mysqld 0x0000000101d425a4 dd::upgrade_57::restart_dictionary(THD*) + 76
19 mysqld 0x0000000101d40e4d dd::upgrade_57::do_pre_checks_and_initialize_dd(THD*) + 1334
20 mysqld 0x0000000100fb11f0 bootstrap::handle_bootstrap(void*) + 225
21 mysqld 0x00000001020783ca pfs_spawn_thread(void*) + 290
22 libsystem_pthread.dylib 0x00007fff204e88fc _pthread_start + 224
23 libsystem_pthread.dylib 0x00007fff204e4443 thread_start + 15
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0):
Connection ID (thread ID): 1
Status: NOT_KILLED
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
2021-06-21T13:12:45.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/samaritan.pid ended
stnor#samaritan mysql %

Related

Mysql used all memory

Summary:
My MySql after a few days of operation consumes all memory and crash by
Software versions:
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
Linux 4.15.0-147-generic
Server version: 8.0.24 MySQL Community Server
Apr 30 11:37:27 mysql8 kernel: [1101229.680225] Out of memory: Kill process 114869 (mysqld) score 966 or sacrifice child
Apr 30 11:37:27 mysql8 kernel: [1101229.680672] Killed process 114869 (mysqld) total-vm:42088196kB, anon-rss:31660624kB, file-rss:0kB, shmem-rss:0kB
Apr 30 11:37:29 mysql8 kernel: [1101232.305965] oom_reaper: reaped process 114869 (mysqld), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
The values are set so that Max MySQL memory is 11.3G. Total buffers: 6.0G global + 33.9M per thread (160 max threads). The server has 32GB RAM and only runs MySql
root#mysql8:~# ./mysqltuner.pl
>> MySQLTuner 1.8.1 - Major Hayden <major#mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.pl/
>> Run with '--help' for additional options and output filtering
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 8.0.24
[OK] Operating on 64-bit architecture
-------- Log file Recommendations ------------------------------------------------------------------
[OK] Log file /var/log/mysql/error.log exists
[--] Log file: /var/log/mysql/error.log(37K)
[OK] Log file /var/log/mysql/error.log is not empty
[OK] Log file /var/log/mysql/error.log is smaller than 32 Mb
[OK] Log file /var/log/mysql/error.log is readable.
[!!] /var/log/mysql/error.log contains 198 warning(s).
[!!] /var/log/mysql/error.log contains 2 error(s).
[--] 14 start(s) detected in /var/log/mysql/error.log
[--] 1) 2021-07-21T06:15:50.156309Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.24' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
[--] 2) 2021-07-21T06:15:45.194534Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
[--] 3) 2021-07-18T16:23:42.158755Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.24' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
[--] 4) 2021-07-18T16:23:40.462353Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
[--] 5) 2021-07-14T10:15:57.572447Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.24' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
[--] 6) 2021-07-14T10:15:53.448147Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
[--] 7) 2021-07-08T08:20:48.094250Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.24' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
[--] 8) 2021-07-08T08:20:45.563321Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
[--] 9) 2021-07-04T08:48:13.422691Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.24' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
[--] 10) 2021-07-04T08:48:12.547357Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
[--] 8 shutdown(s) detected in /var/log/mysql/error.log
[--] 1) 2021-07-21T06:15:32.931850Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.24) MySQL Community Server - GPL.
[--] 2) 2021-07-18T16:23:31.840652Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.24) MySQL Community Server - GPL.
[--] 3) 2021-07-14T10:15:42.415773Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.24) MySQL Community Server - GPL.
[--] 4) 2021-07-08T08:20:35.530622Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.24) MySQL Community Server - GPL.
[--] 5) 2021-07-04T08:46:53.335155Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.24) MySQL Community Server - GPL.
[--] 6) 2021-07-04T08:45:28.582107Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.24) MySQL Community Server - GPL.
[--] 7) 2021-07-04T08:36:07.392398Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.24) MySQL Community Server - GPL.
[--] 8) 2021-07-04T08:34:09.116853Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.24) MySQL Community Server - GPL.
-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MEMORY +MRG_MYISAM +MyISAM +PERFORMANCE_SCHEMA
[--] Data in InnoDB tables: 11.7G (Tables: 703)
[--] Data in MyISAM tables: 316.2M (Tables: 5)
[!!] Total fragmented tables: 2
-------- Analysis Performance Metrics --------------------------------------------------------------
[--] innodb_stats_on_metadata: OFF
[OK] No stat updates during querying INFORMATION_SCHEMA.
-------- Security Recommendations ------------------------------------------------------------------
[--] Skipped due to unsupported feature for MySQL 8
-------- CVE Security Recommendations --------------------------------------------------------------
[--] Skipped due to --cvefile option undefined
-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 1h 48m 50s (1M q [223.509 qps], 2K conn, TX: 5G, RX: 1G)
[--] Reads / Writes: 98% / 2%
[--] Binary logging is enabled (GTID MODE: OFF)
[--] Physical Memory : 31.4G
[--] Max MySQL memory : 11.3G
[--] Other process memory: 0B
[--] Total buffers: 6.0G global + 33.9M per thread (160 max threads)
[--] P_S Max memory usage: 72B
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 7.5G (23.99% of installed RAM)
[OK] Maximum possible memory usage: 11.3G (36.12% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 3% (48K/1M)
[OK] Highest usage of available connections: 28% (45/160)
[OK] Aborted connections: 1.51% (42/2784)
[--] Query cache have been removed in MySQL 8
[OK] Sorts requiring temporary tables: 0% (104 temp sorts / 39K sorts)
[!!] Joins performed without indexes: 13143
[OK] Temporary tables created on disk: 0% (131 on disk / 391K total)
[OK] Thread cache hit rate: 98% (45 created / 2K connections)
[OK] Table cache hit rate: 91% (1M hits / 2M requests)
[OK] table_definition_cache(2000) is upper than number of tables(1438)
[OK] Open file limit used: 0% (26/10K)
[OK] Table locks acquired immediately: 100% (2K immediate / 2K locks)
[OK] Binlog cache memory access: 98.35% (5712 Memory / 5808 Total)
-------- Performance schema ------------------------------------------------------------------------
[--] Memory used by P_S: 72B
[--] Sys schema is installed.
-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is disabled.
-------- MyISAM Metrics ----------------------------------------------------------------------------
[--] MyISAM Metrics are disabled on last MySQL versions.
-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[!!] InnoDB buffer pool / data size: 6.0G/11.7G
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (16.6666666666667 %): 512.0M * 2/6.0G should be equal to 25%
[!!] InnoDB buffer pool instances: 4
[--] Number of InnoDB Buffer Pool Chunk : 48 for 4 Buffer Pool Instance(s)
[OK] Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
[OK] InnoDB Read buffer efficiency: 99.93% (290050740 hits/ 290262620 total)
[!!] InnoDB Write Log efficiency: 77.21% (157671 hits/ 204214 total)
[OK] InnoDB log waits: 0.00% (0 waits / 46543 writes)
-------- Aria Metrics ------------------------------------------------------------------------------
[--] Aria Storage Engine not available.
-------- TokuDB Metrics ----------------------------------------------------------------------------
[--] TokuDB is disabled.
-------- XtraDB Metrics ----------------------------------------------------------------------------
[--] XtraDB is disabled.
-------- Galera Metrics ----------------------------------------------------------------------------
[--] Galera is disabled.
-------- Replication Metrics -----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] No replication slave(s) for this server.
[--] Binlog format: ROW
[--] XA support enabled: ON
[--] Semi synchronous replication Master: Not Activated
[--] Semi synchronous replication Slave: Not Activated
[--] This is a standalone server
UPDATE:
This is valuve when mysql used 22GB ram what is two time mor then max MySQL memory with value 11GB.
HTOP SCREEN
SHOW GLOBAL STATUS;
Aborted_clients 165
Aborted_connects 42
Acl_cache_items_count 0
Binlog_cache_disk_use 616
Binlog_cache_use 96991
Binlog_stmt_cache_disk_use 0
Binlog_stmt_cache_use 3268
Bytes_received 6045922316
Bytes_sent 54971094700
Caching_sha2_password_rsa_public_key -----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0efP6d9Ql944lyxK92xc
AzZShd/wqacl5NWnwc8eFCmxagEg9iCexoxVJBHQUQrVDZpTuD80/2NEgzrqbf6n
bVVOB2mVm58NPARTmXC0dJsuaTzBke0KHeNYbrgFr9DoE0IP4Lg2E9c6HQKvSAn9
LHQ25q+I5Kf+uNlID9RZ+AIvE3UrbeOx...
Com_admin_commands 542
Com_assign_to_keycache 0
Com_alter_db 0
Com_alter_event 0
Com_alter_function 0
Com_alter_instance 0
Com_alter_procedure 0
Com_alter_resource_group 0
Com_alter_server 0
Com_alter_table 0
Com_alter_tablespace 0
Com_alter_user 3
Com_alter_user_default_role 0
Com_analyze 0
Com_begin 64
Com_binlog 0
Com_call_procedure 33885
Com_change_db 1611
Com_change_master 0
Com_change_repl_filter 0
Com_change_replication_source 0
Com_check 0
Com_checksum 0
Com_clone 0
Com_commit 17883
Com_create_db 1
Com_create_event 0
Com_create_function 0
Com_create_index 0
Com_create_procedure 0
Com_create_role 0
Com_create_server 0
Com_create_table 58
Com_create_resource_group 0
Com_create_trigger 0
Com_create_udf 0
Com_create_user 1
Com_create_view 0
Com_create_spatial_reference_system 0
Com_dealloc_sql 49
Com_delete 3940
Com_delete_multi 0
Com_do 0
Com_drop_db 0
Com_drop_event 0
Com_drop_function 0
Com_drop_index 0
Com_drop_procedure 0
Com_drop_resource_group 0
Com_drop_role 0
Com_drop_server 0
Com_drop_spatial_reference_system 0
Com_drop_table 16
Com_drop_trigger 0
Com_drop_user 0
Com_drop_view 0
Com_empty_query 0
Com_execute_sql 49
Com_explain_other 0
Com_flush 39
Com_get_diagnostics 0
Com_grant 7
Com_grant_roles 0
Com_ha_close 0
Com_ha_open 0
Com_ha_read 0
Com_help 0
Com_import 0
Com_insert 57210
Com_insert_select 344
Com_install_component 0
Com_install_plugin 0
Com_kill 0
Com_load 0
Com_lock_instance 0
Com_lock_tables 0
Com_optimize 4
Com_preload_keys 0
Com_prepare_sql 49
Com_purge 0
Com_purge_before_date 0
Com_release_savepoint 9
Com_rename_table 0
Com_rename_user 0
Com_repair 0
Com_replace 1
Com_replace_select 0
Com_reset 0
Com_resignal 0
Com_restart 0
Com_revoke 1
Com_revoke_all 3
Com_revoke_roles 0
Com_rollback 140
Com_rollback_to_savepoint 1151
Com_savepoint 9
Com_select 11814459
Com_set_option 58098
Com_set_password 0
Com_set_resource_group 0
Com_set_role 0
Com_signal 0
Com_show_binlog_events 1
Com_show_binlogs 4
Com_show_charsets 8
Com_show_collations 226
Com_show_create_db 0
Com_show_create_event 0
Com_show_create_func 32
Com_show_create_proc 46
Com_show_create_table 2141
Com_show_create_trigger 80
Com_show_databases 35
Com_show_engine_logs 0
Com_show_engine_mutex 0
Com_show_engine_status 18
Com_show_events 0
Com_show_errors 0
Com_show_fields 11515
Com_show_function_code 0
Com_show_function_status 10
Com_show_grants 17
Com_show_keys 2
Com_show_master_status 209
Com_show_open_tables 0
Com_show_plugins 1
Com_show_privileges 0
Com_show_procedure_code 0
Com_show_procedure_status 10
Com_show_processlist 70
Com_show_profile 0
Com_show_profiles 0
Com_show_relaylog_events 0
Com_show_replicas 4
Com_show_slave_hosts 4
Com_show_replica_status 3274
Com_show_slave_status 3274
Com_show_status 5865
Com_show_storage_engines 4
Com_show_table_status 1186
Com_show_tables 36
Com_show_triggers 1151
Com_show_variables 3310
Com_show_warnings 295
Com_show_create_user 0
Com_shutdown 0
Com_replica_start 0
Com_slave_start 0
Com_replica_stop 0
Com_slave_stop 0
Com_group_replication_start 0
Com_group_replication_stop 0
Com_stmt_execute 49
Com_stmt_close 49
Com_stmt_fetch 0
Com_stmt_prepare 49
Com_stmt_reset 0
Com_stmt_send_long_data 0
Com_truncate 49
Com_uninstall_component 0
Com_uninstall_plugin 0
Com_unlock_instance 0
Com_unlock_tables 18
Com_update 288371
Com_update_multi 5420
Com_xa_commit 0
Com_xa_end 0
Com_xa_prepare 0
Com_xa_recover 0
Com_xa_rollback 0
Com_xa_start 0
Com_stmt_reprepare 0
Connection_errors_accept 0
Connection_errors_internal 0
Connection_errors_max_connections 0
Connection_errors_peer_address 0
Connection_errors_select 0
Connection_errors_tcpwrap 0
Connections 24598
Created_tmp_disk_tables 2673
Created_tmp_files 29073
Created_tmp_tables 2048824
Current_tls_ca ca.pem
Current_tls_capath
Current_tls_cert server-cert.pem
Current_tls_cipher
Current_tls_ciphersuites
Current_tls_crl
Current_tls_crlpath
Current_tls_key server-key.pem
Current_tls_version TLSv1,TLSv1.1,TLSv1.2,TLSv1.3
Delayed_errors 0
Delayed_insert_threads 0
Delayed_writes 0
Error_log_buffered_bytes 38560
Error_log_buffered_events 260
Error_log_expired_events 0
Error_log_latest_write 1626853689371451
Flush_commands 30
Handler_commit 7536527
Handler_delete 2836
Handler_discover 0
Handler_external_lock 24442935
Handler_mrr_init 0
Handler_prepare 358992
Handler_read_first 535985
Handler_read_key 348441108
Handler_read_last 344
Handler_read_next 788469182
Handler_read_prev 444
Handler_read_rnd 971184
Handler_read_rnd_next 7247264904
Handler_rollback 193
Handler_savepoint 9
Handler_savepoint_rollback 1151
Handler_update 52418514
Handler_write 66418155
Innodb_buffer_pool_dump_status Dumping of buffer pool not started
Innodb_buffer_pool_load_status Buffer pool(s) load completed at 210721 8:16:59
Innodb_buffer_pool_resize_status
Innodb_buffer_pool_pages_data 380821
Innodb_buffer_pool_bytes_data 6239371264
Innodb_buffer_pool_pages_dirty 1
Innodb_buffer_pool_bytes_dirty 16384
Innodb_buffer_pool_pages_flushed 580378
Innodb_buffer_pool_pages_free 4096
Innodb_buffer_pool_pages_misc 8299
Innodb_buffer_pool_pages_total 393216
Innodb_buffer_pool_read_ahead_rnd 0
Innodb_buffer_pool_read_ahead 787663
Innodb_buffer_pool_read_ahead_evicted 992
Innodb_buffer_pool_read_requests 1976082938
Innodb_buffer_pool_reads 442288
Innodb_buffer_pool_wait_free 0
Innodb_buffer_pool_write_requests 2717746
Innodb_data_fsyncs 972858
Innodb_data_pending_fsyncs 18446744073709551544
Innodb_data_pending_reads 0
Innodb_data_pending_writes 0
Innodb_data_read 20465718272
Innodb_data_reads 1250550
Innodb_data_writes 1372515
Innodb_data_written 10448172544
Innodb_dblwr_pages_written 572434
Innodb_dblwr_writes 226408
Innodb_log_waits 0
Innodb_log_write_requests 1899344
Innodb_log_writes 510148
Innodb_os_log_fsyncs 358717
Innodb_os_log_pending_fsyncs 0
Innodb_os_log_pending_writes 0
Innodb_os_log_written 460218880
Innodb_page_size 16384
Innodb_pages_created 37059
Innodb_pages_read 1249125
Innodb_pages_written 601303
Innodb_redo_log_enabled ON
Innodb_row_lock_current_waits 0
Innodb_row_lock_time 433555
Innodb_row_lock_time_avg 6470
Innodb_row_lock_time_max 51007
Innodb_row_lock_waits 67
Innodb_rows_deleted 1474
Innodb_rows_inserted 285549
Innodb_rows_read 8210896171
Innodb_rows_updated 175486
Innodb_system_rows_deleted 1477
Innodb_system_rows_inserted 1559
Innodb_system_rows_read 5671360
Innodb_system_rows_updated 2405
Innodb_sampled_pages_read 0
Innodb_sampled_pages_skipped 0
Innodb_num_open_files 719
Innodb_truncated_status_writes 0
Innodb_undo_tablespaces_total 2
Innodb_undo_tablespaces_implicit 2
Innodb_undo_tablespaces_explicit 0
Innodb_undo_tablespaces_active 2
Key_blocks_not_flushed 0
Key_blocks_unused 6630
Key_blocks_used 151
Key_read_requests 40732
Key_reads 1382
Key_write_requests 11584
Key_writes 11584
Locked_connects 0
Max_execution_time_exceeded 0
Max_execution_time_set 0
Max_execution_time_set_failed 0
Max_used_connections 51
Max_used_connections_time 2021-07-22 11:05:05
Mysqlx_aborted_clients 0
Mysqlx_address ::
Mysqlx_bytes_received 0
Mysqlx_bytes_received_compressed_payload 0
Mysqlx_bytes_received_uncompressed_frame 0
Mysqlx_bytes_sent 0
Mysqlx_bytes_sent_compressed_payload 0
Mysqlx_bytes_sent_uncompressed_frame 0
Mysqlx_compression_algorithm
Mysqlx_compression_level
Mysqlx_connection_accept_errors 0
Mysqlx_connection_errors 0
Mysqlx_connections_accepted 0
Mysqlx_connections_closed 0
Mysqlx_connections_rejected 0
Mysqlx_crud_create_view 0
Mysqlx_crud_delete 0
Mysqlx_crud_drop_view 0
Mysqlx_crud_find 0
Mysqlx_crud_insert 0
Mysqlx_crud_modify_view 0
Mysqlx_crud_update 0
Mysqlx_cursor_close 0
Mysqlx_cursor_fetch 0
Mysqlx_cursor_open 0
Mysqlx_errors_sent 0
Mysqlx_errors_unknown_message_type 0
Mysqlx_expect_close 0
Mysqlx_expect_open 0
Mysqlx_init_error 0
Mysqlx_messages_sent 0
Mysqlx_notice_global_sent 0
Mysqlx_notice_other_sent 0
Mysqlx_notice_warning_sent 0
Mysqlx_notified_by_group_replication 0
Mysqlx_port 33060
Mysqlx_prep_deallocate 0
Mysqlx_prep_execute 0
Mysqlx_prep_prepare 0
Mysqlx_rows_sent 0
Mysqlx_sessions 0
Mysqlx_sessions_accepted 0
Mysqlx_sessions_closed 0
Mysqlx_sessions_fatal_error 0
Mysqlx_sessions_killed 0
Mysqlx_sessions_rejected 0
Mysqlx_socket /var/run/mysqld/mysqlx.sock
Mysqlx_ssl_accepts 0
Mysqlx_ssl_active
Mysqlx_ssl_cipher
Mysqlx_ssl_cipher_list
Mysqlx_ssl_ctx_verify_depth 18446744073709551615
Mysqlx_ssl_ctx_verify_mode 5
Mysqlx_ssl_finished_accepts 0
Mysqlx_ssl_server_not_after Mar 15 11:06:01 2029 GMT
Mysqlx_ssl_server_not_before Mar 18 11:06:01 2019 GMT
Mysqlx_ssl_verify_depth
Mysqlx_ssl_verify_mode
Mysqlx_ssl_version
Mysqlx_stmt_create_collection 0
Mysqlx_stmt_create_collection_index 0
Mysqlx_stmt_disable_notices 0
Mysqlx_stmt_drop_collection 0
Mysqlx_stmt_drop_collection_index 0
Mysqlx_stmt_enable_notices 0
Mysqlx_stmt_ensure_collection 0
Mysqlx_stmt_execute_mysqlx 0
Mysqlx_stmt_execute_sql 0
Mysqlx_stmt_execute_xplugin 0
Mysqlx_stmt_get_collection_options 0
Mysqlx_stmt_kill_client 0
Mysqlx_stmt_list_clients 0
Mysqlx_stmt_list_notices 0
Mysqlx_stmt_list_objects 0
Mysqlx_stmt_modify_collection_options 0
Mysqlx_stmt_ping 0
Mysqlx_worker_threads 2
Mysqlx_worker_threads_active 0
Not_flushed_delayed_rows 0
Ongoing_anonymous_transaction_count 0
Open_files 29
Open_streams 0
Open_table_definitions 404
Open_tables 2372
Opened_files 29
Opened_table_definitions 3101
Opened_tables 726449
Performance_schema_accounts_lost 0
Performance_schema_cond_classes_lost 0
Performance_schema_cond_instances_lost 0
Performance_schema_digest_lost 0
Performance_schema_file_classes_lost 0
Performance_schema_file_handles_lost 0
Performance_schema_file_instances_lost 0
Performance_schema_hosts_lost 0
Performance_schema_index_stat_lost 0
Performance_schema_locker_lost 0
Performance_schema_memory_classes_lost 0
Performance_schema_metadata_lock_lost 0
Performance_schema_mutex_classes_lost 0
Performance_schema_mutex_instances_lost 0
Performance_schema_nested_statement_lost 0
Performance_schema_prepared_statements_lost 0
Performance_schema_program_lost 0
Performance_schema_rwlock_classes_lost 0
Performance_schema_rwlock_instances_lost 0
Performance_schema_session_connect_attrs_longest_seen 243
Performance_schema_session_connect_attrs_lost 0
Performance_schema_socket_classes_lost 0
Performance_schema_socket_instances_lost 0
Performance_schema_stage_classes_lost 0
Performance_schema_statement_classes_lost 0
Performance_schema_table_handles_lost 0
Performance_schema_table_instances_lost 0
Performance_schema_table_lock_stat_lost 0
Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
Prepared_stmt_count 0
Queries 50237431
Questions 7738327
Rsa_public_key -----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0efP6d9Ql944lyxK92xc
AzZShd/wqacl5NWnwc8eFCmxagEg9iCexoxVJBHQUQrVDZpTuD80/2NEgzrqbf6n
bVVOB2mVm58NPARTmXC0dJsuaTzBke0KHeNYbrgFr9DoE0IP4Lg2E9c6HQKvSAn9
LHQ25q+I5Kf+uNlID9RZ+AIvE3UrbeOx...
Secondary_engine_execution_count 0
Select_full_join 82036
Select_full_range_join 33
Select_range 641808
Select_range_check 8
Select_scan 517840
Slave_open_temp_tables 0
Slow_launch_threads 0
Slow_queries 305397
Sort_merge_passes 647
Sort_range 0
Sort_rows 4350778
Sort_scan 199238
Ssl_accept_renegotiates 0
Ssl_accepts 2016
Ssl_callback_cache_hits 0
Ssl_cipher TLS_AES_256_GCM_SHA384
Ssl_cipher_list TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-A...
Ssl_client_connects 0
Ssl_connect_renegotiates 0
Ssl_ctx_verify_depth 18446744073709551615
Ssl_ctx_verify_mode 5
Ssl_default_timeout 7200
Ssl_finished_accepts 2016
Ssl_finished_connects 0
Ssl_server_not_after Mar 15 11:06:01 2029 GMT
Ssl_server_not_before Mar 18 11:06:01 2019 GMT
Ssl_session_cache_hits 0
Ssl_session_cache_misses 0
Ssl_session_cache_mode SERVER
Ssl_session_cache_overflows 0
Ssl_session_cache_size 128
Ssl_session_cache_timeouts 0
Ssl_sessions_reused 0
Ssl_used_session_cache_entries 0
Ssl_verify_depth 18446744073709551615
Ssl_verify_mode 5
Ssl_version TLSv1.3
Table_locks_immediate 12516
Table_locks_waited 0
Table_open_cache_hits 10773239
Table_open_cache_misses 726449
Table_open_cache_overflows 718062
Tc_log_max_pages_used 0
Tc_log_page_size 0
Tc_log_page_waits 0
Threads_cached 4
Threads_connected 47
Threads_created 87
Threads_running 2
Uptime 96942
Uptime_since_flush_status 96942
tmp tables and memoty last 30 days
From your SHOW GLOBAL STATUS data, threads_connected at 48 after 2 days is an indicator the 'CONNECT','PROCESS','CLOSE' cycle may be missing the CLOSE of typical processing.
A two minute General Log should include some 'QUIT' lines in normal operation.
My profile has contact info.
Suggestion, using 20G of your 32G available for your innodb_buffer_pool_size would significantly reduce your innodb_buffer_pool_reads Rate Per Hr of 12,976. Using 100 for innodb_lru_scan_depth would conserve about 90% of CPU cycles used for the function every SECOND.

Mysql not start on slave system on mysql Ver 14.14 Distrib 5.6.41, version (Mysql master salve replication)?

My Configuration:
server-id = 2
master-host=192.1.1.12
master-connect-retry=60
master-user=root
master-password=root123
replicate-do-db=testdatabase
relay-log = /var/lib/mysql/mysql-relay-bin
relay-log-index = /var/lib/mysql/mysql-relay-bin.index
log-error = /var/lib/mysql/mysql.err
master-info-file = /var/lib/mysql/mysql-master.info
relay-log-info-file = /var/lib/mysql/mysql-relay-log.info
log-bin = /var/lib/mysql/mysql-bin
Output:
2018-09-14 08:41:10 13635 [ERROR] /usr/sbin/mysqld: unknown variable 'master-host=192.1.1.12'
2018-09-14 08:41:10 13635 [ERROR] Aborting
2018-09-14 08:41:10 13635 [Note] Binlog end
2018-09-14 08:41:10 13635 [Note] Shutting down plugin 'partition'
2018-09-14 08:41:10 13635 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
The master-host, -user, and -password option variables were removed from MySQL 5.5. Use the CHANGE MASTER statement instead.
https://dev.mysql.com/doc/refman/5.5/en/replication-options-slave.html#replication-optvars-slaves-obsolete

MySQL slave database stopped replication."Last_Error: Error 'Unknown database 'sen'' on query. Default"

the master:
the slave:
Current Environment
sen#ubuntu:~$ uname -a
Linux ubuntu 4.2.0-16-generic #19-Ubuntu SMP Thu Oct 8 15:35:06 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
sen#ubuntu:~$ mysql -V
mysql Ver 14.14 Distrib 5.5.32, for Linux (x86_64) using readline 5.1
Current Status
Master, 3306:
my.cnf : https://www.dropbox.com/s/nmelrjhrp6wn2oj/my_3306.cnf?dl=0
show processlist:
Master has sent all binlog to slave; waiting for binlog to be updated
sen#ubuntu:/data/3306$ sudo /application/mysql/bin/mysqlbinlog mysql-bin.000007
[sudo] password for sen:
/*!50530 SET ##SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET ##session.max_insert_delayed_threads=0*/;
/*!50003 SET #OLD_COMPLETION_TYPE=##COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
# #161106 10:39:40 server id 1 end_log_pos 107 Start: binlog v 4, server
# v 5.5.32-log created 161106 10:39:40 at startup
# # Warning: this binlog is either in use or was not closed properly.
# ROLLBACK/*!*/;
# BINLOG '
# 7JceWA8BAAAAZwAAAGsAAAABAAQANS41LjMyLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
# AAAAAAAAAAAAAAAAAADslx5YEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA==
# '/*!*/;
# DELIMITER ;
# # End of log file
# ROLLBACK /* added by mysqlbinlog */;
# /*!50003 SET COMPLETION_TYPE=#OLD_COMPLETION_TYPE*/;
# /*!50530 SET ##SESSION.PSEUDO_SLAVE_MODE=0*/;
#
Slave,3307:
my.cnf : https://www.dropbox.com/s/5t6mruzuo3wo1l7/my_3307.cnf?dl=0
show processlist: Waiting for master to send event
mysql> show slave status \G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.80.2
Master_User: rep
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000007
Read_Master_Log_Pos: 107
Relay_Log_File: relay-bin.000011
Relay_Log_Pos: 253
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB: mysql
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1049
Last_Error: Error 'Unknown database 'sen'' on query. Default
database: 'sen'. Query: 'create table t(id int(11), primary key(id))'
Skip_Counter: 0
Exec_Master_Log_Pos: 107
Relay_Log_Space: 2873
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 1049
Last_SQL_Error: Error 'Unknown database 'sen'' on query. Default
database: 'sen'. Query: 'create table t(id int(11), primary key(id))'
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
1 row in set (0.00 sec)
ERROR:
No query specified
the relay bin log:
sen#ubuntu:/data/3307$ sudo /application/mysql/bin/mysqlbinlog relay-bin.000020
/*!50530 SET ##SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET ##session.max_insert_delayed_threads=0*/;
/*!50003 SET #OLD_COMPLETION_TYPE=##COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
# #161106 17:00:43 server id 2 end_log_pos 107 Start: binlog v 4, server
# v 5.5.32 created 161106 17:00:43
# BINLOG '
# O/EeWA8CAAAAZwAAAGsAAAAAAAQANS41LjMyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
# AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA==
# '/*!*/;
# # at 107
# #700101 8:00:00 server id 1 end_log_pos 0 Rotate to mysql-bin.000007
# pos: 107
# # at 150
# #161106 10:39:40 server id 1 end_log_pos 0 Start: binlog v 4, server
# v 5.5.32-log created 161106 10:39:40
# BINLOG '
# 7JceWA8BAAAAZwAAAAAAAAAAAAQANS41LjMyLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
# AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA==
# '/*!*/;
# DELIMITER ;
# # End of log file
# ROLLBACK /* added by mysqlbinlog */;
# /*!50003 SET COMPLETION_TYPE=#OLD_COMPLETION_TYPE*/;
# /*!50530 SET ##SESSION.PSEUDO_SLAVE_MODE=0*/;
#
the error log:
$ less -R mysql_3307.err
161105 19:39:04 InnoDB: Waiting for the background threads to start
161105 19:39:05 InnoDB: 5.5.32 started; log sequence number 1601853
161105 19:39:05 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3307
161105 19:39:05 [Note] - '0.0.0.0' resolves to '0.0.0.0';
161105 19:39:05 [Note] Server socket created on IP: '0.0.0.0'.
161105 19:39:05 [Warning] 'user' entry 'root#ubuntu' ignored in --skip-name-resolve mode.
161105 19:39:05 [Warning] 'user' entry '#ubuntu' ignored in --skip-name-resolve mode.
161105 19:39:05 [Warning] 'proxies_priv' entry '# root#ubuntu' ignored in --skip-name-resolve mode.
161105 19:39:05 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000003' at position 107, relay log '/data/3307/relay-bin.000011' position: 253
161105 19:39:05 [ERROR] Slave I/O: error connecting to master 'rep#192.168.80.2:3306' - retry-time: 60 retries: 86400, Error_code: 2003
161105 19:39:05 [ERROR] Slave SQL: Error 'Unknown database 'sen'' on query. Default database: 'sen'. Query: 'create table t(id int(11), primary key(id))', Error_code: 1049
161105 19:39:05 [Warning] Slave: Unknown database 'sen' Error_code: 1049
161105 19:39:05 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000003' position 107
161105 19:39:05 [Note] Event Scheduler: Loaded 0 events
161105 19:39:05 [Note] /application/mysql-5.5.32/bin/mysqld: ready for connections. Version: '5.5.32' socket: '/data/3307/mysql.sock' port: 3307 Source distribution
161105 19:40:05 [Note] Slave I/O thread: connected to master 'rep#192.168.80.2:3306',replication started in log 'mysql-bin.000004' at position 317
I have searched by google, found
https://bugs.mysql.com/bug.php?id=19344
I have done
1.
restart the two mysql process 3306 and 3307
2.
on slave database:
stop slave;
start slave;
But it doesn't work.(mei shen me luan yong)
Please do me a favor!
tks.
by sen.

Percona Xtradb Cluster failing

I have setup Percona Xtradb cluster with 3 nodes. The first node starts fine with bootstrap, but when I try to start the second node to join the cluster, I get the following error:
2015-08-27 18:08:08 25990 [Warning] WSREP: Failed to prepare for incremental state transfer: Local state UUID (00000000-0000-0000-0000-000000000000) does not match group state UUID (a6b3fced-4ca1-11e5-b5da-d69fa186273c): 1 (Operation not permitted)
at galera/src/replicator_str.cpp:prepare_for_IST():463. IST will be unavailable.
2015-08-27 18:08:08 25990 [Note] WSREP: Member 0.0 (db-gc-pxc2) requested state transfer from 'any'. Selected 1.0 (db-gc-pxc1)(SYNCED) as donor.
2015-08-27 18:08:08 25990 [Note] WSREP: Shifting PRIMARY -> JOINER (TO: 0)
2015-08-27 18:08:08 25990 [Note] WSREP: Requesting state transfer: success, donor: 1
2015-08-27 18:08:08 25990 [Warning] WSREP: 1.0 (db-gc-pxc1): State transfer to 0.0 (db-gc-pxc2) failed: -12 (Cannot allocate memory)
2015-08-27 18:08:08 25990 [ERROR] WSREP: gcs/src/gcs_group.cpp:int gcs_group_handle_join_msg(gcs_group_t*, const gcs_recv_msg_t*)():731: Will never receive state. Need to abort.
2015-08-27 18:08:08 25990 [Note] WSREP: gcomm: terminating thread
2015-08-27 18:08:08 25990 [Note] WSREP: gcomm: joining thread
2015-08-27 18:08:08 25990 [Note] WSREP: gcomm: closing backend
Below is my cluster config in my.cnf file:
# Galera COnfig
wsrep_cluster_name = pxc
wsrep_cluster_address = gcomm://192.168.2.100,192.168.2.101,10.168.1.102
wsrep_node_address = 10.1.0.101
wsrep_provider = /usr/lib/libgalera_smm.so
wsrep_provider_options = "gcache.size=4G"
wsrep_slave_threads = 32
wsrep_sst_auth = "user:userpass"
wsrep_node_name = node2
#wsrep_sst_method = xtrabackup_throttle
wsrep_sst_method = xtrabackup-v2
What would be causing this error?
FYI, I do have the user and password for wsrep_sst_auth created in the database.
Here is the remainder of the my.cnf it it helps:
back_log = 65535
binlog_format = ROW
character_set_server = utf8
collation_server = utf8_general_ci
datadir = /var/lib/mysql
#default_storage_engine = InnoDB
expand_fast_index_creation = 1
expire_logs_days = 7
innodb_autoinc_lock_mode = 2
innodb_buffer_pool_instances = 6
innodb_buffer_pool_populate = 1
innodb_buffer_pool_size = 6G # XXX 64GB RAM, 80%
#innodb_data_file_path = ibdata1:64M;ibdata2:64M:autoextend
innodb_file_format = Barracuda
innodb_file_per_table
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT
innodb_io_capacity = 1600
innodb_large_prefix
innodb_locks_unsafe_for_binlog = 1
#innodb_log_file_size = 64M
innodb_print_all_deadlocks = 1
innodb_read_io_threads = 64
innodb_stats_on_metadata = FALSE
innodb_support_xa = FALSE
innodb_write_io_threads = 64
log-bin = mysqld-bin
log-queries-not-using-indexes
log-slave-updates
long_query_time = 1
max_allowed_packet = 64M
max_connect_errors = 4294967295
max_connections = 4096
min_examined_row_limit = 1000
performance-schema-instrument='%=ON'
port = 3306
relay-log-recovery = TRUE
skip-name-resolve
slow_query_log = 1
slow_query_log_timestamp_always = 1
table_open_cache = 4096
thread_cache = 1024
tmpdir = /srv/tmp
transaction_isolation = REPEATABLE-READ
updatable_views_with_limit = 0
user = mysql
wait_timeout = 60
This would seem to be the root cause:
2015-08-27 18:08:08 25990 [Warning] WSREP: 1.0 (db-gc-pxc1): State transfer to 0.0 (db-gc-pxc2) failed: -12 (Cannot allocate memory)
The new node tries to join the cluster. The new node has no state currently (local UUID is zeroes), and so an IST is not available - this means it needs to run a full SST form the donor node.
Node pxc2 is the joiner and pxc1 is the selected donor; however we get an error from pxc1 that the state transfer failed, which causes the joining to fail.
You should check the logs on the donor node (pxc1) for more detail; but the log we have indicates that it has insufficient memory to run the export of the database. Not knowing your hardware configuration, I can't give a definite response, but most likely your my.cnf is configured to be too memory hungry for your available memory and so the xtrabackup process cannot run, or else the database is too large. Add more memory to the node, or else reduce the allocations in the my.cnf.

MySQL UDF for reading a file from disk: MySQL keeps crashing on every second UDF call

I'm trying to create an MySQL UDF getFile() which is supposed to return the contents of a text file from a certain directory on disk. The problem is that the call works once or twice, but upon calling the UDF for a second or third time the MySQL server crashes.
I can't reproduce the error by calling getFile() directly from the mysql console, here it seems to work fine - it seems to occur only when I call the UDF from the stored procedure. The error also disappears when I call only the small (2.5 k) "session" file while omitting the bigger "mailConfirmation" (45 k) and "mailProtocol" (88 k) files, so it seems to have something to do with the file size.
MySQL version: 5.1.49-3
OS: Debian 6 Squeeze
Any suggestions or ideas will be greatly appreciated - thanks in advance!
This is the UDF:
/*
* Skeleton libary for MySQL.
* A set of MySQL user defined functions (UDF) to [DESCRIPTION]
*
* Copyright (C) [YYYY YOUR NAME <YOU#EXAMPLE.COM>]
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mysqludf.h"
/* For Windows, define PACKAGE_STRING in the VS project */
#ifndef __WIN__
#include "config.h"
#endif
/* These must be right or mysqld will not find the symbol! */
#ifdef __cplusplus
extern "C" {
#endif
DLLEXP my_bool getFile_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
DLLEXP void getFile_deinit(UDF_INIT *initid);
DLLEXP char *getFile(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *length, char *is_null, char *error);
#ifdef __cplusplus
}
#endif
/*
* Output the library version.
* dbrw_info()
*/
my_bool getFile_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
if(!(args->arg_count == 3))
{
strcpy(message, "Three arguments expected! (table, uuid, column)");
//strcpy(message, "Error");
return 1;
}
char *input_file_name;
asprintf(&input_file_name, "%s%s%s%s%s%s", "/var/lib/mysqlFiles/", args->args[0], "/", args->args[1], "_", args->args[2]);
if (FILE * file = fopen(input_file_name, "r"))
{
fclose(file);
}
else
{
strcpy(message, "File not found!");
//strcpy(message, "Error");
return 1;
}
return 0;
}
void getFile_deinit(UDF_INIT *initid)
{
}
char* getFile(UDF_INIT *initid, UDF_ARGS *args, char* result, unsigned long* length, char *is_null, char *error)
{
char *input_file_name;
asprintf(&input_file_name, "%s%s%s%s%s%s", "/var/lib/mysqlFiles/", args->args[0], "/", args->args[1], "_", args->args[2]);
char *file_contents;
long input_file_size;
FILE *input_file = fopen(input_file_name, "rb");
fseek(input_file, 0, SEEK_END);
input_file_size = ftell(input_file);
rewind(input_file);
file_contents = (char*) malloc(input_file_size * (sizeof(char)));
fread(file_contents, sizeof(char), input_file_size, input_file);
fclose(input_file);
result=file_contents;
*length = strlen(result);
return result;
}
The UDF is being called from a stored procedure:
CREATE PROCEDURE getOrder
(
IN authKey_in CHAR(255),
IN orderNumber CHAR(255)
)
BEGIN
DECLARE customerId INTEGER(11);
DECLARE orderUUID CHAR(32);
SET customerId=getCustomerId(authKey_in);
IF customerId=-1 THEN
SELECT 'authKey_expired' AS error;
ELSEIF customerId=-2 THEN
SELECT 'authKey_invalid' AS error;
ELSE
SELECT order_uuid
FROM `order`
WHERE
order_orderNumber=orderNumber AND
order_customer_id=customerId
INTO orderUUID;
SELECT
order_customer_id,
order_hasBeenCollected,
order_id,
order_orderNumber,
order_orderValue,
order_paymentMethod,
order_sofortConfirmation,
order_synced,
order_timestamp,
order_timestamp_lastChange,
order_uuid,
getFile("order", orderUUID, "session") AS order_session,
getFile("order", orderUUID, "mailProtocol") AS order_confirmationMail_protocol,
getFile("order", orderUUID, "mailConfirmation") AS order_confirmationMail_text,
DATE_FORMAT(
order_timestamp,
"%d.%m.%Y"
) AS order_timestamp_readable
FROM `order`
WHERE
order_orderNumber=orderNumber AND
order_customer_id=customerId;
END IF;
END|
And this is MySQL's output from /var/log/syslog:
Jan 11 00:01:21 devserver mysqld: 130111 0:01:21 - mysqld got signal 11 ;
Jan 11 00:01:21 devserver mysqld: This could be because you hit a bug. It is also possible that this binary
Jan 11 00:01:21 devserver mysqld: or one of the libraries it was linked against is corrupt, improperly built,
Jan 11 00:01:21 devserver mysqld: or misconfigured. This error can also be caused by malfunctioning hardware.
Jan 11 00:01:21 devserver mysqld: We will try our best to scrape up some info that will hopefully help diagnose
Jan 11 00:01:21 devserver mysqld: the problem, but since we have already crashed, something is definitely wrong
Jan 11 00:01:21 devserver mysqld: and this may fail.
Jan 11 00:01:21 devserver mysqld:
Jan 11 00:01:21 devserver mysqld: key_buffer_size=4294967296
Jan 11 00:01:21 devserver mysqld: read_buffer_size=131072
Jan 11 00:01:21 devserver mysqld: max_used_connections=2
Jan 11 00:01:21 devserver mysqld: max_threads=50
Jan 11 00:01:21 devserver mysqld: threads_connected=2
Jan 11 00:01:21 devserver mysqld: It is possible that mysqld could use up to
Jan 11 00:01:21 devserver mysqld: key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 4303618 K
Jan 11 00:01:21 devserver mysqld: bytes of memory
Jan 11 00:01:21 devserver mysqld: Hope that's ok; if not, decrease some variables in the equation.
Jan 11 00:01:21 devserver mysqld:
Jan 11 00:01:21 devserver mysqld: thd: 0x7f8291eae3f0
Jan 11 00:01:21 devserver mysqld: Attempting backtrace. You can use the following information to find out
Jan 11 00:01:21 devserver mysqld: where mysqld died. If you see no messages after this, something went
Jan 11 00:01:21 devserver mysqld: terribly wrong...
Jan 11 00:01:21 devserver mysqld: stack_bottom = 0x7f81867e0e88 thread_stack 0x30000
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(my_print_stacktrace+0x29) [0x7f82910e8829]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(handle_segfault+0x404) [0x7f8290df2b14]
Jan 11 00:01:21 devserver mysqld: /lib/libpthread.so.0(+0xeff0) [0x7f8290654ff0]
Jan 11 00:01:21 devserver mysqld: /lib/libc.so.6(fseek+0x1) [0x7f828f12b891]
Jan 11 00:01:21 devserver mysqld: /usr/lib/mysql/plugin/dbrw.so(getFile+0x7e) [0x7f81867e2c1e]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(Item_func_udf_str::val_str(String*)+0x80) [0x7f8290d64900]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(Item::send(Protocol*, String*)+0x3e) [0x7f8290d30eae]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(select_send::send_data(List<Item>&)+0x107) [0x7f8290de05f7]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(+0x3d1b7a) [0x7f8290e53b7a]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(+0x3dda00) [0x7f8290e5fa00]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(JOIN::exec()+0xba5) [0x7f8290e748f5]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*)+0x142) [0x7f8290e70622]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(handle_select(THD*, st_lex*, select_result*, unsigned long)+0x174) [0x7f8290e75f24]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(+0x37edfa) [0x7f8290e00dfa]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(mysql_execute_command(THD*)+0x516) [0x7f8290e04df6]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(sp_instr_stmt::exec_core(THD*, unsigned int*)+0x1c) [0x7f8290f6047c]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*)+0x1c5) [0x7f8290f65c65]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(sp_instr_stmt::execute(THD*, unsigned int*)+0x124) [0x7f8290f65f74]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(sp_head::execute(THD*)+0x5d3) [0x7f8290f62fa3]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(sp_head::execute_procedure(THD*, List<Item>*)+0x51c) [0x7f8290f6472c]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(mysql_execute_command(THD*)+0x2736) [0x7f8290e07016]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(mysql_parse(THD*, char const*, unsigned int, char const**)+0x3fb) [0x7f8290e0a30b]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0xb34) [0x7f8290e0ae54]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(do_command(THD*)+0xea) [0x7f8290e0bd3a]
Jan 11 00:01:21 devserver mysqld: /usr/sbin/mysqld(handle_one_connection+0x235) [0x7f8290dfda25]
Jan 11 00:01:21 devserver mysqld: /lib/libpthread.so.0(+0x68ca) [0x7f829064c8ca]
Jan 11 00:01:21 devserver mysqld: /lib/libc.so.6(clone+0x6d) [0x7f828f19492d]
Jan 11 00:01:21 devserver mysqld: Trying to get some variables.
Jan 11 00:01:21 devserver mysqld: Some pointers may be invalid and cause the dump to abort...
Jan 11 00:01:21 devserver mysqld: thd->query at 0x7f8291eea5c8 = SELECT
Jan 11 00:01:21 devserver mysqld: order_customer_id,
Jan 11 00:01:21 devserver mysqld: order_hasBeenCollected,
Jan 11 00:01:21 devserver mysqld: order_id,
Jan 11 00:01:21 devserver mysqld: order_orderNumber,
Jan 11 00:01:21 devserver mysqld: order_orderValue,
Jan 11 00:01:21 devserver mysqld: order_paymentMethod,
Jan 11 00:01:21 devserver mysqld: order_sofortConfirmation,
Jan 11 00:01:21 devserver mysqld: order_synced,
Jan 11 00:01:21 devserver mysqld: order_timestamp,
Jan 11 00:01:21 devserver mysqld: order_timestamp_lastChange,
Jan 11 00:01:21 devserver mysqld: order_uuid,
Jan 11 00:01:21 devserver mysqld: getFile("order", NAME_CONST('orderUUID',_latin1'8A507ECC5B4F11E2B385F526BF61D66D' COLLATE 'latin1_swedish_ci'), "session") AS order_session,
Jan 11 00:01:21 devserver mysqld: getFile("order", NAME_CONST('orderUUID',_latin1'8A507ECC5B4F11E2B385F526BF61D66D' COLLATE 'latin1_swedish_ci'), "mailProtocol") AS order_confirmationMail_protocol,
Jan 11 00:01:21 devserver mysqld: getFile("order", NAME_CONST('orderUUID',_latin1'8A507ECC5B4F11E2B385F526BF61D66D' COLLATE 'latin1_swedish_ci'), "mailConfirmation") AS order_confirmationMail_text,
Jan 11 00:01:21 devserver mysqld: DATE_FORMAT(
Jan 11 00:01:21 devserver mysqld: order_timestamp,
Jan 11 00:01:21 devserver mysqld: "%d.%m.%Y"
Jan 11 00:01:21 devserver mysqld: ) AS order_timestamp_readable
Jan 11 00:01:21 devserver mysqld: FROM `o
Jan 11 00:01:21 devserver mysqld: thd->thread_id=17
Jan 11 00:01:21 devserver mysqld: thd->killed=NOT_KILLED
Jan 11 00:01:21 devserver mysqld: The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
Jan 11 00:01:21 devserver mysqld: information that should help you find out what is causing the crash.
Jan 11 00:01:21 devserver mysqld_safe: Number of processes running now: 0
Jan 11 00:01:21 devserver mysqld_safe: mysqld restarted
Jan 11 00:01:22 devserver mysqld: 130111 0:01:22 [Note] Plugin 'FEDERATED' is disabled.
Jan 11 00:01:22 devserver mysqld: InnoDB: Log scan progressed past the checkpoint lsn 38 555424888
Jan 11 00:01:22 devserver mysqld: 130111 0:01:22 InnoDB: Database was not shut down normally!
Jan 11 00:01:22 devserver mysqld: InnoDB: Starting crash recovery.
Jan 11 00:01:22 devserver mysqld: InnoDB: Reading tablespace information from the .ibd files...
Jan 11 00:01:25 devserver mysqld: InnoDB: Restoring possible half-written data pages from the doublewrite
Jan 11 00:01:25 devserver mysqld: InnoDB: buffer...
Jan 11 00:01:25 devserver mysqld: InnoDB: Doing recovery: scanned up to log sequence number 38 555424898
Jan 11 00:01:26 devserver mysqld: 130111 0:01:26 InnoDB: Started; log sequence number 38 555424898
Jan 11 00:01:26 devserver mysqld: 130111 0:01:26 [ERROR] Can't open shared library 'lib_mysqludf_preg.so' (errno: 0 /usr/lib/mysql/plugin/lib_mysqludf_preg.so: cannot open shared object file: No such file or directory)
Jan 11 00:01:26 devserver last message repeated 5 times
Jan 11 00:01:26 devserver mysqld: 130111 0:01:26 [Warning] Neither --relay-log nor --relay-log-index were used; so replication may break when this MySQL server acts as a slave and has his hostname changed!! Please use '--relay-log=mysqld-relay-bin' to avoid this problem.
Jan 11 00:01:26 devserver mysqld: 130111 0:01:26 [Note] Event Scheduler: Loaded 0 events
Jan 11 00:01:26 devserver mysqld: 130111 0:01:26 [Note] /usr/sbin/mysqld: ready for connections.
Jan 11 00:01:26 devserver mysqld: Version: '5.1.49-3' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Debian)
Jan 11 00:01:27 devserver mysqld: 130111 0:01:27 [ERROR] /usr/sbin/mysqld: Table './mysql/proc' is marked as crashed and should be repaired
Jan 11 00:01:27 devserver mysqld: 130111 0:01:27 [Warning] Checking table: './mysql/proc'
These are the files that are being read:
[root#devserver order]# ls -l
total 140
-rw-rw-rw- 1 mysql staff 45366 Jan 10 18:59 8A507ECC5B4F11E2B385F526BF61D66D_mailConfirmation
-rw-rw-rw- 1 mysql staff 88389 Jan 10 18:59 8A507ECC5B4F11E2B385F526BF61D66D_mailProtocol
-rw-rw-rw- 1 mysql staff 2518 Jan 10 18:59 8A507ECC5B4F11E2B385F526BF61D66D_session
And finally the statement to create the UDF:
USE mysql;
DROP FUNCTION IF EXISTS getFile;
CREATE FUNCTION getFile RETURNS STRING SONAME 'dbrw.so';
After hours of testing and searching I finally found out that the problem doesn't seem to be the UDF itself but
its call from the stored procedure - the error occurs only when calling it from the SPROC, not from the mysql console.
I stumbled across this mysql bug report:
http://bugs.mysql.com/bug.php?id=25207
[20 Dec 2006 10:16] Zigmund Bulinsh
Description:
I have a function defined thgrough UDF DLL.
it is named as RaiseError (RaiseError_init alwais returns 1 and error message always equals to first parameter).
How to repeat:
select RaiseError('Some error'); raises MySQL error: 'Some error'
Now I define procedure which call this function (more comfortable way to use it)
CREATE PROCEDURE `Error`(p_text char(255))
begin
declare x int;
set x = RaiseError(p_text);
end
After calling this procedure from anywhere - MySQL crashes...
But this version works fine:
CREATE PROCEDURE `Error`(p_text VARchar(255))
begin
declare x int;
set x = RaiseError(p_text);
end
This bug report gave me the crucial clue. I tried playing around with the data types of the UDF arguments and I noticed
that the error does not occur when I use a string instead of a variable.
This causes the server to crash:
DECLARE orderUUID CHAR(32);
...
getFile("order", orderUUID, "session") AS order_session,
getFile("order", orderUUID, "mailProtocol") AS order_confirmationMail_protocol,
getFile("order", orderUUID, "mailConfirmation") AS order_confirmationMail_text,
while this works perfectly:
getFile("order", '8A507ECC5B4F11E2B385F526BF61D66D', "session") AS order_session,
getFile("order", '8A507ECC5B4F11E2B385F526BF61D66D', "mailProtocol") AS order_confirmationMail_protocol,
getFile("order", '8A507ECC5B4F11E2B385F526BF61D66D', "mailConfirmation") AS order_confirmationMail_text,
So I changed the data type from CHAR(32) to VARCHAR(255) and the server doesn't crash anymore:
DECLARE orderUUID VARCHAR(255);
...
getFile("order", orderUUID, "session") AS order_session,
getFile("order", orderUUID, "mailProtocol") AS order_confirmationMail_protocol,
getFile("order", orderUUID, "mailConfirmation") AS order_confirmationMail_text,
It doesn't work neither with CHAR(255) nor with VARCHAR(32), it works only with VARCHAR(255).
I haven't tried other string lengths though.
Hmmm. I see a malloc, but I don't see a corresponding free.
Isn't it the responsibility of the UDF to deallocate any memory that it's allocated? And isn't that the purpose of the server's call to the UDF x_deinit function?
Typically, we'd expect to see any malloc performed in the _init function, and the corresponding free to be in the _deinit function.
But, I am not a SME on MySQL UDFs. I'm just wondering where that memory is getting deallocated.
I suspect the line "*length = strlen(result)". strlen() will stop at '\0', and so something is obviously wrong.
I'm no UDF expert, but could it be that MySQL is expecting a "String" (REATE FUNCTION getFile RETURNS STRING) to be something other than null-terminated?
Also, as a side note: a char() is not always a byte. ftell() returns size in bytes, so multiplying by sizeof(char) is actually wrong -- if you pass this to malloc, you should be dividing by sizeof(char). Not that it matters in most architectures, since usually a char is a byte.
Finally -- are rewind() and fseek() safe to mix? is rewind completely equivalent to fseek(f, 0, SEEK_SET), or does it have something to do with C's runtime buffered IO?