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-09.04.2021-13.37.pass.html
Change-Id: I23b657f95bda78184f433e45ffb5314c9e189f32
  • Loading branch information
jeelanp2003 committed Apr 9, 2021
2 parents 13d86ab + d909505 commit e7efbc9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
5 changes: 3 additions & 2 deletions secondary/common/metakv_gsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ package common
import (
"encoding/json"
"fmt"
"github.com/couchbase/cbauth/metakv"
"github.com/couchbase/indexing/secondary/logging"
"strconv"
"strings"

"github.com/couchbase/cbauth/metakv"
"github.com/couchbase/indexing/secondary/logging"
)

const (
Expand Down
14 changes: 14 additions & 0 deletions secondary/indexer/sched_index_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,20 @@ func (m *schedIndexCreator) tryCreateIndex(index *scheduledIndex) (error, bool)
return err, false
}

// check if ScheduleCreateToken still exists - drop index may have deleted ScheduleCreateToken
exists, err = mc.ScheduleCreateTokenExist(index.token.Definition.DefnId)
if err != nil {
logging.Errorf("schedIndexCreator:tryCreateIndex error (%v) in getting schedule create command token for %v",
err, index.token.Definition.DefnId)
return err, false
}

if !exists {
logging.Infof("schedIndexCreator:tryCreateIndex create command token does not exists for %v",
index.token.Definition.DefnId)
return nil, false
}

// Following check is an effort to check if index was created but the
// schedule create token was not deleted.
if provider.FindIndexIgnoreStatus(index.token.Definition.DefnId) != nil {
Expand Down
2 changes: 1 addition & 1 deletion secondary/manager/client/metadata_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ func (o *MetadataProvider) makeCommitIndexRequest(op CommitCreateRequestOp, idxD
cond.Signal()
}()

logging.Infof("send commit create request to watcher %v", w.getAdminAddr())
logging.Infof("send commit create request to watcher %v defnID %v", w.getAdminAddr(), idxDefn.DefnId)

// if there is a network partitioning between the metadata provider and indexer,
// makeRequest would not return until timeout.
Expand Down
9 changes: 3 additions & 6 deletions secondary/manager/common/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,8 @@ func PostCreateCommandToken(defnId c.IndexDefnId, bucketUUID, scopeId, collectio
func CreateCommandTokenExist(defnId c.IndexDefnId) (bool, error) {

id := fmt.Sprintf("%v", defnId)
paths, err := c.MetakvBigValueList(CreateDDLCommandTokenPath + id)
if err != nil {
return false, err
}

return len(paths) != 0, nil
commandToken := &CreateCommandToken{}
return c.MetakvBigValueGet(CreateDDLCommandTokenPath+id, commandToken)
}

//
Expand Down Expand Up @@ -320,6 +316,7 @@ func ListAndFetchCreateCommandToken(defnId c.IndexDefnId) ([]*CreateCommandToken

var result []*CreateCommandToken
if len(paths) > 0 {

result = make([]*CreateCommandToken, 0, len(paths))
for _, path := range paths {
token := &CreateCommandToken{}
Expand Down
12 changes: 0 additions & 12 deletions secondary/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,19 +468,7 @@ func (m *IndexManager) HandleBuildIndexRebalDDL(indexIds client.IndexIdList) err
content, _ := client.MarshallIndexIdList(&indexIds)
//TODO handle err

/*
if USE_MASTER_REPO {
if !m.coordinator.NewRequest(uint32(OPCODE_DEL_IDX_DEFN), indexDefnIdStr(defnId), nil) {
// TODO: double check if it exists in the dictionary
return NewError(ERROR_MGR_DDL_DROP_IDX, NORMAL, INDEX_MANAGER, nil,
fmt.Sprintf("Fail to complete processing build index statement for index id = '%d'", defnId))
}
} else {
*/
return m.requestServer.MakeRequest(client.OPCODE_BUILD_INDEX_REBAL, key, content)

return nil
}

func (m *IndexManager) UpdateIndexInstance(bucket, scope, collection string, defnId common.IndexDefnId, instId common.IndexInstId,
Expand Down

0 comments on commit e7efbc9

Please sign in to comment.