Skip to content

MB-61890 - Introducing config for zap layer#2066

Open
Thejas-bhat wants to merge 4 commits intomasterfrom
zapConfig
Open

MB-61890 - Introducing config for zap layer#2066
Thejas-bhat wants to merge 4 commits intomasterfrom
zapConfig

Conversation

@Thejas-bhat
Copy link
Member

@Thejas-bhat Thejas-bhat commented Aug 29, 2024

  • Currently there isn't a concept of config at the zap layer and whatever storage level configurations present (at various points of index lifetime) are global variables. This forces all indexes' segments to use same values irrespective of how heavy indexes are.
  • The PR introduces segmentConfig that can be used to pass index specific config values for the zap level. This would help in the future to perform any index specific tuning at the zap level.
  • This involves extending the existing interface's Merge, Open and New APIs.
  • The segmentConfig is something that's constructed by parsing the scorch.config and persisted in the index_meta.json file.

@Thejas-bhat Thejas-bhat marked this pull request as ready for review August 29, 2024 14:50
@metonymic-smokey metonymic-smokey changed the title Introducing config for zap layer MB-61890 - Introducing config for zap layer Sep 5, 2024
@abhinavdangeti abhinavdangeti added this to the v2.5.0 milestone Sep 5, 2024
@abhinavdangeti abhinavdangeti removed the request for review from moshaad7 October 17, 2024 17:49
@abhinavdangeti abhinavdangeti modified the milestones: v2.5.0, v2.5.1 Feb 25, 2025
@abhinavdangeti abhinavdangeti modified the milestones: v2.5.1, v2.5.2 Apr 16, 2025
@abhinavdangeti abhinavdangeti modified the milestones: v2.5.2, v2.5.3 May 22, 2025
@abhinavdangeti abhinavdangeti modified the milestones: v2.5.3, v2.6.0 Jul 21, 2025
@abhinavdangeti abhinavdangeti removed this from the v2.6.0 milestone Nov 13, 2025
@Thejas-bhat Thejas-bhat requested review from capemox and maneuvertomars and removed request for metonymic-smokey January 15, 2026 22:47
@abhinavdangeti abhinavdangeti added this to the v2.6.0 milestone Jan 26, 2026
Copy link
Member

@abhinavdangeti abhinavdangeti left a comment

Choose a reason for hiding this comment

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

It seems this commit makes it clear that you'll need to introduce new APIs (blevesearch/zapx#256) to all versions of zapx.

prevBytesReadTotal := cumulateBytesRead(segmentsToMerge)
newDocNums, _, err := s.segPlugin.Merge(segmentsToMerge, docsToDrop, path,
cw.cancelCh, s)
newDocNums, _, err := s.segPlugin.MergeEx(segmentsToMerge, docsToDrop, path,
Copy link
Member

Choose a reason for hiding this comment

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

Naming will need updates in parlance with comments on blevesearch/zapx#256.

CascadingRadium
CascadingRadium previously approved these changes Feb 4, 2026
Copy link
Member

@abhinavdangeti abhinavdangeti left a comment

Choose a reason for hiding this comment

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

Looks fine, but let's wait to get all the zapx version commits in before we take this.

@coveralls
Copy link

Coverage Status

coverage: 52.68% (+0.03%) from 52.648%
when pulling b087625 on zapConfig
into 15049fc on master.

// New takes a set of Documents and turns them into a new Segment
New(results []index.Document) (segment.Segment, uint64, error)

NewUsing(results []index.Document, config map[string]interface{}) (segment.Segment, uint64, error)
Copy link
Member

@capemox capemox Feb 11, 2026

Choose a reason for hiding this comment

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

Rather than define new functions for the interface, can create a new interface like SegmentPluginWithConfig with the new methods. You don't need to change the existing zap versions, and you can use comma-ok idioms to fallback on the existing implementation.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think having a new interface with just the *Using APIs would probably force us to maintain a separate plugin and possibly a new registry for the same. Also, the config is supposed to be passed around and useful for the existing paths in scorch where the zap APIs are called - so we could've just updated existing APIs that were there but just to keep the backward compatibility for users of the zap package independently I don't suppose we could do that. The segment plugin definitely needs to be refactor'd though since its messy, and we can talk about it as part of a separate github issue or so?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

5 participants