Skip to content

Commit

Permalink
Fix ports issue; fix unhappy path indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
wilwell committed Jan 30, 2025
1 parent 3bd2501 commit 8123374
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
6 changes: 6 additions & 0 deletions controllers/update_flow_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ func (f *flowTree) execute(ctx context.Context, ytsaurus *apiProxy.Ytsaurus, com
func (f *flowTree) chain(steps ...*flowStep) *flowTree {
for _, step := range steps {
f.index[step.updateState] = step
// Also index any unhappy path steps
if step.nextSteps != nil {
if unhappyStep := step.nextSteps[stepResultMarkUnhappy]; unhappyStep != nil {
f.index[unhappyStep.updateState] = unhappyStep
}
}
f.tail.chain(step)
f.tail = step
}
Expand Down
13 changes: 6 additions & 7 deletions controllers/update_flow_steps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ func TestBuildFlowTree(t *testing.T) {
ytv1.UpdateStateWaitingForTabletCellsRemovingStart,
ytv1.UpdateStateWaitingForTabletCellsRemoved,
ytv1.UpdateStateWaitingForEnableRealChunkLocations,
ytv1.UpdateStateWaitingForSnapshots,
ytv1.UpdateStateWaitingForPodsRemoval,
ytv1.UpdateStateWaitingForPodsCreation,
ytv1.UpdateStateWaitingForSnapshots,
ytv1.UpdateStateWaitingForMasterExitReadOnly,
ytv1.UpdateStateWaitingForTabletCellsRecovery,
ytv1.UpdateStateWaitingForOpArchiveUpdatingPrepare,
Expand Down Expand Up @@ -83,9 +83,9 @@ func TestBuildFlowTree(t *testing.T) {
ytv1.UpdateStateWaitingForTabletCellsRemovingStart,
ytv1.UpdateStateWaitingForTabletCellsRemoved,
ytv1.UpdateStateWaitingForEnableRealChunkLocations,
ytv1.UpdateStateWaitingForSnapshots,
ytv1.UpdateStateWaitingForPodsRemoval,
ytv1.UpdateStateWaitingForPodsCreation,
ytv1.UpdateStateWaitingForSnapshots,
ytv1.UpdateStateWaitingForMasterExitReadOnly,
ytv1.UpdateStateWaitingForTabletCellsRecovery,
ytv1.UpdateStateWaitingForSafeModeDisabled,
Expand All @@ -100,9 +100,9 @@ func TestBuildFlowTree(t *testing.T) {
ytv1.UpdateStatePossibilityCheck,
ytv1.UpdateStateWaitingForSafeModeEnabled,
ytv1.UpdateStateWaitingForEnableRealChunkLocations,
ytv1.UpdateStateWaitingForSnapshots,
ytv1.UpdateStateWaitingForPodsRemoval,
ytv1.UpdateStateWaitingForPodsCreation,
ytv1.UpdateStateWaitingForSnapshots,
ytv1.UpdateStateWaitingForMasterExitReadOnly,
ytv1.UpdateStateWaitingForSafeModeDisabled,
},
Expand All @@ -118,9 +118,9 @@ func TestBuildFlowTree(t *testing.T) {
ytv1.UpdateStatePossibilityCheck,
ytv1.UpdateStateWaitingForSafeModeEnabled,
ytv1.UpdateStateWaitingForEnableRealChunkLocations,
ytv1.UpdateStateWaitingForSnapshots,
ytv1.UpdateStateWaitingForPodsRemoval,
ytv1.UpdateStateWaitingForPodsCreation,
ytv1.UpdateStateWaitingForSnapshots,
ytv1.UpdateStateWaitingForMasterExitReadOnly,
ytv1.UpdateStateWaitingForSafeModeDisabled,
},
Expand All @@ -134,7 +134,6 @@ func TestBuildFlowTree(t *testing.T) {
expectedStates: []ytv1.UpdateState{
ytv1.UpdateStateNone,
ytv1.UpdateStatePossibilityCheck,
ytv1.UpdateStateWaitingForSafeModeEnabled,
ytv1.UpdateStateWaitingForTabletCellsSaving,
ytv1.UpdateStateWaitingForTabletCellsRemovingStart,
ytv1.UpdateStateWaitingForTabletCellsRemoved,
Expand Down Expand Up @@ -212,9 +211,9 @@ func TestBuildFlowTree(t *testing.T) {
ytv1.UpdateStateWaitingForTabletCellsRemovingStart,
ytv1.UpdateStateWaitingForTabletCellsRemoved,
ytv1.UpdateStateWaitingForEnableRealChunkLocations,
ytv1.UpdateStateWaitingForSnapshots,
ytv1.UpdateStateWaitingForPodsRemoval,
ytv1.UpdateStateWaitingForPodsCreation,
ytv1.UpdateStateWaitingForSnapshots,
ytv1.UpdateStateWaitingForMasterExitReadOnly,
ytv1.UpdateStateWaitingForTabletCellsRecovery,
ytv1.UpdateStateWaitingForSafeModeDisabled,
Expand All @@ -231,9 +230,9 @@ func TestBuildFlowTree(t *testing.T) {
ytv1.UpdateStatePossibilityCheck,
ytv1.UpdateStateWaitingForSafeModeEnabled,
ytv1.UpdateStateWaitingForEnableRealChunkLocations,
ytv1.UpdateStateWaitingForSnapshots,
ytv1.UpdateStateWaitingForPodsRemoval,
ytv1.UpdateStateWaitingForPodsCreation,
ytv1.UpdateStateWaitingForSnapshots,
ytv1.UpdateStateWaitingForMasterExitReadOnly,
ytv1.UpdateStateWaitingForSafeModeDisabled,
},
Expand Down
4 changes: 3 additions & 1 deletion pkg/ytconfig/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ func getDiscoveryLogging(spec *ytv1.DiscoverySpec) Logging {
func getDiscoveryServerCarcass(spec *ytv1.DiscoverySpec) (DiscoveryServer, error) {
var c DiscoveryServer

c.MonitoringPort = *spec.InstanceSpec.MonitoringPort
if spec.InstanceSpec.MonitoringPort != nil {
c.MonitoringPort = *spec.InstanceSpec.MonitoringPort
}
c.RPCPort = consts.DiscoveryRPCPort

c.Logging = getDiscoveryLogging(spec)
Expand Down
4 changes: 3 additions & 1 deletion pkg/ytconfig/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ func getMasterServerCarcass(spec *ytv1.MastersSpec) (MasterServer, error) {
var c MasterServer
c.UseNewHydra = true
c.RPCPort = consts.MasterRPCPort
c.MonitoringPort = *spec.MonitoringPort
if spec.MonitoringPort != nil {
c.MonitoringPort = *spec.MonitoringPort
}

c.HydraManager.MaxSnapshotCountToKeep = 10
if spec.MaxSnapshotCountToKeep != nil {
Expand Down
8 changes: 6 additions & 2 deletions pkg/ytconfig/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ func getControllerAgentLogging(spec *ytv1.ControllerAgentsSpec) Logging {
func getSchedulerServerCarcass(spec *ytv1.SchedulersSpec) (SchedulerServer, error) {
var c SchedulerServer
c.RPCPort = consts.SchedulerRPCPort
c.MonitoringPort = *spec.InstanceSpec.MonitoringPort
if spec.InstanceSpec.MonitoringPort != nil {
c.MonitoringPort = *spec.InstanceSpec.MonitoringPort
}
c.Logging = getSchedulerLogging(spec)

return c, nil
Expand All @@ -60,7 +62,9 @@ func getSchedulerServerCarcass(spec *ytv1.SchedulersSpec) (SchedulerServer, erro
func getControllerAgentServerCarcass(spec *ytv1.ControllerAgentsSpec) (ControllerAgentServer, error) {
var c ControllerAgentServer
c.RPCPort = consts.ControllerAgentRPCPort
c.MonitoringPort = *spec.InstanceSpec.MonitoringPort
if spec.InstanceSpec.MonitoringPort != nil {
c.MonitoringPort = *spec.InstanceSpec.MonitoringPort
}
c.Logging = getControllerAgentLogging(spec)

return c, nil
Expand Down

0 comments on commit 8123374

Please sign in to comment.