Skip to content

Commit

Permalink
feat: remove remaining usages of ClusterName
Browse files Browse the repository at this point in the history
Signed-off-by: Manan Gupta <[email protected]>
  • Loading branch information
GuptaManan100 committed Dec 27, 2022
1 parent 3ffc36f commit 6bce6fd
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 10 deletions.
3 changes: 1 addition & 2 deletions go/vt/vtorc/inst/analysis_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ func GetReplicationAnalysis(keyspace string, shard string, hints *ReplicationAna
isStaleBinlogCoordinates := m.GetBool("is_stale_binlog_coordinates")
a.ClusterDetails.Keyspace = m.GetString("keyspace")
a.ClusterDetails.Shard = m.GetString("shard")
a.ClusterDetails.ClusterName = GetClusterNameFromKeyspaceAndShard(a.ClusterDetails.Keyspace, a.ClusterDetails.Shard)
a.GTIDMode = m.GetString("gtid_mode")
a.LastCheckValid = m.GetBool("is_last_check_valid")
a.LastCheckPartialSuccess = m.GetBool("last_check_partial_success")
Expand Down Expand Up @@ -440,7 +439,7 @@ func GetReplicationAnalysis(keyspace string, shard string, hints *ReplicationAna
log.Infof(analysisMessage)
}
}
keyspaceShard := a.ClusterDetails.ClusterName
keyspaceShard := getKeyspaceShardName(a.ClusterDetails.Keyspace, a.ClusterDetails.Shard)
if clusters[keyspaceShard] == nil {
clusters[keyspaceShard] = &clusterAnalysis{}
if a.TabletType == topodatapb.TabletType_PRIMARY {
Expand Down
1 change: 0 additions & 1 deletion go/vt/vtorc/inst/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package inst

// ClusterInfo makes for a cluster status/info summary
type ClusterInfo struct {
ClusterName string
Keyspace string
Shard string
CountInstances uint
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtorc/inst/instance_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ Cleanup:
return nil, err
}

// GetClusterNameFromKeyspaceAndShard returns the cluster name from keyspace and shard
func GetClusterNameFromKeyspaceAndShard(keyspace, shard string) string {
// getKeyspaceShardName returns a single string having both the keyspace and shard
func getKeyspaceShardName(keyspace, shard string) string {
return fmt.Sprintf("%v:%v", keyspace, shard)
}

Expand Down
2 changes: 0 additions & 2 deletions go/vt/vtorc/logic/topology_recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ type RecoveryAcknowledgement struct {
Comment string

Key inst.InstanceKey
ClusterName string
ID int64
UID string
AllRecoveries bool
Expand All @@ -108,7 +107,6 @@ type RecoveryAcknowledgement struct {
// BlockedTopologyRecovery represents an entry in the blocked_topology_recovery table
type BlockedTopologyRecovery struct {
FailedInstanceKey inst.InstanceKey
ClusterName string
Analysis inst.AnalysisCode
LastBlockedTimestamp string
BlockingRecoveryID int64
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtorc/logic/topology_recovery_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func AttemptRecoveryRegistration(analysisEntry *inst.ReplicationAnalysis, failIf
}
if len(recoveries) > 0 {
_ = RegisterBlockedRecoveries(analysisEntry, recoveries)
errMsg := fmt.Sprintf("AttemptRecoveryRegistration: cluster %+v has recently experienced a failover (of %+v) and is in active period. It will not be failed over again. You may acknowledge the failure on this cluster (-c ack-cluster-recoveries) or on %+v (-c ack-instance-recoveries) to remove this blockage", analysisEntry.ClusterDetails.ClusterName, recoveries[0].AnalysisEntry.AnalyzedInstanceKey, recoveries[0].AnalysisEntry.AnalyzedInstanceKey)
errMsg := fmt.Sprintf("AttemptRecoveryRegistration: keyspace %+v shard %+v has recently experienced a failover (of %+v) and is in active period. It will not be failed over again. You may acknowledge the failure on this cluster (-c ack-cluster-recoveries) or on %+v (-c ack-instance-recoveries) to remove this blockage", analysisEntry.ClusterDetails.Keyspace, analysisEntry.ClusterDetails.Shard, recoveries[0].AnalysisEntry.AnalyzedInstanceKey, recoveries[0].AnalysisEntry.AnalyzedInstanceKey)
log.Errorf(errMsg)
return nil, fmt.Errorf(errMsg)
}
Expand Down
2 changes: 0 additions & 2 deletions go/vt/vtorc/test/recovery_analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type InfoForRecoveryAnalysis struct {
LogFile string
LogPos int64
IsStaleBinlogCoordinates int
ClusterName string
GTIDMode string
LastCheckValid int
LastCheckPartialSuccess int
Expand Down Expand Up @@ -160,5 +159,4 @@ func (info *InfoForRecoveryAnalysis) SetValuesFromTabletInfo() {
info.DataCenter = info.TabletInfo.Alias.Cell
info.Keyspace = info.TabletInfo.Keyspace
info.Shard = info.TabletInfo.Shard
info.ClusterName = fmt.Sprintf("%v:%v", info.TabletInfo.Keyspace, info.TabletInfo.Shard)
}

0 comments on commit 6bce6fd

Please sign in to comment.