首批通过分布式安全可靠测评,为关键业务系统打造
卡合并,ob_micro_block_cache 模块报错:failed to allocate value, -4013
更新时间:2026-06-15 09:16
适用版本
OceanBase 数据库 V2.x、V3.x 版本。
问题现象
集群卡合并,有大表 3 个副本都没有推高合并完成。observer.log 日志报错 log item too long(ret=-4019 ...。
[2023-02-10 11:27:58.315289] INFO [STORAGE.REDO] ob_storage_log_writer.cpp:347 [2265741][0][YB42150D3C7C-0005EBD0FFAE2A87-0-0] [lt=22] [dc=0] large log item(log_buffer_size_=524288, total_item_size=33599488)
[2023-02-10 11:27:58.315298] ERROR [STORAGE.REDO] get_log_item (ob_storage_log_writer.cpp:355) [2265741][0][YB42150D3C7C-0005EBD0FFAE2A87-0-0] [lt=7] [dc=0] log item too long(ret=-4019, total_item_size=33599488, ObLogConstants::LOG_ITEM_MAX_LENGTH=33554432) BACKTRACE:0xf4ebe0b 0x5
3069ef 0x5442863 0x544249f 0x5442203 0x5446229 0xabcd3e5 0xabcba17 0xabafa67 0xabac2bc 0xabab869 0xabab02f 0x9e7bc72 0x9e7dae6 0x9ed8a70 0x9ed9b7d 0xa7cf237 0xa1243e0 0xa13040f 0xa12f0fa 0x66ff687 0x53369a4 0x671751e 0xf3cb5f3 0xf3cb44f 0xf66670f
[2023-02-10 11:28:00.353362] WARN [STORAGE.COMPACTION] process (ob_partition_merge_task.cpp:1572) [2265741][0][YB42150D3C7C-0005EBD0FFAE2A87-0-0] [lt=4] [dc=0] sstable merge finish(ret=-4019, ctx={param:{merge_type:0, merge_version:"224-0-0", pkey:{tid:1111606255735584, partition_id:0, part_cnt:0}, index_id:1111606255735584, schedule_merge_type:0, pg_key:{tid:1111606255735584, partition_id:0, part_cnt:0}}, sstable_version_range:{multi_version_start:1675897368596131, base_version:0, snapshot_version:1675897368596131}, create_snapshot_version:1672059584778064, base_schema_version:1675878313328096, schema_version:1675894884105768, dump_memtable_timestamp:0, table_schema:0x7f4616611d50, is_full_merge:false, stat_sampling_ratio:100, merge_level:0, progressive_merge_num:100, progressive_merge_start_version:0, parallel_merge_ctx:{parallel_type:0, range_array:[], first_sstable:{ObITable:{this:0x7f39a5cd0d40, key:{table_type:1, pkey:{tid:1111606255735584, partition_id:0, part_cnt:0}, table_id:1111606255735584, trans_version_range:{multi_version_start:1675879510431876, base_version:0, snapshot_version:1675879510431876}, log_ts_range:{start_log_ts:0, end_log_ts:0, max_log_ts:0}, version:"223-0-0"}, ref_cnt:3, upper_trans_version:1675879510431876, timestamp:0}, this:0x7f39a5cd0d40, status:4, meta:{ObSSTableBaseMeta:{index_id:1111606255735584, row_count:1664410915, occupy_size:519012721553, data_checksum:3868577198, data_version:223, rowkey_column_count:1, table_type:3, index_type:0, macro_block_count:2271188, use_old_macro_block_count:2145416, column_cnt:18, column_metas:
问题原因
slog 有 32M 的长度限制,当宏块超过一定数量(约 32M /(4 * 8B ) = 100w )时,就会报 -4019 错误,导致卡合并。
该大表真实数据量只有 500G,却占用 4T 磁盘空间(约 200w 个宏块),宏块平均利率不高(约 12.5% ),是因为更新插入比较离散。
分析原因参考 SQL。
如何查询卡合并的表。
obclient> select * from oceanbase.__all_virtual_meta_table where data_version != <major_version>;如何查询当前的集群中最大的 SSTable。
obclient> select * from __all_virtual_table_mgr where table_id = 'xxxxxx' and (table_type = 1 or table_type = 7) order by size desc;其中 table_type 指的是 table 的存储类型, 在不同版本中 table_type 的定义略有不同,下表是 OceanBase 数据库 V2.x 版本的 table_type 的定义在下面选出 SSTable 相关的 table_table,OceanBase 数据库 V2.x 版本中 1 和 7 代表的 MAJOR_SSTABLE 和 MINI_MINOR_SSTABLE 都是 SSTable。
table_type 值 定义 0 MEMTABLE 1 MAJOR_SSTABLE 2 MINOR_SSTABLE 3 MAJOR_SPLIT_SSTABLE 4 MULTI_VERSION_MINOR_SSTABLE 5 MAJOR_TEMP_SPLIT_SSTABLE 6 MULTI_VERSION_SPARSE_MINOR_SSTABLE 7 MINI_MINOR_SSTABLE 8 BUF_MINOR_SSTABLE 查看有百分之多少的宏块使用小于 100k。
obclient> select (select count(*) from oceanbase.__all_virtual_partition_sstable_macro_info where occupy_size < 100000)/(select count(*) from oceanbase.__all_virtual_partition_sstable_macro_info)*100;
解决方法
删表让合并进行下去。较大数据量的表,应该采用分区表。