Skip to content

Commit

Permalink
MB-49874 - bleveMaxClauseCount reset to 1024 after restart
Browse files Browse the repository at this point in the history
Introducing new "OnRefreshManagerOptions" callback to
the ManagerEventHandlers interface so that clients can
get notified of any runtime config updates.

Change-Id: If177db5d4d2d6c25174ecb3492f406419e6e5892
Reviewed-on: https://review.couchbase.org/c/cbgt/+/169392
Well-Formed: Build Bot <build@couchbase.com>
Reviewed-by: Abhinav Dangeti <abhinav@couchbase.com>
Tested-by: Abhinav Dangeti <abhinav@couchbase.com>
  • Loading branch information
sreekanth-cb authored and abhinavdangeti committed Jan 25, 2022
1 parent 121f21d commit d30a0f4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions manager.go
Expand Up @@ -216,6 +216,7 @@ type ManagerEventHandlers interface {
OnRegisterPIndex(pindex *PIndex)
OnUnregisterPIndex(pindex *PIndex)
OnFeedError(srcType string, r Feed, err error)
OnRefreshManagerOptions(options map[string]string)
}

// NewManager returns a new, ready-to-be-started Manager instance.
Expand Down Expand Up @@ -1248,6 +1249,11 @@ func (mgr *Manager) RefreshOptions() error {
mgr.options = newOptions
log.Printf("manager: RefreshOptions: %+v finished", mgr.options)
mgr.optionsMutex.Unlock()
// invoke any manager option refresh callbacks.
if mgr.meh != nil {
mgr.meh.OnRefreshManagerOptions(newOptions)
}

return err
}

Expand Down
3 changes: 3 additions & 0 deletions manager_test.go
Expand Up @@ -44,6 +44,9 @@ func (meh *TestMEH) OnFeedError(srcType string, r Feed,
err error) {
}

func (meh *TestMEH) OnRefreshManagerOptions(o map[string]string) {
}

func TestPIndexPath(t *testing.T) {
m := NewManager(VERSION, nil, NewUUID(), nil,
"", 1, "", "", "dir", "svr", nil)
Expand Down
3 changes: 3 additions & 0 deletions rest/rest_test.go
Expand Up @@ -79,6 +79,9 @@ func (meh *TestMEH) OnUnregisterPIndex(pindex *cbgt.PIndex) {
func (meh *TestMEH) OnFeedError(srcType string, r cbgt.Feed, err error) {
}

func (meh *TestMEH) OnRefreshManagerOptions(o map[string]string) {
}

func TestNewRESTRouter(t *testing.T) {
emptyDir, _ := ioutil.TempDir("./tmp", "test")
defer os.RemoveAll(emptyDir)
Expand Down

0 comments on commit d30a0f4

Please sign in to comment.