ERROR: Error in Log_event::read_log_event(): 'read error', data_len: 438, event_type: 2

本文详细分析了在解析MySQL binlog日志时遇到的'readerror'错误,提供了三种解决方案:使用完整路径、强制解析、复制并重新解析日志文件。最终发现问题是由于日志文件在解析过程中被其他操作覆盖导致的。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

分析从库1062问题,解析从库binlog日志,报错如下
[root@xxxdb0402 tmp]# mysqlbinlog mysql-bin.004271 > 4.log
ERROR: Error in Log_event::read_log_event(): 'read error', data_len: 438, event_type: 2
[root@xxxdb0402 tmp]# grep 'rding' 4.log > rd4.log
[root@xxxdb0402 tmp]# ll rd4.log
-rw-r--r-- 1 root root 0 Sep 3 17:50 rd4.log
空的,第四个日志没有录入操作


奇怪报错了,google之,3种方案
1 写全路径
[root@xxxdb0402 tmp]# /opt/mysql/product/5.5.25a/bin/mysqlbinlog mysql-bin.004271 > 4.log
ERROR: Error in Log_event::read_log_event(): 'read error', data_len: 438, event_type: 2
[root@xxxdb0402 tmp]# whereis mysqlbinlog
mysqlbinlog: /usr/bin/mysqlbinlog
[root@xxxdb0402 tmp]# /usr/bin/mysqlbinlog mysql-bin.004271 > 4.log
/usr/bin/mysqlbinlog: Character set '#45' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
ERROR: Error in Log_event::read_log_event(): 'read error', data_len: 438, event_type: 2


2 加-f强制解析
[root@xxxdb0402 tmp]# mysqlbinlog -f mysql-bin.004271 > 4.log
ERROR: Error in Log_event::read_log_event(): 'read error', data_len: 438, event_type: 2


3 这个copy过来的日志的时候,db正往日志里面写数据呢,从新copy下binlog到/tmp下。
那就重新copy一次binlog,再解析
[root@xxxdb0402 tmp]# cp /mysqldata/data/mysql-bin.004271 /tmp/
cp: overwrite `/tmp/mysql-bin.004271'? y
[root@xxxdb0402 tmp]# /opt/mysql/product/5.5.25a/bin/mysqlbinlog mysql-bin.004271 > 4.log
ERROR: Error in Log_event::read_log_event(): 'read error', data_len: 438, event_type: 2


3种方案都报一样的错误。Mysql版本5.5.25a。linux环境centos6.0


这个问题如何搞定,比较诡异?


朋友建议直接在mysql的数据目录之下用mysqlbinlog试下

[root@xxxdb0402 data]# /opt/mysql/product/5.5.25a/bin/mysqlbinlog -f mysql-bin.004271 > 4.log
ERROR: Error in Log_event::read_log_event(): 'read error', data_len: 438, event_type: 2

结果还是一样的报错。




D:/esp32_C3/vendor_0.1.1/main/main.c: In function 'optimize_scan_parameters': D:/esp32_C3/vendor_0.1.1/main/main.c:233:5: error: unknown type name 'esp_ble_scan_params_t' 233 | esp_ble_scan_params_t scan_params = { | ^~~~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:234:9: error: field name not in record or union initializer 234 | .scan_type = BLE_SCAN_TYPE_ACTIVE, | ^ D:/esp32_C3/vendor_0.1.1/main/main.c:234:9: note: (near initialization for 'scan_params') D:/esp32_C3/vendor_0.1.1/main/main.c:234:22: error: 'BLE_SCAN_TYPE_ACTIVE' undeclared (first use in this function) 234 | .scan_type = BLE_SCAN_TYPE_ACTIVE, | ^~~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:234:22: note: each undeclared identifier is reported only once for each function it appears in D:/esp32_C3/vendor_0.1.1/main/main.c:235:9: error: field name not in record or union initializer 235 | .own_addr_type = BLE_ADDR_TYPE_PUBLIC, | ^ D:/esp32_C3/vendor_0.1.1/main/main.c:235:9: note: (near initialization for 'scan_params') D:/esp32_C3/vendor_0.1.1/main/main.c:235:26: error: 'BLE_ADDR_TYPE_PUBLIC' undeclared (first use in this function) 235 | .own_addr_type = BLE_ADDR_TYPE_PUBLIC, | ^~~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:235:26: warning: excess elements in scalar initializer D:/esp32_C3/vendor_0.1.1/main/main.c:235:26: note: (near initialization for 'scan_params') D:/esp32_C3/vendor_0.1.1/main/main.c:236:9: error: field name not in record or union initializer 236 | .scan_filter_policy = BLE_SCAN_FILTER_ALLOW_ALL, | ^ D:/esp32_C3/vendor_0.1.1/main/main.c:236:9: note: (near initialization for 'scan_params') D:/esp32_C3/vendor_0.1.1/main/main.c:236:31: error: 'BLE_SCAN_FILTER_ALLOW_ALL' undeclared (first use in this function) 236 | .scan_filter_policy = BLE_SCAN_FILTER_ALLOW_ALL, | ^~~~~~~~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:236:31: warning: excess elements in scalar initializer D:/esp32_C3/vendor_0.1.1/main/main.c:236:31: note: (near initialization for 'scan_params') D:/esp32_C3/vendor_0.1.1/main/main.c:237:9: error: field name not in record or union initializer 237 | .scan_interval = 0x60, // 鏇寸煭鐨勬壂鎻忛棿闅?(60ms) | ^ D:/esp32_C3/vendor_0.1.1/main/main.c:237:9: note: (near initialization for 'scan_params') D:/esp32_C3/vendor_0.1.1/main/main.c:237:26: warning: excess elements in scalar initializer 237 | .scan_interval = 0x60, // 鏇寸煭鐨勬壂鎻忛棿闅?(60ms) | ^~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:237:26: note: (near initialization for 'scan_params') D:/esp32_C3/vendor_0.1.1/main/main.c:238:9: error: field name not in record or union initializer 238 | .scan_window = 0x30, // 鏇撮暱鐨勬壂鎻忕獥鍙?(30ms) | ^ D:/esp32_C3/vendor_0.1.1/main/main.c:238:9: note: (near initialization for 'scan_params') D:/esp32_C3/vendor_0.1.1/main/main.c:238:24: warning: excess elements in scalar initializer 238 | .scan_window = 0x30, // 鏇撮暱鐨勬壂鎻忕獥鍙?(30ms) | ^~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:238:24: note: (near initialization for 'scan_params') D:/esp32_C3/vendor_0.1.1/main/main.c:239:9: error: field name not in record or union initializer 239 | .scan_duplicate = BLE_SCAN_DUPLICATE_DISABLE | ^ D:/esp32_C3/vendor_0.1.1/main/main.c:239:9: note: (near initialization for 'scan_params') D:/esp32_C3/vendor_0.1.1/main/main.c:239:27: error: 'BLE_SCAN_DUPLICATE_DISABLE' undeclared (first use in this function) 239 | .scan_duplicate = BLE_SCAN_DUPLICATE_DISABLE | ^~~~~~~~~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:239:27: warning: excess elements in scalar initializer D:/esp32_C3/vendor_0.1.1/main/main.c:239:27: note: (near initialization for 'scan_params') D:/esp32_C3/vendor_0.1.1/main/main.c:242:21: error: implicit declaration of function 'esp_ble_gap_set_scan_params' [-Wimplicit-function-declaration] 242 | esp_err_t err = esp_ble_gap_set_scan_params(&scan_params); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from D:/esp32_C3/vendor_0.1.1/main/main.c:8: D:/esp32_C3/vendor_0.1.1/main/main.c:247:28: error: request for member 'scan_interval' in something not a structure or union 247 | scan_params.scan_interval, scan_params.scan_window); | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:182:137: note: in definition of macro 'ESP_LOG_LEVEL' 182 | if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:246:9: note: in expansion of macro 'ESP_LOGI' 246 | ESP_LOGI(TAG, "鎵弿鍙傛暟浼樺寲瀹屾垚: interval=0x%X, window=0x%X", | ^~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:247:55: error: request for member 'scan_window' in something not a structure or union 247 | scan_params.scan_interval, scan_params.scan_window); | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:182:137: note: in definition of macro 'ESP_LOG_LEVEL' 182 | if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:246:9: note: in expansion of macro 'ESP_LOGI' 246 | ESP_LOGI(TAG, "鎵弿鍙傛暟浼樺寲瀹屾垚: interval=0x%X, window=0x%X", | ^~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:247:28: error: request for member 'scan_interval' in something not a structure or union 247 | scan_params.scan_interval, scan_params.scan_window); | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:183:137: note: in definition of macro 'ESP_LOG_LEVEL' 183 | else if (level==ESP_LOG_WARN ) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:246:9: note: in expansion of macro 'ESP_LOGI' 246 | ESP_LOGI(TAG, "鎵弿鍙傛暟浼樺寲瀹屾垚: interval=0x%X, window=0x%X", | ^~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:247:55: error: request for member 'scan_window' in something not a structure or union 247 | scan_params.scan_interval, scan_params.scan_window); | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:183:137: note: in definition of macro 'ESP_LOG_LEVEL' 183 | else if (level==ESP_LOG_WARN ) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:246:9: note: in expansion of macro 'ESP_LOGI' 246 | ESP_LOGI(TAG, "鎵弿鍙傛暟浼樺寲瀹屾垚: interval=0x%X, window=0x%X", | ^~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:247:28: error: request for member 'scan_interval' in something not a structure or union 247 | scan_params.scan_interval, scan_params.scan_window); | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:184:137: note: in definition of macro 'ESP_LOG_LEVEL' 184 | else if (level==ESP_LOG_DEBUG ) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:246:9: note: in expansion of macro 'ESP_LOGI' 246 | ESP_LOGI(TAG, "鎵弿鍙傛暟浼樺寲瀹屾垚: interval=0x%X, window=0x%X", | ^~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:247:55: error: request for member 'scan_window' in something not a structure or union 247 | scan_params.scan_interval, scan_params.scan_window); | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:184:137: note: in definition of macro 'ESP_LOG_LEVEL' 184 | else if (level==ESP_LOG_DEBUG ) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:246:9: note: in expansion of macro 'ESP_LOGI' 246 | ESP_LOGI(TAG, "鎵弿鍙傛暟浼樺寲瀹屾垚: interval=0x%X, window=0x%X", | ^~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:247:28: error: request for member 'scan_interval' in something not a structure or union 247 | scan_params.scan_interval, scan_params.scan_window); | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:185:137: note: in definition of macro 'ESP_LOG_LEVEL' 185 | else if (level==ESP_LOG_VERBOSE ) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:246:9: note: in expansion of macro 'ESP_LOGI' 246 | ESP_LOGI(TAG, "鎵弿鍙傛暟浼樺寲瀹屾垚: interval=0x%X, window=0x%X", | ^~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:247:55: error: request for member 'scan_window' in something not a structure or union 247 | scan_params.scan_interval, scan_params.scan_window); | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:185:137: note: in definition of macro 'ESP_LOG_LEVEL' 185 | else if (level==ESP_LOG_VERBOSE ) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:246:9: note: in expansion of macro 'ESP_LOGI' 246 | ESP_LOGI(TAG, "鎵弿鍙傛暟浼樺寲瀹屾垚: interval=0x%X, window=0x%X", | ^~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:247:28: error: request for member 'scan_interval' in something not a structure or union 247 | scan_params.scan_interval, scan_params.scan_window); | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:186:137: note: in definition of macro 'ESP_LOG_LEVEL' 186 | else { esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:246:9: note: in expansion of macro 'ESP_LOGI' 246 | ESP_LOGI(TAG, "鎵弿鍙傛暟浼樺寲瀹屾垚: interval=0x%X, window=0x%X", | ^~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:247:55: error: request for member 'scan_window' in something not a structure or union 247 | scan_params.scan_interval, scan_params.scan_window); | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:186:137: note: in definition of macro 'ESP_LOG_LEVEL' 186 | else { esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:246:9: note: in expansion of macro 'ESP_LOGI' 246 | ESP_LOGI(TAG, "鎵弿鍙傛暟浼樺寲瀹屾垚: interval=0x%X, window=0x%X", | ^~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c: In function 'switch_device_role': D:/esp32_C3/vendor_0.1.1/main/main.c:528:41: error: 'example_ble_mesh_provisioning_cb' undeclared (first use in this function) 528 | esp_ble_mesh_register_prov_callback(example_ble_mesh_provisioning_cb); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c:529:49: error: 'example_ble_mesh_custom_model_cb' undeclared (first use in this function) 529 | esp_ble_mesh_register_custom_model_callback(example_ble_mesh_custom_model_cb); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c: In function 'example_ble_mesh_provisioning_cb': D:/esp32_C3/vendor_0.1.1/main/main.c:642:31: error: implicit declaration of function 'esp_ble_gap_get_rssi' [-Wimplicit-function-declaration] 642 | int8_t rssi = esp_ble_gap_get_rssi(param->provisioner_recv_unprov_adv_pkt.addr); | ^~~~~~~~~~~~~~~~~~~~ D:/esp32_C3/vendor_0.1.1/main/main.c: In function 'ble_mesh_init': D:/esp32_C3/vendor_0.1.1/main/main.c:984:9: error: implicit declaration of function 'esp_\U00006781_mesh_node_prov_enable'; did you mean 'esp_ble_mesh_node_prov_enable'? [-Wimplicit-function-declaration] 984 | esp_鏋乢mesh_node_prov_enable(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | esp_ble_mesh_node_prov_enable D:/esp32_C3/vendor_0.1.1/main/main.c: At top level: D:/esp32_C3/vendor_0.1.1/main/main.c:292:18: warning: 'prov_complete' defined but not used [-Wunused-function] 292 | static esp_err_t prov_complete(uint16_t node_index, cninja: build stopped: subcommand failed. * 终端进程“e:\espidf\espressif\tools\ninja\1.12.1\ninja.EXE”已终止,退出代码: 1。
最新发布
07-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值