Skip to content

Make separate mids, rids and params blocks#8

Merged
eguguchkin merged 1 commit into
mainfrom
281-fix-ids-names
Jul 31, 2025
Merged

Make separate mids, rids and params blocks#8
eguguchkin merged 1 commit into
mainfrom
281-fix-ids-names

Conversation

@ssnd
Copy link
Copy Markdown
Contributor

@ssnd ssnd commented Jul 18, 2025

Summary by CodeRabbit

  • Refactor

    • Improved internal handling and caching of ID blocks for sealed indexes, resulting in a more modular and maintainable codebase.
    • Replaced and reorganized ID loader and cache logic with a new provider and table abstraction.
    • Updated types for cached parameters to use more specific structures, enhancing data consistency.
    • Simplified data provider construction and consolidated ID and position data into unified block structures.
    • Enhanced version-aware unpacking logic and error handling for ID blocks.
  • Bug Fixes

    • Enhanced error handling and validation when reading and unpacking ID blocks.
  • Chores

    • Removed obsolete files and tests related to the previous ID loader implementation.

@ssnd ssnd requested review from eguguchkin and forshev July 21, 2025 10:55
@ssnd ssnd added this to the v0.58.0 milestone Jul 21, 2025
Comment thread frac/sealed_index.go Outdated
@eguguchkin eguguchkin removed this from the v0.58.0 milestone Jul 30, 2025
@eguguchkin eguguchkin force-pushed the 281-move-ids-into-pkg branch 2 times, most recently from cfd2f6e to 2f4c4dc Compare July 30, 2025 14:36
@eguguchkin eguguchkin removed their request for review July 30, 2025 20:04
Base automatically changed from 281-move-ids-into-pkg to main July 31, 2025 10:12
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jul 31, 2025

Walkthrough

This set of changes refactors the handling of sequence ID blocks in the codebase. It replaces the old IDsLoader/IDsTable abstractions with new Table, Loader, and Provider types in the seqids package. Block data is now managed via more granular block types (BlockMIDs, BlockRIDs, BlockParams), and caches are updated to use these types. The control flow for reading, caching, and providing IDs is restructured, and related test files and legacy loader code are removed.

Changes

Cohort / File(s) Change Summary
Sealed ID Block Abstractions Refactor
frac/sealed/seqids/blocks.go, frac/sealed/seqids/loader.go, frac/sealed/seqids/provider.go
Introduces new granular block types (BlockMIDs, BlockRIDs, BlockParams), a Table abstraction for ID block metadata, a Loader for reading/caching blocks, and a Provider for unified ID access. Implements version-aware unpacking and error handling.
Removal of Legacy Loader and Tests
frac/sealed/seqids/sealed_ids.go, frac/sealed/seqids/sealed_ids_test.go
Deletes the old IDsLoader/IDsTable implementation and its associated tests, removing tightly coupled caching and unpacking logic.
Unpack Cache Simplification
frac/sealed/seqids/unpack_cache.go
Refactors and simplifies the unpack cache: renames and unexports it, removes decoding/unpacking logic, updates method signatures to use uint32 IDs, and removes unused imports.
Sealed Index and Data Provider Refactor
frac/sealed_index.go, frac/sealed.go
Refactors sealed index and data provider to use new Provider and Table abstractions, removes direct loader and caches, updates error handling to panic with detailed logs, and adjusts method implementations accordingly.
Disk Block Handling Update
frac/disk_blocks.go, frac/disk_blocks_producer.go, frac/disk_blocks_writer.go
Introduces a new local idsBlock struct combining MIDs, RIDs, and Params. Refactors generators and writers to use this struct and the new block types, consolidating ID and position data handling.
Index Cache and Cache Maintainer Update
frac/index_cache.go, fracmanager/cache_maintainer.go
Changes the type of the Params cache from []uint64 to BlockParams in both index cache and cache maintainer logic, updating imports accordingly.
Sealed Loader and Active Sealer Table Update
frac/sealed_loader.go, frac/active_sealer.go
Updates loader and sealer to use the new Table type and revised field names for ID block metadata, replacing DiskStartBlockIndex with StartBlockIndex.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Sealed
  participant seqids.Provider
  participant seqids.Loader
  participant disk.IndexReader
  participant Cache

  Client->>Sealed: Request MID/RID/DocPos for LID
  Sealed->>seqids.Provider: MID/RID/DocPos(LID)
  seqids.Provider->>Cache: Check block in cache
  alt Not in cache
    seqids.Provider->>seqids.Loader: Load block (MIDs/RIDs/Params)
    seqids.Loader->>disk.IndexReader: Read block from disk
    seqids.Loader->>Cache: Store block in cache
  end
  seqids.Provider->>Sealed: Return MID/RID/DocPos
  Sealed->>Client: Return result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

Oh, what a hop through the fields of code,
Where IDs and blocks in new patterns flowed.
Old caches and loaders, now gone with the breeze,
New tables and providers bring rabbits much ease.
With Params and MIDs in a shiny new shell,
This bunny declares: "All is refactored well!" 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 281-fix-ids-names

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 31, 2025

Codecov Report

❌ Patch coverage is 74.57045% with 74 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.53%. Comparing base (1e478b7) to head (aee1b0c).
⚠️ Report is 190 commits behind head on main.

Files with missing lines Patch % Lines
frac/sealed/seqids/loader.go 54.54% 20 Missing and 10 partials ⚠️
frac/sealed/seqids/provider.go 74.28% 12 Missing and 6 partials ⚠️
frac/sealed/seqids/blocks.go 70.90% 12 Missing and 4 partials ⚠️
frac/sealed_index.go 76.74% 6 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #8      +/-   ##
==========================================
- Coverage   73.70%   73.53%   -0.17%     
==========================================
  Files         191      192       +1     
  Lines       15807    15873      +66     
==========================================
+ Hits        11651    11673      +22     
- Misses       3582     3611      +29     
- Partials      574      589      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
frac/sealed/seqids/loader.go (1)

82-104: Consider consistent error checking pattern

The empty block check occurs after unpacking, while in GetMIDsBlock and GetRIDsBlock it happens before unpacking. Consider moving the empty check before unpacking for consistency, or document why this method needs different behavior.

 func (l *Loader) GetParamsBlock(index uint32) (BlockParams, error) {
 	// load binary from index
 	block, err := l.cacheParams.GetWithError(index, func() (BlockParams, int, error) {
 		data, _, err := l.reader.ReadIndexBlock(l.paramsBlockIndex(index), nil)
 		if err != nil {
 			return BlockParams{}, 0, err
 		}
+		// check for empty data before unpacking
+		if len(data) == 0 {
+			return BlockParams{}, 0, errors.New("empty block")
+		}
 		// unpack
 		block := BlockParams{Values: make([]uint64, 0, consts.IDsPerBlock)}
 		if err = block.Unpack(data); err != nil {
 			return BlockParams{}, 0, err
 		}
-		if len(block.Values) == 0 {
-			return BlockParams{}, 0, errors.New("empty block")
-		}
 		return block, cap(block.Values) * 8, nil
 	})
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e478b7 and dca4e31.

📒 Files selected for processing (15)
  • frac/active_sealer.go (1 hunks)
  • frac/disk_blocks.go (1 hunks)
  • frac/disk_blocks_producer.go (1 hunks)
  • frac/disk_blocks_writer.go (2 hunks)
  • frac/index_cache.go (1 hunks)
  • frac/sealed.go (3 hunks)
  • frac/sealed/seqids/blocks.go (1 hunks)
  • frac/sealed/seqids/loader.go (1 hunks)
  • frac/sealed/seqids/provider.go (1 hunks)
  • frac/sealed/seqids/sealed_ids.go (0 hunks)
  • frac/sealed/seqids/sealed_ids_test.go (0 hunks)
  • frac/sealed/seqids/unpack_cache.go (1 hunks)
  • frac/sealed_index.go (8 hunks)
  • frac/sealed_loader.go (2 hunks)
  • fracmanager/cache_maintainer.go (2 hunks)
💤 Files with no reviewable changes (2)
  • frac/sealed/seqids/sealed_ids_test.go
  • frac/sealed/seqids/sealed_ids.go
🧰 Additional context used
🧬 Code Graph Analysis (2)
frac/sealed/seqids/loader.go (1)
cmd/distribution/main.go (1)
  • buildDist (87-143)
frac/sealed_index.go (1)
cmd/distribution/main.go (1)
  • buildDist (87-143)
🪛 GitHub Check: lint
frac/sealed/seqids/loader.go

[failure] 91-91:
sloppyReassign: re-assignment to err can be replaced with err := block.Unpack(data) (gocritic)


[failure] 76-76:
sloppyReassign: re-assignment to err can be replaced with err := block.Unpack(data) (gocritic)


[failure] 52-52:
sloppyReassign: re-assignment to err can be replaced with err := block.Unpack(data) (gocritic)

frac/sealed_index.go

[failure] 335-335:
importShadow: shadow of imported from 'github.com/ozontech/seq-db/frac/sealed/lids' package 'lids' (gocritic)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test
🔇 Additional comments (18)
frac/index_cache.go (1)

6-6: LGTM! Type refactoring aligns with the broader seqids package restructuring.

The addition of the seqids import and the change from []uint64 to seqids.BlockParams for the Params field provides better type safety and encapsulation. This change is consistent with the overall refactoring that introduces more granular block types.

Also applies to: 14-14

fracmanager/cache_maintainer.go (1)

14-14: LGTM! Cache type update maintains consistency with the seqids refactoring.

The import addition and the type change from []uint64 to seqids.BlockParams in the CreateIndexCache method ensures that the cache maintainer creates caches compatible with the new block types introduced in the seqids package.

Also applies to: 150-150

frac/active_sealer.go (1)

210-215: LGTM! Type and field name updates align with the seqids refactoring.

The change from seqids.IDsTable to seqids.Table and the field name update from DiskStartBlockIndex to StartBlockIndex are consistent with the broader refactoring. The simplified field name is more concise while maintaining clarity.

frac/sealed_loader.go (1)

75-75: LGTM! Method signature and field name updates maintain consistency.

The change from seqids.IDsTable to seqids.Table in the return type and the field name update from DiskStartBlockIndex to StartBlockIndex are consistent with the broader refactoring. The core logic for reading and decoding the index block remains unchanged and correct.

Also applies to: 102-102

frac/disk_blocks.go (3)

7-9: LGTM! Import additions support the new idsBlock functionality.

The addition of seqids and seq package imports is necessary to support the new idsBlock struct and its methods.


12-16: LGTM! New idsBlock struct provides unified container for block types.

The idsBlock struct effectively consolidates the three separate block types (BlockMIDs, BlockRIDs, BlockParams) into a single container, which simplifies block generation and writing logic as mentioned in the AI summary.


26-29: LGTM! GetExtForRegistry method correctly extracts registry extensions.

The method properly delegates to GetMinID() and extracts the MID and RID components as uint64 values for registry use.

frac/disk_blocks_writer.go (1)

77-104: LGTM! Clean refactoring to use the new block structure.

The changes correctly adapt to the new idsBlock structure by accessing individual fields (mids, rids, params) and calling their respective Pack methods. The control flow and error handling remain intact.

frac/sealed.go (2)

41-41: Type rename looks good.

The change from seqids.IDsTable to seqids.Table is consistent across both the Sealed and PreloadedData structs.

Also applies to: 126-126


364-372: Good consolidation into the Provider pattern.

The refactoring nicely consolidates the previous separate caches and loader into a single seqids.Provider abstraction. This simplifies the data provider creation and better encapsulates the ID management logic.

frac/disk_blocks_producer.go (2)

55-68: Verify that the push callback doesn't store the block pointer.

The refactoring to reuse a single block variable is efficient, but there's a potential issue: if the push callback stores the pointer instead of copying the block's data, all stored blocks would reference the same object with the last iteration's data.

Please ensure that the push implementation in writeIDsBlocks (from disk_blocks_writer.go) properly extracts and stores the data rather than keeping references to the block.


71-80: Clean implementation of fillIDsBlock.

The method correctly:

  1. Clears existing values by reslicing to 0
  2. Extracts MID and RID components from seq.ID
  3. Retrieves positions from DocsPositions
  4. Populates the respective value slices
frac/sealed/seqids/unpack_cache.go (1)

9-13: Good encapsulation and appropriate type sizing.

The changes improve the design:

  • Making the struct unexported provides better encapsulation
  • Using int for blockIndex and uint32 for LID is more appropriate than the previous types
  • Simplifying to just cache functionality aligns with the separation of concerns

Also applies to: 43-45

frac/sealed/seqids/blocks.go (2)

10-30: Well-implemented delta encoding for MIDs.

The BlockMIDs implementation correctly uses varint delta encoding, which is efficient for sequential message IDs. Good error handling propagation from the unpack helper.


79-101: Helper functions are well-implemented.

Good error handling in unpackRawIDsVarint. Consider adding the same length validation to unpackRawIDsNoVarint that was suggested for BlockRIDs.Unpack.

frac/sealed/seqids/loader.go (1)

3-11: Fix import ordering

The imports should be grouped and ordered according to Go conventions: standard library, then external packages, then internal packages.

 import (
 	"errors"
 
 	"github.com/ozontech/seq-db/cache"
 	"github.com/ozontech/seq-db/conf"
 	"github.com/ozontech/seq-db/consts"
 	"github.com/ozontech/seq-db/disk"
 	"github.com/ozontech/seq-db/seq"
 )

Likely an incorrect or invalid review comment.

frac/sealed/seqids/provider.go (1)

98-112: Well-documented memory safety consideration

The comment clearly explains why copying block.Values is necessary to prevent data corruption from sync.Pool reuse. The implementation correctly uses append to create a new backing array.

frac/sealed_index.go (1)

158-180: Consider propagating errors instead of panicking

The new implementation panics on errors in GetMID, GetRID, and docPos methods. While the detailed logging context is helpful, panicking should be reserved for truly unrecoverable situations. Consider whether these errors could be propagated to callers for more graceful handling.

If panicking is indeed the desired behavior due to the critical nature of these operations, please document why error propagation is not feasible in this context.

Comment thread frac/disk_blocks.go
Comment thread frac/sealed_index.go Outdated
Comment thread frac/sealed/seqids/blocks.go
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
frac/sealed/seqids/blocks.go (1)

32-55: Add validation for fixed-size unpacking.

The BlockRIDs implementation handles version compatibility well, but the fixed-size unpacking should validate the input data length to prevent potential panics.

Add validation to ensure data length is a multiple of 8:

 func (b *BlockRIDs) Unpack(data []byte) error {
 	if b.fracVersion < conf.BinaryDataV1 {
 		values, err := unpackRawIDsVarint(data, b.Values)
 		if err != nil {
 			return err
 		}
 		b.Values = values
 		return nil
 	}
+	if len(data)%8 != 0 {
+		return errors.New("invalid data length for fixed-size unpacking")
+	}
 	b.Values = unpackRawIDsNoVarint(data, b.Values)
 	return nil
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dca4e31 and 26f8c1f.

📒 Files selected for processing (15)
  • frac/active_sealer.go (1 hunks)
  • frac/disk_blocks.go (1 hunks)
  • frac/disk_blocks_producer.go (1 hunks)
  • frac/disk_blocks_writer.go (2 hunks)
  • frac/index_cache.go (1 hunks)
  • frac/sealed.go (3 hunks)
  • frac/sealed/seqids/blocks.go (1 hunks)
  • frac/sealed/seqids/loader.go (1 hunks)
  • frac/sealed/seqids/provider.go (1 hunks)
  • frac/sealed/seqids/sealed_ids.go (0 hunks)
  • frac/sealed/seqids/sealed_ids_test.go (0 hunks)
  • frac/sealed/seqids/unpack_cache.go (1 hunks)
  • frac/sealed_index.go (8 hunks)
  • frac/sealed_loader.go (2 hunks)
  • fracmanager/cache_maintainer.go (2 hunks)
💤 Files with no reviewable changes (2)
  • frac/sealed/seqids/sealed_ids_test.go
  • frac/sealed/seqids/sealed_ids.go
🚧 Files skipped from review as they are similar to previous changes (10)
  • frac/index_cache.go
  • fracmanager/cache_maintainer.go
  • frac/active_sealer.go
  • frac/sealed.go
  • frac/disk_blocks_writer.go
  • frac/sealed_loader.go
  • frac/sealed/seqids/loader.go
  • frac/disk_blocks.go
  • frac/sealed/seqids/provider.go
  • frac/sealed_index.go
🧰 Additional context used
🧬 Code Graph Analysis (3)
frac/disk_blocks_producer.go (1)
seq/seq.go (3)
  • ID (12-15)
  • MID (17-17)
  • RID (18-18)
frac/sealed/seqids/blocks.go (1)
conf/frac_version.go (2)
  • BinaryDataVersion (3-3)
  • BinaryDataV1 (9-9)
frac/sealed/seqids/unpack_cache.go (2)
consts/consts.go (1)
  • IDsPerBlock (14-14)
frac/sealed/seqids/sealed_ids_test.go (1)
  • TestUnpackRIDs (19-53)
🔇 Additional comments (9)
frac/sealed/seqids/unpack_cache.go (4)

9-13: LGTM! Struct simplification aligns with new architecture.

The changes to make the struct unexported and simplify field types are appropriate for the new design where unpacking logic is handled by dedicated block types.


15-15: LGTM! Pool variable rename is consistent.

The rename from unpackCachePool to cachePool is cleaner and reflects the simplified purpose of the cache.


19-30: LGTM! Constructor simplification is appropriate.

The function rename to NewCache and return type change to *unpackCache are consistent with the struct changes and new architecture.


43-45: LGTM! Method signature updated correctly.

The parameter type change from uint64 to uint32 for lid is consistent with the startLID field type change and appears appropriate for the use case.

frac/disk_blocks_producer.go (2)

55-69: LGTM! Method refactoring is clean and correct.

The changes to use the local idsBlock type and the new fillIDsBlock method are well-structured and align with the broader architectural refactoring.


71-80: LGTM! Data extraction logic is correct.

The fillIDsBlock method correctly extracts MID, RID, and position data from the seq.ID slices and populates the three separate block fields. The slice reset pattern using [:0] is efficient for reusing underlying arrays.

frac/sealed/seqids/blocks.go (3)

10-30: LGTM! BlockMIDs implementation is correct.

The delta-varint encoding/decoding implementation is correct and includes proper error handling. The pack method efficiently encodes deltas, and the unpack method properly handles errors from the varint decoding.


57-77: LGTM! BlockParams implementation is correct.

The delta-varint encoding/decoding implementation mirrors BlockMIDs correctly and includes proper error handling for varint decoding failures.


79-92: LGTM! Varint unpacking helper is robust.

The unpackRawIDsVarint function correctly handles varint decoding with proper error handling for invalid varint data. The delta reconstruction logic is correct.

Comment thread frac/sealed/seqids/blocks.go
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
frac/sealed/seqids/loader.go (1)

82-104: Consider making GetParamsBlock consistent with other block methods.

The GetParamsBlock method differs from GetMIDsBlock and GetRIDsBlock in that it doesn't accept a buffer parameter. This inconsistency could lead to confusion and prevents buffer reuse optimization for params blocks.

Consider updating the method signature to match the pattern:

-func (l *Loader) GetParamsBlock(index uint32) (BlockParams, error) {
+func (l *Loader) GetParamsBlock(index uint32, buf []uint64) (BlockParams, error) {

And update the block creation to reuse the buffer:

-		block := BlockParams{Values: make([]uint64, 0, consts.IDsPerBlock)}
+		block := BlockParams{Values: buf}
frac/sealed/seqids/provider.go (3)

56-67: Use consistent table reference.

The method accesses p.loader.table on line 63, but the Provider has its own table field that points to the same instance. For consistency and clarity, use p.table instead.

-		dst.startLID = p.loader.table.BlockStartLID(blockIndex)
+		dst.startLID = p.table.BlockStartLID(blockIndex)

77-88: Use consistent table reference.

Similar to fillMIDs, this method should use p.table instead of p.loader.table for consistency.

-		dst.startLID = p.loader.table.BlockStartLID(blockIndex)
+		dst.startLID = p.table.BlockStartLID(blockIndex)

98-112: Use consistent table reference and good defensive copying.

The method correctly copies the block values to prevent corruption when the unpackCache releases values to sync.Pool. However, it should use p.table instead of p.loader.table for consistency.

-		dst.startLID = p.loader.table.BlockStartLID(blockIndex)
+		dst.startLID = p.table.BlockStartLID(blockIndex)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 26f8c1f and aee1b0c.

📒 Files selected for processing (15)
  • frac/active_sealer.go (1 hunks)
  • frac/disk_blocks.go (1 hunks)
  • frac/disk_blocks_producer.go (1 hunks)
  • frac/disk_blocks_writer.go (2 hunks)
  • frac/index_cache.go (1 hunks)
  • frac/sealed.go (3 hunks)
  • frac/sealed/seqids/blocks.go (1 hunks)
  • frac/sealed/seqids/loader.go (1 hunks)
  • frac/sealed/seqids/provider.go (1 hunks)
  • frac/sealed/seqids/sealed_ids.go (0 hunks)
  • frac/sealed/seqids/sealed_ids_test.go (0 hunks)
  • frac/sealed/seqids/unpack_cache.go (1 hunks)
  • frac/sealed_index.go (8 hunks)
  • frac/sealed_loader.go (2 hunks)
  • fracmanager/cache_maintainer.go (2 hunks)
💤 Files with no reviewable changes (2)
  • frac/sealed/seqids/sealed_ids_test.go
  • frac/sealed/seqids/sealed_ids.go
🚧 Files skipped from review as they are similar to previous changes (11)
  • frac/index_cache.go
  • frac/sealed_loader.go
  • fracmanager/cache_maintainer.go
  • frac/disk_blocks_writer.go
  • frac/disk_blocks.go
  • frac/active_sealer.go
  • frac/disk_blocks_producer.go
  • frac/sealed/seqids/unpack_cache.go
  • frac/sealed/seqids/blocks.go
  • frac/sealed.go
  • frac/sealed_index.go
🧰 Additional context used
🧬 Code Graph Analysis (1)
frac/sealed/seqids/loader.go (6)
consts/consts.go (1)
  • IDsPerBlock (14-14)
disk/index_reader.go (1)
  • IndexReader (14-18)
cache/cache.go (1)
  • Cache (60-68)
frac/sealed/seqids/blocks.go (3)
  • BlockParams (57-59)
  • BlockMIDs (10-12)
  • BlockRIDs (32-35)
conf/frac_version.go (1)
  • BinaryDataVersion (3-3)
frac/sealed/seqids/sealed_ids.go (1)
  • NewIDsLoader (30-44)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test
🔇 Additional comments (1)
frac/sealed/seqids/loader.go (1)

13-26: LGTM!

The Table struct and its methods correctly implement block index calculations. The use of value receivers is appropriate for these read-only operations.

@eguguchkin eguguchkin merged commit bf932a2 into main Jul 31, 2025
5 checks passed
@eguguchkin eguguchkin deleted the 281-fix-ids-names branch July 31, 2025 10:49
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.

4 participants