Skip to content

Commit

Permalink
MB-54419 add pause no-op if indexes don't exit
Browse files Browse the repository at this point in the history
check if there are any index definitions in local metadata for
bucket. If empty, skip pause.

Change-Id: I5452524d37ae7d95c3fe03f1f5fcee9f9fc99cf7
  • Loading branch information
NightWing1998 committed Nov 15, 2022
1 parent d7efb78 commit 4c7a1eb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion secondary/indexer/pause_pauser.go
Expand Up @@ -88,11 +88,15 @@ func (this *Pauser) restGetLocalIndexMetadataBinary(compress bool) ([]byte, erro
}

// Verify response can be unmarshaled
err = json.Unmarshal(byteSlice, new(manager.LocalIndexMetadata))
metadata := new(manager.LocalIndexMetadata)
err = json.Unmarshal(byteSlice, metadata)
if err != nil {
this.failPause(_restGetLocalIndexMetadataBinary, "Unmarshal localMeta", err)
return nil, err
}
if len(metadata.IndexDefinitions) == 0 {
return nil, nil
}

// Return checksummed and optionally compressed byte slice, not the unmarshaled object
return common.ChecksumAndCompress(byteSlice, compress), nil
Expand Down Expand Up @@ -154,6 +158,11 @@ func (this *Pauser) run(master bool) {
this.failPause(_run, "getLocalInstanceMetadata", err)
return
}
if byteSlice == nil {
// there are no indexes on this node for bucket. pause is a no-op
logging.Infof("Pauser::run pause is a no-op for bucket %v-%v", this.task.bucket, this.task.bucketUuid)
return
}
reader.Reset(byteSlice)
err = Upload(nodePath, FILENAME_METADATA, reader)
if err != nil {
Expand Down

0 comments on commit 4c7a1eb

Please sign in to comment.