Skip to content

fix(collections/indexes): handle iterator close errors in index helpers#25942

Open
songgaoye wants to merge 13 commits intocosmos:mainfrom
songgaoye:fix_iter_close
Open

fix(collections/indexes): handle iterator close errors in index helpers#25942
songgaoye wants to merge 13 commits intocosmos:mainfrom
songgaoye:fix_iter_close

Conversation

@songgaoye
Copy link
Copy Markdown
Contributor

@songgaoye songgaoye commented Feb 16, 2026

Description

Previously, iterator Close() errors were silently ignored in index helper
functions, which could lead to resource leaks (file descriptors, memory).
This change properly captures and returns close errors when no other error
has occurred, following the standard Go pattern for deferred cleanup.

Fixed functions:

  • indexes.ScanKeyValues
  • indexes.ScanValues
  • indexes.ReversePairIterator.PrimaryKeys

Closes: #XXXX

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 84.90566% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.07%. Comparing base (3ca76ce) to head (90e7a8f).

Files with missing lines Patch % Lines
collections/indexes/helpers.go 84.00% 4 Missing ⚠️
collections/iter.go 87.50% 3 Missing ⚠️
collections/indexes/reverse_pair.go 75.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #25942      +/-   ##
==========================================
+ Coverage   64.87%   65.07%   +0.19%     
==========================================
  Files         890      907      +17     
  Lines       58583    60116    +1533     
==========================================
+ Hits        38008    39118    +1110     
- Misses      20575    20998     +423     
Files with missing lines Coverage Δ
collections/indexes/reverse_pair.go 91.42% <75.00%> (ø)
collections/iter.go 86.74% <87.50%> (ø)
collections/indexes/helpers.go 92.15% <84.00%> (ø)

... and 52 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days-before-close if no further activity occurs.

@songgaoye songgaoye requested a review from a team as a code owner April 25, 2026 14:08
@songgaoye
Copy link
Copy Markdown
Contributor Author

@aljo242 can you help review it? Thank you!

@aljo242 aljo242 enabled auto-merge May 4, 2026 17:13
auto-merge was automatically disabled May 5, 2026 03:04

Head branch was pushed to by a user without write access

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.

2 participants