Skip to content

Conversation

@wyb
Copy link
Contributor

@wyb wyb commented Nov 24, 2025

Why I'm doing:

query_id:00000000-0000-0000-0000-000000000000, fragment_instance:00000000-0000-0000-0000-000000000000
*** Aborted at 1763218936 (unix time) try "date -d @1763218936" if you are using GNU date ***
PC: @     0xff99a2202008 (/usr/lib/aarch64-linux-gnu/libc.so.6+0x82007)
*** SIGABRT (@0x3e800231281) received by PID 2298497 (TID 0xff993e4100c0) from PID 2298497; stack trace: ***
    @     0xff99a22053dc (/usr/lib/aarch64-linux-gnu/libc.so.6+0x853db)
    @          0xe481198 google::(anonymous namespace)::FailureSignalHandler(int, siginfo_t*, void*)
    @     0xff99a36588f8 ([vdso]+0x8f7)
    @     0xff99a2202008 (/usr/lib/aarch64-linux-gnu/libc.so.6+0x82007)
    @     0xff99a21ba83c raise
    @     0xff99a21a7134 abort
    @         0x105ac7cc __gnu_cxx::__verbose_terminate_handler()
    @         0x105aac6c __cxxabiv1::__terminate(void (*)())
    @         0x105aacd0 std::terminate()
    @         0x105aae64 __cxa_throw
    @         0x105ab3a8 operator new(unsigned long)
    @          0x77292b0 std::__cxx11::basic_string, std::allocator >::_M_assign(std::__cxx11::basic_string, std::allocator > const&)
    @          0xb0cbabc starrocks::TBrokerRangeDesc::TBrokerRangeDesc(starrocks::TBrokerRangeDesc const&)
    @          0xa5559b8 starrocks::FileScanner::sample_schema(starrocks::RuntimeState*, starrocks::TBrokerScanRange const&, std::vector >*)
    @          0xaa96680 starrocks::PInternalServiceImplBase::_get_file_schema(google::protobuf::RpcController*, starrocks::PGetFileSchemaRequest const*, starrocks::PGetFileSchemaResult*, google::protobuf::Closure*)
    @          0xac1fce4 starrocks::ThreadPool::dispatch_thread()
    @          0xac1658c starrocks::Thread::supervise_thread(void*)
    @     0xff99a2200398 (/usr/lib/aarch64-linux-gnu/libc.so.6+0x80397)
    @     0xff99a2269e9c (/usr/lib/aarch64-linux-gnu/libc.so.6+0xe9e9b)

What I'm doing:

sample scan range index is overflow when sample file count is smaller than total file count.

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.0
    • 3.5
    • 3.4
    • 3.3

Note

Revamps sample_files to a bounded incremental selection to avoid overflow and correctly handle sample >= total, and updates unit tests with cases where total files are fewer than requested samples.

  • Backend:
    • File sampling logic: Reworks FileScanner::sample_files to iterate with an incremental rounded index, ensuring indices stay within [0, total-1], always include the last file, and sample all files when sample_file_count >= total_file_count.
  • Tests:
    • FileScannerTest::select_sample_files: Adjusts expectations and adds coverage for cases where total_file_count < sample_file_count (e.g., 1/10, 2/8, 10/100).

Written by Cursor Bugbot for commit 8210152. This will update automatically on new commits. Configure here.

@wyb wyb requested a review from a team as a code owner November 24, 2025 10:04
@mergify mergify bot assigned wyb Nov 24, 2025
luohaha
luohaha previously approved these changes Nov 24, 2025
@github-actions github-actions bot added 3.3 and removed 3.3 labels Nov 24, 2025
@kevincai kevincai requested a review from Copilot November 24, 2025 11:24
kevincai
kevincai previously approved these changes Nov 24, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an index overflow bug in the file schema detection sampling logic that caused crashes (SIGABRT) when the requested sample file count exceeded the total number of available files.

Key Changes:

  • Modified the sampling algorithm to iterate based on total_file_count instead of sample_file_count, preventing index overflow
  • Added test cases to verify correct behavior when sample_file_count > total_file_count

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
be/src/exec/file_scanner/file_scanner.cpp Changed loop from iterating sample_file_count times to iterating while index is within bounds of total_file_count, fixing the overflow bug
be/test/exec/file_scanner/file_scanner_test.cpp Added two test cases to verify correct sampling behavior when sample count exceeds total file count

Signed-off-by: wyb <[email protected]>
@wyb wyb dismissed stale reviews from kevincai and luohaha via 8210152 November 24, 2025 11:52
@github-actions
Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions
Copy link

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions
Copy link

[BE Incremental Coverage Report]

pass : 6 / 6 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/exec/file_scanner/file_scanner.cpp 6 6 100.00% []

@alvin-celerdata
Copy link
Contributor

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no bugs!


@wyb wyb merged commit 5905aec into StarRocks:main Nov 25, 2025
87 of 90 checks passed
@github-actions
Copy link

@Mergifyio backport branch-3.5

@github-actions
Copy link

@Mergifyio backport branch-4.0

@github-actions github-actions bot removed the 3.5 label Nov 25, 2025
@github-actions github-actions bot removed the 4.0 label Nov 25, 2025
@github-actions
Copy link

@Mergifyio backport branch-3.4

@github-actions github-actions bot removed the 3.4 label Nov 25, 2025
@mergify
Copy link
Contributor

mergify bot commented Nov 25, 2025

backport branch-3.5

✅ Backports have been created

@mergify
Copy link
Contributor

mergify bot commented Nov 25, 2025

backport branch-4.0

🛑 Command backport branch-4.0 cancelled because of a new backport command with different arguments

@mergify
Copy link
Contributor

mergify bot commented Nov 25, 2025

backport branch-3.4

✅ Backports have been created

  • Backport to branch branch-3.4 not needed, change already in branch branch-3.4

mergify bot pushed a commit that referenced this pull request Nov 25, 2025
mergify bot pushed a commit that referenced this pull request Nov 25, 2025
wanpengfei-git pushed a commit that referenced this pull request Nov 25, 2025
@andyziye
Copy link
Collaborator

@mergify backport branch-4.0

@mergify
Copy link
Contributor

mergify bot commented Nov 25, 2025

backport branch-4.0

✅ Backports have been created

  • Backport to branch branch-4.0 not needed, change already in branch branch-4.0

wyb added a commit to wyb/starrocks that referenced this pull request Nov 25, 2025
wyb added a commit to wyb/starrocks that referenced this pull request Nov 25, 2025
wyb added a commit that referenced this pull request Nov 25, 2025
wyb added a commit that referenced this pull request Nov 25, 2025
dirtysalt pushed a commit to dirtysalt/starrocks that referenced this pull request Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants