Skip to content

[BUG] Row binlog tablet schema missing __DORIS_BINLOG_LSN__ column index causing coredump when creating rowset writer #64483

@heguanhui

Description

@heguanhui

Search before asking

  • I had searched in the issues and found no similar issues.

Version

newest master branch

What's Wrong?

Problem Description

When creating a row binlog table and writing data, a coredump occurs in RowBinlogSegmentWriter::init() with the following CHECK failure:
[----------] 2 tests from GroupRowsetWriterTest
19:13:27 [ RUN ] GroupRowsetWriterTest.sub_writer_rollback
19:13:27 F20260613 19:13:27.347458 362558 row_binlog_segment_writer.cpp:69] Check failed: lsn_col_id >= 0 binlog schema missing DORIS_BINLOG_LSN
19:13:27 *** Check failure stack trace: ***
19:13:27 @ 0x55812f5cd876 google::LogMessageFatal::~LogMessageFatal()
19:13:27 @ 0x55812bcd1f9e doris::segment_v2::RowBinlogSegmentWriter::init()
19:13:27 @ 0x55812b79d73e doris::SegmentFlusher::_create_segment_writer()
19:13:27 @ 0x55812b798030 doris::SegmentFlusher::flush_single_block()
19:13:27 @ 0x55812b7a18f1 doris::SegmentCreator::flush_single_block()
19:13:27 @ 0x55812b6dfaae doris::SegmentCreator::flush_single_block()
19:13:27 @ 0x55812b69e591 doris::BaseBetaRowsetWriter::flush_single_block()
19:13:28 @ 0x55812b6f4e2f doris::GroupRowsetWriter::flush_single_block()
19:13:28 @ 0x558114c3a9f7 doris::GroupRowsetWriterTest_sub_writer_rollback_Test::TestBody()
19:13:28 @ 0x55812fcc2f94 testing::internal::HandleSehExceptionsInMethodIfSupported<>()
19:13:28 @ 0x55812fcb1db6 testing::internal::HandleExceptionsInMethodIfSupported<>()
19:13:28 @ 0x55812fc941c7 testing::Test::Run()
19:13:28 @ 0x55812fc94cec testing::TestInfo::Run()
19:13:28 @ 0x55812fc954b2 testing::TestSuite::Run()
19:13:28 @ 0x55812fca6ccc testing::internal::UnitTestImpl::RunAllTests()
19:13:28 @ 0x55812fcc4dc4 testing::internal::HandleSehExceptionsInMethodIfSupported<>()
19:13:28 @ 0x55812fcb3e46 testing::internal::HandleExceptionsInMethodIfSupported<>()
19:13:28 @ 0x55812fca684b testing::UnitTest::Run()
19:13:29 @ 0x558117a84401 RUN_ALL_TESTS()
19:13:29 @ 0x558117a79b0e main
19:13:29 @ 0x7f419b4b3555 __libc_start_main
19:13:29 @ 0x55810c4be02a _start
19:13:29 @ (nil) (unknown)
19:13:29 run-be-ut.sh: line 595: 362558 Aborted (core dumped) LLVM_PROFILE_FILE="${profraw}" "${test}" --gtest_output="xml:${GTEST_OUTPUT_DIR}/${file_name}.xml" --gtest_print_time=true "${FILTER}" "${GEN_OUT}" "${GEN_REGRESSION_CASE}"

Steps to Reproduce

  1. Run BE unit test:
    ./run-be-ut.sh --run GroupRowsetWriterTest.sub_writer_rollback
    

GDB Debug Info

(gdb) p this->_tablet_schema->_binlog_lsn_col_idx
$24 = -1
(gdb) p this->_tablet_schema->_binlog_timestamp_col_idx
$25 = -1
(gdb) p this->_tablet_schema->_num_columns
$26 = 5

The schema contains 5 columns (including 3 binlog special columns), but _binlog_lsn_col_idx is -1.

Steps to Reproduce

cd be/ut_build_dir
./run-be-ut.sh --run GroupRowsetWriterTest.sub_writer_rollback

### Root Cause
When converting TTabletSchema (Thrift) to TabletSchemaPB (Protobuf) via TabletMeta::init_schema_from_thrift(), the indices of binlog special columns (__DORIS_BINLOG_LSN__ and __DORIS_BINLOG_TIMESTAMP__) are not set in the protobuf.

As a result, when TabletSchema::init_from_pb() is called, _binlog_lsn_col_idx remains -1, causing the CHECK failure in RowBinlogSegmentWriter::init().

### Expected Behavior
_binlog_lsn_col_idx should be correctly set to the column index of __DORIS_BINLOG_LSN__ (which is 2 in the test case).


### What You Expected?

successfully executed run-be-ut.sh

### How to Reproduce?

execute run-be-ut.sh will certainly reproduce this problem

### Anything Else?

_No response_

### Are you willing to submit PR?

- [x] Yes I am willing to submit a PR!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions