-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CBGT: Single manager per SG instance #1087
Comments
@steveyen I ended up creating a separate pindex type for each bucket. Code snippet:
The reason being is that for each bucket, the Can you foresee any problems with having a separate pindex type for every index? |
Yeah, underneath the hood, the cbgt.RegisterPIndexImplType is just using a simple global lookup map, and it was not envisioned to be a thing that changes after process init()'lization. So there's no locking around it. And, code probably has additional assumptions that the lookup map is kinda small ("there shouldn't be too many PIndex types, right?"). :-) So, your approach is for sure an unanticipated usage approach. Gut intuition is that's like like rubbing the wood against the grain, and might result in splinter(s). Would recommend you just have a global lookup map from name to eventFeed channel somewhere in SGW code. That'll put you more into same kinda of usage territory as how the rest of the world (well, cbft) is using cbgt... which will help remove a set of future mental anguish (like, "hmmm, maybe this bug or issue is just because of how SGW's using the pindex types in a special way that no-one else is using?") |
@steveyen thanks. While this approach does seem to be working so far, and the map would be small, we'll look into the alternative approach you suggested. |
@tleyden - good to know. Has that feel of "wow! it works? cool!" :-) Also, one more thing to help tip you over the fence -- all nodes should ideally have the exact same PIndex impl type registrations. When they're kinda static (like the "bleve" pindex type, and "sync-gw" pindex type), then that's easy to ensure -- registrations are hardly ever changing (at the speed of new feature releases). When they're dynamic, like based on buckets that are coming & going on end user whims... that's harder to reason about what might happen in the planner, etc. |
@steveyen I ran into a snag during implementation. Here is the
We've moved the
But when the
This should work as long as If |
Answer: The Examples: https://github.com/couchbaselabs/cbmirror/blob/master/dcr_pindex.go#L44 https://github.com/couchbaselabs/cbft/blob/master/pindex_bleve.go#L144 |
Only cbgt.RegisterPIndexImplType once during server context init #1087
TODO:
|
Only cbgt.RegisterPIndexImplType once during server context init #1087
Only cbgt.RegisterPIndexImplType once during server context init #1087
Currently we are spinning up a new cbgt manager for each bucket, however there should be a single manager for the entire sync gateway process, and it should create indexes for each bucket.
The text was updated successfully, but these errors were encountered: