Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into merge.1.16.2
Browse files Browse the repository at this point in the history
  • Loading branch information
atzoum committed Nov 8, 2023
2 parents 836b0f0 + d76bdb9 commit f6a35aa
Show file tree
Hide file tree
Showing 123 changed files with 5,216 additions and 3,451 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/apply-hot-fixes.yml

This file was deleted.

5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ RUN go build -o rudder-cli ./cmd/rudder-cli/

FROM alpine:${ALPINE_VERSION}

RUN apk update && apk add tzdata
RUN apk -U --no-cache upgrade && \
apk add --no-cache ca-certificates postgresql-client curl bash
RUN apk --no-cache upgrade && \
apk --no-cache add tzdata ca-certificates postgresql-client curl bash

COPY --from=builder rudder-server/rudder-server .
COPY --from=builder rudder-server/build/wait-for-go/wait-for-go .
Expand Down
173 changes: 0 additions & 173 deletions app/cluster/configlifecycle_mock_test.go

This file was deleted.

45 changes: 1 addition & 44 deletions app/cluster/dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ package cluster
import (
"context"
"fmt"
"strings"
"sync"
"time"

"github.com/rudderlabs/rudder-go-kit/logger"
"github.com/rudderlabs/rudder-go-kit/stats"
backendconfig "github.com/rudderlabs/rudder-server/backend-config"
"github.com/rudderlabs/rudder-server/utils/types/servermode"
"github.com/rudderlabs/rudder-server/utils/types/workspace"
)

var (
Expand All @@ -21,21 +18,13 @@ var (

type ChangeEventProvider interface {
ServerMode(ctx context.Context) <-chan servermode.ChangeEvent
WorkspaceIDs(ctx context.Context) <-chan workspace.ChangeEvent
}

type lifecycle interface {
Start() error
Stop()
}

//go:generate mockgen -destination=./configlifecycle_mock_test.go -package=cluster_test -source=./dynamic.go configLifecycle
type configLifecycle interface {
Stop()
StartWithIDs(ctx context.Context, workspaces string)
WaitForConfig(ctx context.Context)
}

type Dynamic struct {
Provider ChangeEventProvider

Expand All @@ -54,14 +43,12 @@ type Dynamic struct {
SchemaForwarder lifecycle
Archiver lifecycle

currentMode servermode.Mode
currentWorkspaceIDs string
currentMode servermode.Mode

serverStartTimeStat stats.Measurement
serverStopTimeStat stats.Measurement
serverStartCountStat stats.Measurement
serverStopCountStat stats.Measurement
BackendConfig configLifecycle

logger logger.Logger

Expand All @@ -79,10 +66,6 @@ func (d *Dynamic) init() {
d.serverStopTimeStat = stats.Default.NewTaggedStat("cluster.server_stop_time", stats.TimerType, tag)
d.serverStartCountStat = stats.Default.NewTaggedStat("cluster.server_start_count", stats.CountType, tag)
d.serverStopCountStat = stats.Default.NewTaggedStat("cluster.server_stop_count", stats.CountType, tag)

if d.BackendConfig == nil {
d.BackendConfig = backendconfig.DefaultBackendConfig
}
}

func (d *Dynamic) Run(ctx context.Context) error {
Expand All @@ -92,7 +75,6 @@ func (d *Dynamic) Run(ctx context.Context) error {
defer cancel()

serverModeChan := d.Provider.ServerMode(ctx)
workspaceIDsChan := d.Provider.WorkspaceIDs(ctx)
if d.GatewayComponent {
d.currentMode = servermode.NormalMode
}
Expand Down Expand Up @@ -130,23 +112,6 @@ func (d *Dynamic) Run(ctx context.Context) error {
if err := req.Ack(ctx); err != nil {
return fmt.Errorf("ack mode change: %w", err)
}
case req := <-workspaceIDsChan:
if req.Err() != nil {
return req.Err()
}
ids := strings.Join(req.WorkspaceIDs(), ",")

d.logger.Infof("Got trigger to change workspaceIDs: %q", ids)
err := d.handleWorkspaceChange(ctx, ids)
if ackErr := req.Ack(ctx, err); ackErr != nil {
return fmt.Errorf("ack workspaceIDs change with error: %v: %w", err, ackErr)
}
if err != nil {
d.logger.Debugf("Could not handle workspaceIDs change: %v", err)
return err
}

d.logger.Debug("WorkspaceIDs changed")
}
}
}
Expand Down Expand Up @@ -224,14 +189,6 @@ func (d *Dynamic) stop() {
d.serverStopCountStat.Increment()
}

func (d *Dynamic) handleWorkspaceChange(ctx context.Context, workspaces string) error {
d.BackendConfig.Stop()
d.BackendConfig.StartWithIDs(ctx, workspaces)
d.currentWorkspaceIDs = workspaces
d.BackendConfig.WaitForConfig(ctx)
return nil
}

func (d *Dynamic) handleModeChange(newMode servermode.Mode) error {
if d.GatewayComponent {
d.logger.Info("Not transiting the server because this is only Gateway App")
Expand Down
Loading

0 comments on commit f6a35aa

Please sign in to comment.