Skip to content

Commit

Permalink
MB-44506 add hostname to transfer tokens
Browse files Browse the repository at this point in the history
Change-Id: Ie085fe2ee81deaac27cbc6ae9021155229e16c23
  • Loading branch information
deepkaran committed Mar 3, 2021
1 parent 0763320 commit 13ebf4a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
13 changes: 13 additions & 0 deletions secondary/common/rebalance_defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ type TransferToken struct {
Error string
BuildSource TokenBuildSource
TransferMode TokenTransferMode

//used for logging
SourceHost string
DestHost string
}

func (tt TransferToken) Clone() TransferToken {
Expand All @@ -128,6 +132,9 @@ func (tt TransferToken) Clone() TransferToken {
ttc.BuildSource = tt.BuildSource
ttc.TransferMode = tt.TransferMode

ttc.SourceHost = tt.SourceHost
ttc.DestHost = tt.DestHost

return ttc

}
Expand All @@ -136,7 +143,13 @@ func (tt TransferToken) String() string {

str := fmt.Sprintf(" MasterId: %v ", tt.MasterId)
str += fmt.Sprintf("SourceId: %v ", tt.SourceId)
if len(tt.SourceHost) != 0 {
str += fmt.Sprintf("(%v) ", tt.SourceHost)
}
str += fmt.Sprintf("DestId: %v ", tt.DestId)
if len(tt.DestHost) != 0 {
str += fmt.Sprintf("(%v) ", tt.DestHost)
}
str += fmt.Sprintf("RebalId: %v ", tt.RebalId)
str += fmt.Sprintf("State: %v ", tt.State)
str += fmt.Sprintf("BuildSource: %v ", tt.BuildSource)
Expand Down
2 changes: 1 addition & 1 deletion secondary/indexer/rebalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ func (r *Rebalancer) computeProgress() (progress float64) {
for _, tt := range r.transferTokens {
state := tt.State
// All states not tested in the if-else if are treated as 0% progress
if state == c.TransferTokenReady || state == c.TransferTokenMerge ||
if state == c.TransferTokenReady || state == c.TransferTokenMerge ||
state == c.TransferTokenCommit || state == c.TransferTokenDeleted {
totalProgress += 100.00
} else if state == c.TransferTokenInProgress {
Expand Down
3 changes: 3 additions & 0 deletions secondary/planner/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@ func genTransferToken(solution *Solution, masterId string, topologyChange servic
InstId: index.InstId,
IndexInst: *index.Instance,
TransferMode: common.TokenTransferModeMove,
SourceHost: index.initialNode.NodeId,
DestHost: index.destNode.NodeId,
}

token.IndexInst.Defn.InstVersion = token.IndexInst.Version + 1
Expand Down Expand Up @@ -410,6 +412,7 @@ func genTransferToken(solution *Solution, masterId string, topologyChange servic
InstId: index.InstId,
IndexInst: *index.Instance,
TransferMode: common.TokenTransferModeCopy,
DestHost: index.destNode.NodeId,
}

token.IndexInst.Defn.InstVersion = 1
Expand Down

0 comments on commit 13ebf4a

Please sign in to comment.