Skip to content

Commit

Permalink
Merge remote-tracking branch 'couchbase/unstable' into HEAD
Browse files Browse the repository at this point in the history
http: //ci2i-unstable.northscale.in/gsi-12.02.2021-05.30.pass.html
Change-Id: Ic9613af36700728e1cd6b4aabf52892a6bdd209c
  • Loading branch information
jeelanp2003 committed Feb 12, 2021
2 parents 7e3f79f + 18025bc commit c58f3d7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion secondary/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ var SystemConfig = Config{
120, // value
"timeout, in seconds, is timeout for REST calls in GetWithCbauth Function of Index Planner.", //help
120, // default
false, // immutable
false, // mutable
false, // case-insensitive
},
"indexer.allowPartialQuorum": ConfigValue{
Expand Down
13 changes: 9 additions & 4 deletions secondary/indexer/ddl_service_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ type ddlSettings struct {

storageMode string
mutex sync.RWMutex

allowPartialQuorum uint32
}

//////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1360,7 +1362,7 @@ func (m *DDLServiceMgr) handleListDeleteTokens(w http.ResponseWriter, r *http.Re
// for logging. listerFunc is the function in token.go to get the path list
// from metakv for the specific token type desired.
func (m *DDLServiceMgr) handleListGenericTokenPaths(w http.ResponseWriter,
r *http.Request, callerName string, listerFunc func()([]string, error)) {
r *http.Request, callerName string, listerFunc func() ([]string, error)) {

if !m.validateAuth(w, r) {
logging.Errorf("DDLServiceMgr::handleListGenericTokenPaths Validation Failure caller: %v, req: %v", callerName, common.GetHTTPReqInfo(r))
Expand Down Expand Up @@ -1812,10 +1814,8 @@ func (s *ddlSettings) UsePlanner() bool {
return true
}

// DDLServiceMgr does not trigger recoverableCreateIndex for index creation.
// So, this setting will not be used by DDLServiceMgr.
func (s *ddlSettings) AllowPartialQuorum() bool {
return false
return atomic.LoadUint32(&s.allowPartialQuorum) == 1
}

func (s *ddlSettings) AllowScheduleCreate() bool {
Expand Down Expand Up @@ -1850,6 +1850,11 @@ func (s *ddlSettings) handleSettings(config common.Config) {
s.storageMode = storageMode
}()
}

allowPartialQuorum := config["allowPartialQuorum"].Bool()
if allowPartialQuorum {
atomic.StoreUint32(&s.allowPartialQuorum, 1)
}
}

//
Expand Down
13 changes: 12 additions & 1 deletion secondary/indexer/sched_index_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"sort"
"strings"
"sync"
"sync/atomic"
"syscall"
"time"
"unsafe"
Expand Down Expand Up @@ -156,7 +157,17 @@ func NewSchedIndexCreator(indexerId common.IndexerId, supvCmdch MsgChannel,

addr := config["clusterAddr"].String()
numReplica := int32(config["settings.num_replica"].Int())
settings := &ddlSettings{numReplica: numReplica}
numPartition := int32(config["numPartitions"].Int())

settings := &ddlSettings{
numReplica: numReplica,
numPartition: numPartition,
}

allowPartialQuorum := config["allowPartialQuorum"].Bool()
if allowPartialQuorum {
atomic.StoreUint32(&settings.allowPartialQuorum, 1)
}

iq := make(schedIndexQueue, 0)
heap.Init(&iq)
Expand Down
8 changes: 4 additions & 4 deletions secondary/manager/common/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,14 @@ func FetchIndexDefnToCreateCommandTokensMap() (map[c.IndexDefnId][]*CreateComman
for _, path := range paths {
defnID, requestID, err := GetDefnIdFromCreateCommandTokenPath(path)
if err != nil {
logging.Warnf("FetchIndexDefnToCreateCommandTokenMap: Failed to process create index token %v. Internal Error = %v.", path, err)
continue
logging.Errorf("FetchIndexDefnToCreateCommandTokenMap: Failed to process create index token %v. Internal Error = %v.", path, err)
return nil, err
}

token, err := FetchCreateCommandToken(defnID, requestID)
if err != nil {
logging.Warnf("FetchIndexDefnToCreateCommandTokenMap: Failed to process create index token %v. Internal Error = %v.", path, err)
continue
logging.Errorf("FetchIndexDefnToCreateCommandTokenMap: Failed to process create index token %v. Internal Error = %v.", path, err)
return nil, err
}

if token != nil {
Expand Down

0 comments on commit c58f3d7

Please sign in to comment.