Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Hiltunen <shiltunen@gitlab.com>2020-07-28 11:57:02 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2020-07-30 18:06:59 +0300
commitf88be97da354972a6609be3cfb4563941f958947 (patch)
tree16f8a96a31e2c581cb301935612453bf62b8b9e5
parentdb7767ad3febe68c4f376886d62a05bba5200f83 (diff)
remove virtual storage wide read-only mode
With the introduction of per repository read-only mode, this commit removes the previous virtual storage wide read-only mode implementation.
-rw-r--r--changelogs/unreleased/smh-remove-old-read-only-impl.yml5
-rw-r--r--cmd/praefect/main.go8
-rw-r--r--cmd/praefect/subcmd.go1
-rw-r--r--cmd/praefect/subcmd_accept_dataloss.go2
-rw-r--r--cmd/praefect/subcmd_accept_dataloss_test.go2
-rw-r--r--cmd/praefect/subcmd_dataloss.go8
-rw-r--r--cmd/praefect/subcmd_dataloss_test.go18
-rw-r--r--cmd/praefect/subcmd_enable_writes.go64
-rw-r--r--cmd/praefect/subcmd_enable_writes_test.go62
-rw-r--r--config.praefect.toml.example1
-rw-r--r--internal/praefect/config/config.go3
-rw-r--r--internal/praefect/config/config_test.go11
-rw-r--r--internal/praefect/coordinator.go10
-rw-r--r--internal/praefect/coordinator_test.go35
-rw-r--r--internal/praefect/helper_test.go3
-rw-r--r--internal/praefect/metrics/prometheus.go8
-rw-r--r--internal/praefect/nodes/local_elector.go60
-rw-r--r--internal/praefect/nodes/local_elector_test.go3
-rw-r--r--internal/praefect/nodes/manager.go25
-rw-r--r--internal/praefect/nodes/manager_test.go42
-rw-r--r--internal/praefect/nodes/sql_elector.go88
-rw-r--r--internal/praefect/nodes/sql_elector_test.go53
-rw-r--r--internal/praefect/replicator.go7
-rw-r--r--internal/praefect/replicator_test.go1
-rw-r--r--internal/praefect/service/info/server.go13
-rw-r--r--internal/praefect/service/server/info.go2
-rw-r--r--proto/go/gitalypb/praefect.pb.go226
-rw-r--r--proto/praefect.proto16
-rw-r--r--ruby/proto/gitaly/praefect_pb.rb7
-rw-r--r--ruby/proto/gitaly/praefect_services_pb.rb3
30 files changed, 153 insertions, 634 deletions
diff --git a/changelogs/unreleased/smh-remove-old-read-only-impl.yml b/changelogs/unreleased/smh-remove-old-read-only-impl.yml
new file mode 100644
index 000000000..bf2d8d8b0
--- /dev/null
+++ b/changelogs/unreleased/smh-remove-old-read-only-impl.yml
@@ -0,0 +1,5 @@
+---
+title: Remove virtual storage wide read-only mode
+merge_request: 2431
+author:
+type: changed
diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go
index ff6527729..22c3b6432 100644
--- a/cmd/praefect/main.go
+++ b/cmd/praefect/main.go
@@ -70,14 +70,6 @@
// "-virtual-storage" specifies which virtual storage to check for data loss. If not specified,
// the check is performed for every configured virtual storage.
//
-// Enable Writes
-//
-// The subcommand "enable-writes" re-enables writes to a storage after it has experienced a
-// failover event. Once writes are re-enabled, the new primary's state might diverge from the
-// previous primary, making data recovery attempts more difficult due to possible conflicts.
-//
-// praefect -config PATH_TO_CONFIG enable-writes -virtual-storage <vstorage>
-//
// Accept Dataloss
//
// The subcommand "accept-dataloss" allows for accepting data loss in a repository to enable it for
diff --git a/cmd/praefect/subcmd.go b/cmd/praefect/subcmd.go
index 4e31eafc4..7b867dc54 100644
--- a/cmd/praefect/subcmd.go
+++ b/cmd/praefect/subcmd.go
@@ -31,7 +31,6 @@ var (
"sql-migrate-down": &sqlMigrateDownSubcommand{},
"sql-migrate-status": &sqlMigrateStatusSubcommand{},
"dataloss": newDatalossSubcommand(),
- "enable-writes": &enableWritesSubcommand{},
"accept-dataloss": &acceptDatalossSubcommand{},
}
)
diff --git a/cmd/praefect/subcmd_accept_dataloss.go b/cmd/praefect/subcmd_accept_dataloss.go
index 053f802fd..cb81e1b90 100644
--- a/cmd/praefect/subcmd_accept_dataloss.go
+++ b/cmd/praefect/subcmd_accept_dataloss.go
@@ -37,7 +37,7 @@ func (cmd *acceptDatalossSubcommand) FlagSet() *flag.FlagSet {
func (cmd *acceptDatalossSubcommand) Exec(flags *flag.FlagSet, cfg config.Config) error {
if flags.NArg() > 0 {
- return UnexpectedPositionalArgsError{Command: flags.Name()}
+ return unexpectedPositionalArgsError{Command: flags.Name()}
} else if cmd.virtualStorage == "" {
return requiredParameterError(paramVirtualStorage)
} else if cmd.relativePath == "" {
diff --git a/cmd/praefect/subcmd_accept_dataloss_test.go b/cmd/praefect/subcmd_accept_dataloss_test.go
index 0046f8399..c687337f5 100644
--- a/cmd/praefect/subcmd_accept_dataloss_test.go
+++ b/cmd/praefect/subcmd_accept_dataloss_test.go
@@ -117,7 +117,7 @@ func TestAcceptDatalossSubcommand(t *testing.T) {
{
desc: "positional arguments",
args: []string{"-virtual-storage=test-virtual-storage-1", "-repository=test-repository-1", "-authoritative-storage=test-physical-storage-2", "positional-arg"},
- matchError: matchEqual(UnexpectedPositionalArgsError{Command: "accept-dataloss"}),
+ matchError: matchEqual(unexpectedPositionalArgsError{Command: "accept-dataloss"}),
expectedGenerations: startingGenerations,
},
{
diff --git a/cmd/praefect/subcmd_dataloss.go b/cmd/praefect/subcmd_dataloss.go
index c66ca1a1b..db23ccd5e 100644
--- a/cmd/praefect/subcmd_dataloss.go
+++ b/cmd/praefect/subcmd_dataloss.go
@@ -14,6 +14,12 @@ import (
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
)
+type unexpectedPositionalArgsError struct{ Command string }
+
+func (err unexpectedPositionalArgsError) Error() string {
+ return fmt.Sprintf("%s doesn't accept positional arguments", err.Command)
+}
+
type datalossSubcommand struct {
output io.Writer
virtualStorage string
@@ -37,7 +43,7 @@ func (cmd *datalossSubcommand) println(indent int, msg string, args ...interface
func (cmd *datalossSubcommand) Exec(flags *flag.FlagSet, cfg config.Config) error {
if flags.NArg() > 0 {
- return UnexpectedPositionalArgsError{Command: flags.Name()}
+ return unexpectedPositionalArgsError{Command: flags.Name()}
}
virtualStorages := []string{cmd.virtualStorage}
diff --git a/cmd/praefect/subcmd_dataloss_test.go b/cmd/praefect/subcmd_dataloss_test.go
index 4c24741b9..15daeba45 100644
--- a/cmd/praefect/subcmd_dataloss_test.go
+++ b/cmd/praefect/subcmd_dataloss_test.go
@@ -2,7 +2,6 @@ package main
import (
"bytes"
- "context"
"testing"
"github.com/stretchr/testify/require"
@@ -11,23 +10,8 @@ import (
"gitlab.com/gitlab-org/gitaly/internal/praefect/nodes"
"gitlab.com/gitlab-org/gitaly/internal/praefect/service/info"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
- "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
)
-type mockPraefectInfoService struct {
- gitalypb.UnimplementedPraefectInfoServiceServer
- DatalossCheckFunc func(context.Context, *gitalypb.DatalossCheckRequest) (*gitalypb.DatalossCheckResponse, error)
- EnableWritesFunc func(context.Context, *gitalypb.EnableWritesRequest) (*gitalypb.EnableWritesResponse, error)
-}
-
-func (m mockPraefectInfoService) DatalossCheck(ctx context.Context, r *gitalypb.DatalossCheckRequest) (*gitalypb.DatalossCheckResponse, error) {
- return m.DatalossCheckFunc(ctx, r)
-}
-
-func (m mockPraefectInfoService) EnableWrites(ctx context.Context, r *gitalypb.EnableWritesRequest) (*gitalypb.EnableWritesResponse, error) {
- return m.EnableWritesFunc(ctx, r)
-}
-
func TestDatalossSubcommand(t *testing.T) {
mgr := &nodes.MockManager{
GetShardFunc: func(vs string) (nodes.Shard, error) {
@@ -72,7 +56,7 @@ func TestDatalossSubcommand(t *testing.T) {
{
desc: "positional arguments",
args: []string{"-virtual-storage=virtual-storage-1", "positional-arg"},
- error: UnexpectedPositionalArgsError{Command: "dataloss"},
+ error: unexpectedPositionalArgsError{Command: "dataloss"},
},
{
desc: "data loss",
diff --git a/cmd/praefect/subcmd_enable_writes.go b/cmd/praefect/subcmd_enable_writes.go
deleted file mode 100644
index 726bf2fe4..000000000
--- a/cmd/praefect/subcmd_enable_writes.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package main
-
-import (
- "context"
- "errors"
- "flag"
- "fmt"
- "log"
-
- "gitlab.com/gitlab-org/gitaly/internal/praefect/config"
- "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
-)
-
-type UnexpectedPositionalArgsError struct{ Command string }
-
-func (err UnexpectedPositionalArgsError) Error() string {
- return fmt.Sprintf("%s doesn't accept positional arguments", err.Command)
-}
-
-var errMissingVirtualStorage = errors.New("virtual-storage is a required parameter")
-
-type enableWritesSubcommand struct {
- virtualStorage string
-}
-
-func (cmd *enableWritesSubcommand) FlagSet() *flag.FlagSet {
- fs := flag.NewFlagSet("enable-writes", flag.ContinueOnError)
- fs.StringVar(&cmd.virtualStorage, "virtual-storage", "", "name of the virtual storage to enable writes for")
- return fs
-}
-
-func (cmd *enableWritesSubcommand) Exec(flags *flag.FlagSet, cfg config.Config) error {
- if flags.NArg() > 0 {
- return UnexpectedPositionalArgsError{Command: flags.Name()}
- }
-
- if cmd.virtualStorage == "" {
- return errMissingVirtualStorage
- }
-
- nodeAddr, err := getNodeAddress(cfg)
- if err != nil {
- return err
- }
-
- conn, err := subCmdDial(nodeAddr, cfg.Auth.Token)
- if err != nil {
- return fmt.Errorf("error dialing: %w", err)
- }
- defer func() {
- if err := conn.Close(); err != nil {
- log.Printf("error closing connection: %v", err)
- }
- }()
-
- client := gitalypb.NewPraefectInfoServiceClient(conn)
- if _, err := client.EnableWrites(context.TODO(), &gitalypb.EnableWritesRequest{
- VirtualStorage: cmd.virtualStorage,
- }); err != nil {
- return fmt.Errorf("error enabling writes: %w", err)
- }
-
- return nil
-}
diff --git a/cmd/praefect/subcmd_enable_writes_test.go b/cmd/praefect/subcmd_enable_writes_test.go
deleted file mode 100644
index 201ae6907..000000000
--- a/cmd/praefect/subcmd_enable_writes_test.go
+++ /dev/null
@@ -1,62 +0,0 @@
-package main
-
-import (
- "context"
- "testing"
-
- "github.com/stretchr/testify/require"
- "gitlab.com/gitlab-org/gitaly/internal/praefect/config"
- "gitlab.com/gitlab-org/gitaly/internal/testhelper"
- "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
-)
-
-func TestEnableWritesSubcommand(t *testing.T) {
- mockSvc := &mockPraefectInfoService{}
- ln, clean := listenAndServe(t, []svcRegistrar{registerPraefectInfoServer(mockSvc)})
- defer clean()
-
- type EnableWritesFunc func(context.Context, *gitalypb.EnableWritesRequest) (*gitalypb.EnableWritesResponse, error)
- for _, tc := range []struct {
- desc string
- args []string
- enableWritesFunc func(testing.TB) EnableWritesFunc
- error error
- }{
- {
- desc: "missing virtual-storage",
- args: []string{},
- error: errMissingVirtualStorage,
- },
- {
- desc: "unexpected positional arg",
- args: []string{"-virtual-storage=passed-storage", "unexpected-positional-argument"},
- error: UnexpectedPositionalArgsError{Command: "enable-writes"},
- },
- {
- desc: "success",
- args: []string{"-virtual-storage=passed-storage"},
- enableWritesFunc: func(t testing.TB) EnableWritesFunc {
- return func(_ context.Context, req *gitalypb.EnableWritesRequest) (*gitalypb.EnableWritesResponse, error) {
- testhelper.ProtoEqual(t, &gitalypb.EnableWritesRequest{
- VirtualStorage: "passed-storage",
- }, req)
- return &gitalypb.EnableWritesResponse{}, nil
- }
- },
- },
- } {
- t.Run(tc.desc, func(t *testing.T) {
- mockSvc.EnableWritesFunc = nil
- if tc.enableWritesFunc != nil {
- mockSvc.EnableWritesFunc = tc.enableWritesFunc(t)
- }
-
- cmd := &enableWritesSubcommand{}
- flags := cmd.FlagSet()
- require.NoError(t, flags.Parse(tc.args))
- require.Equal(t, tc.error, cmd.Exec(flags, config.Config{
- SocketPath: ln.Addr().String(),
- }))
- })
- }
-}
diff --git a/config.praefect.toml.example b/config.praefect.toml.example
index 9e96c6335..98bf07a2b 100644
--- a/config.praefect.toml.example
+++ b/config.praefect.toml.example
@@ -39,7 +39,6 @@ listen_addr = "127.0.0.1:2305"
[failover]
enabled = true
election_strategy = "sql" # Options: local, sql. Defaults to 'sql'.
-read_only_after_failover = true # Switch the virtual storage to read-only mode after after a failover.
[[virtual_storage]]
name = 'praefect'
diff --git a/internal/praefect/config/config.go b/internal/praefect/config/config.go
index f3f4a3f87..2f0b81b59 100644
--- a/internal/praefect/config/config.go
+++ b/internal/praefect/config/config.go
@@ -17,7 +17,6 @@ import (
type Failover struct {
Enabled bool `toml:"enabled"`
ElectionStrategy string `toml:"election_strategy"`
- ReadOnlyAfterFailover bool `toml:"read_only_after_failover"`
ErrorThresholdWindow config.Duration `toml:"error_threshold_window"`
WriteErrorThresholdCount uint32 `toml:"write_error_threshold_count"`
ReadErrorThresholdCount uint32 `toml:"read_error_threshold_count"`
@@ -55,7 +54,7 @@ type VirtualStorage struct {
func FromFile(filePath string) (Config, error) {
conf := &Config{
// Sets the default Failover, to be overwritten when deserializing the TOML
- Failover: Failover{Enabled: true, ElectionStrategy: sqlFailoverValue, ReadOnlyAfterFailover: true},
+ Failover: Failover{Enabled: true, ElectionStrategy: sqlFailoverValue},
}
if _, err := toml.DecodeFile(filePath, conf); err != nil {
return Config{}, err
diff --git a/internal/praefect/config/config_test.go b/internal/praefect/config/config_test.go
index 1aa8087c3..dff855221 100644
--- a/internal/praefect/config/config_test.go
+++ b/internal/praefect/config/config_test.go
@@ -252,7 +252,6 @@ func TestConfigParsing(t *testing.T) {
Failover: Failover{
Enabled: true,
ElectionStrategy: sqlFailoverValue,
- ReadOnlyAfterFailover: true,
ErrorThresholdWindow: config.Duration(20 * time.Second),
WriteErrorThresholdCount: 1500,
ReadErrorThresholdCount: 100,
@@ -265,9 +264,8 @@ func TestConfigParsing(t *testing.T) {
expected: Config{
GracefulStopTimeout: config.Duration(time.Minute),
Failover: Failover{
- Enabled: false,
- ElectionStrategy: "local",
- ReadOnlyAfterFailover: false,
+ Enabled: false,
+ ElectionStrategy: "local",
},
},
},
@@ -277,9 +275,8 @@ func TestConfigParsing(t *testing.T) {
expected: Config{
GracefulStopTimeout: config.Duration(time.Minute),
Failover: Failover{
- Enabled: true,
- ElectionStrategy: sqlFailoverValue,
- ReadOnlyAfterFailover: true,
+ Enabled: true,
+ ElectionStrategy: sqlFailoverValue,
},
},
},
diff --git a/internal/praefect/coordinator.go b/internal/praefect/coordinator.go
index bdf9e70b3..b2c8a574b 100644
--- a/internal/praefect/coordinator.go
+++ b/internal/praefect/coordinator.go
@@ -232,12 +232,10 @@ func (c *Coordinator) mutatorStreamParameters(ctx context.Context, call grpcCall
return nil, fmt.Errorf("mutator call: get shard: %w", err)
}
- if c.conf.Failover.ReadOnlyAfterFailover {
- if latest, err := c.rs.IsLatestGeneration(ctx, virtualStorage, call.targetRepo.RelativePath, shard.Primary.GetStorage()); err != nil {
- return nil, fmt.Errorf("check generation: %w", err)
- } else if !latest {
- return nil, ErrRepositoryReadOnly
- }
+ if latest, err := c.rs.IsLatestGeneration(ctx, virtualStorage, call.targetRepo.RelativePath, shard.Primary.GetStorage()); err != nil {
+ return nil, fmt.Errorf("check generation: %w", err)
+ } else if !latest {
+ return nil, ErrRepositoryReadOnly
}
primaryMessage, err := rewrittenRepositoryMessage(call.methodInfo, call.msg, shard.Primary.GetStorage())
diff --git a/internal/praefect/coordinator_test.go b/internal/praefect/coordinator_test.go
index 85e62276b..373e69d4c 100644
--- a/internal/praefect/coordinator_test.go
+++ b/internal/praefect/coordinator_test.go
@@ -46,39 +46,19 @@ func TestSecondaryRotation(t *testing.T) {
func TestStreamDirectorReadOnlyEnforcement(t *testing.T) {
for _, tc := range []struct {
- readOnly bool
- readOnlyEnabled bool
- shouldError bool
+ desc string
+ readOnly bool
}{
- {
- readOnly: false,
- readOnlyEnabled: true,
- shouldError: false,
- },
- {
- readOnly: true,
- readOnlyEnabled: true,
- shouldError: true,
- },
- {
- readOnly: false,
- readOnlyEnabled: false,
- shouldError: false,
- },
- {
- readOnly: true,
- readOnlyEnabled: false,
- shouldError: false,
- },
+ {desc: "writable", readOnly: false},
+ {desc: "read-only", readOnly: true},
} {
- t.Run(fmt.Sprintf("read-only: %v, enabled: %v", tc.readOnly, tc.readOnlyEnabled), func(t *testing.T) {
+ t.Run(tc.desc, func(t *testing.T) {
const (
virtualStorage = "test-virtual-storage"
relativePath = "test-repository"
storage = "test-storage"
)
conf := config.Config{
- Failover: config.Failover{ReadOnlyAfterFailover: tc.readOnlyEnabled},
VirtualStorages: []*config.VirtualStorage{
&config.VirtualStorage{
Name: virtualStorage,
@@ -107,8 +87,7 @@ func TestStreamDirectorReadOnlyEnforcement(t *testing.T) {
&nodes.MockManager{GetShardFunc: func(vs string) (nodes.Shard, error) {
require.Equal(t, virtualStorage, vs)
return nodes.Shard{
- IsReadOnly: tc.readOnly,
- Primary: &nodes.MockNode{StorageName: storage},
+ Primary: &nodes.MockNode{StorageName: storage},
}, nil
}},
transactions.NewManager(),
@@ -123,7 +102,7 @@ func TestStreamDirectorReadOnlyEnforcement(t *testing.T) {
require.NoError(t, err)
_, err = coordinator.StreamDirector(ctx, "/gitaly.RepositoryService/Cleanup", &mockPeeker{frame: frame})
- if tc.shouldError {
+ if tc.readOnly {
require.Equal(t, ErrRepositoryReadOnly, err)
testhelper.RequireGrpcError(t, err, codes.FailedPrecondition)
} else {
diff --git a/internal/praefect/helper_test.go b/internal/praefect/helper_test.go
index 8ada959a4..d51379f13 100644
--- a/internal/praefect/helper_test.go
+++ b/internal/praefect/helper_test.go
@@ -93,10 +93,9 @@ func noopBackoffFunc() (backoff, backoffReset) {
type nullNodeMgr struct{}
func (nullNodeMgr) GetShard(virtualStorageName string) (nodes.Shard, error) {
- return nodes.Shard{}, nil
+ return nodes.Shard{Primary: &nodes.MockNode{}}, nil
}
-func (nullNodeMgr) EnableWrites(ctx context.Context, virtualStorageName string) error { return nil }
func (nullNodeMgr) GetSyncedNode(ctx context.Context, virtualStorageName, repoPath string) (nodes.Node, error) {
return nil, nil
}
diff --git a/internal/praefect/metrics/prometheus.go b/internal/praefect/metrics/prometheus.go
index bfff90eef..4a1f4d6b2 100644
--- a/internal/praefect/metrics/prometheus.go
+++ b/internal/praefect/metrics/prometheus.go
@@ -111,13 +111,6 @@ var PrimaryGauge = prometheus.NewGaugeVec(
}, []string{"virtual_storage", "gitaly_storage"},
)
-var ReadOnlyGauge = prometheus.NewGaugeVec(
- prometheus.GaugeOpts{
- Name: "gitaly_praefect_read_only_mode",
- Help: "Shows whether a virtual storage is in read-only mode.",
- }, []string{"virtual_storage"},
-)
-
var NodeLastHealthcheckGauge = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "gitaly",
@@ -149,7 +142,6 @@ func init() {
prometheus.MustRegister(
MethodTypeCounter,
PrimaryGauge,
- ReadOnlyGauge,
ChecksumMismatchCounter,
NodeLastHealthcheckGauge,
ReadDistribution,
diff --git a/internal/praefect/nodes/local_elector.go b/internal/praefect/nodes/local_elector.go
index c46491437..680602abc 100644
--- a/internal/praefect/nodes/local_elector.go
+++ b/internal/praefect/nodes/local_elector.go
@@ -14,29 +14,25 @@ import (
// shard. It does NOT support multiple Praefect nodes or have any
// persistence. This is used mostly for testing and development.
type localElector struct {
- m sync.RWMutex
- failoverEnabled bool
- shardName string
- nodes []Node
- primaryNode Node
- readOnlyAfterFailover bool
- previousWritablePrimary Node
- isReadOnly bool
- log logrus.FieldLogger
+ m sync.RWMutex
+ failoverEnabled bool
+ shardName string
+ nodes []Node
+ primaryNode Node
+ log logrus.FieldLogger
}
-func newLocalElector(name string, failoverEnabled, readOnlyAfterFailover bool, log logrus.FieldLogger, ns []*nodeStatus) *localElector {
+func newLocalElector(name string, failoverEnabled bool, log logrus.FieldLogger, ns []*nodeStatus) *localElector {
nodes := make([]Node, len(ns))
for i, n := range ns {
nodes[i] = n
}
return &localElector{
- shardName: name,
- failoverEnabled: failoverEnabled,
- log: log.WithField("virtual_storage", name),
- nodes: nodes[:],
- primaryNode: nodes[0],
- readOnlyAfterFailover: readOnlyAfterFailover,
+ shardName: name,
+ failoverEnabled: failoverEnabled,
+ log: log.WithField("virtual_storage", name),
+ nodes: nodes[:],
+ primaryNode: nodes[0],
}
}
@@ -112,20 +108,7 @@ func (s *localElector) checkNodes(ctx context.Context) error {
return ErrPrimaryNotHealthy
}
- var previousWritablePrimary Node
- if s.primaryNode != nil {
- previousWritablePrimary = s.primaryNode
- }
-
- if s.isReadOnly {
- previousWritablePrimary = s.previousWritablePrimary
- }
-
s.primaryNode = newPrimary
- s.previousWritablePrimary = previousWritablePrimary
- s.isReadOnly = s.readOnlyAfterFailover
-
- metrics.ReadOnlyGauge.WithLabelValues(s.shardName).Set(metrics.BoolAsFloat(s.isReadOnly))
return nil
}
@@ -136,8 +119,6 @@ func (s *localElector) checkNodes(ctx context.Context) error {
func (s *localElector) GetShard() (Shard, error) {
s.m.RLock()
primary := s.primaryNode
- isReadOnly := s.isReadOnly
- previousWritablePrimary := s.previousWritablePrimary
s.m.RUnlock()
if primary == nil {
@@ -156,24 +137,11 @@ func (s *localElector) GetShard() (Shard, error) {
}
return Shard{
- PreviousWritablePrimary: previousWritablePrimary,
- IsReadOnly: isReadOnly,
- Primary: primary,
- Secondaries: secondaries,
+ Primary: primary,
+ Secondaries: secondaries,
}, nil
}
-func (s *localElector) enableWrites(context.Context) error {
- s.m.Lock()
- defer s.m.Unlock()
- if !s.primaryNode.IsHealthy() {
- return ErrPrimaryNotHealthy
- }
-
- s.isReadOnly = false
- return nil
-}
-
func (s *localElector) updateMetrics() {
s.m.RLock()
primary := s.primaryNode
diff --git a/internal/praefect/nodes/local_elector_test.go b/internal/praefect/nodes/local_elector_test.go
index 6689936a1..8ca4ef524 100644
--- a/internal/praefect/nodes/local_elector_test.go
+++ b/internal/praefect/nodes/local_elector_test.go
@@ -30,7 +30,7 @@ func setupElector(t *testing.T) (*localElector, []*nodeStatus, *grpc.ClientConn,
secondary := newConnectionStatus(config.Node{Storage: storageName}, cc, testhelper.DiscardTestEntry(t), mockHistogramVec1)
ns := []*nodeStatus{cs, secondary}
logger := testhelper.NewTestLogger(t).WithField("test", t.Name())
- strategy := newLocalElector(storageName, true, true, logger, ns)
+ strategy := newLocalElector(storageName, true, logger, ns)
strategy.bootstrap(time.Second)
@@ -43,7 +43,6 @@ func TestGetShard(t *testing.T) {
shard, err := strategy.GetShard()
require.NoError(t, err)
- require.False(t, shard.IsReadOnly, "new shard should not be read-only")
require.Equal(t, ns[0], shard.Primary)
require.Len(t, shard.Secondaries, 1)
require.Equal(t, ns[1], shard.Secondaries[0])
diff --git a/internal/praefect/nodes/manager.go b/internal/praefect/nodes/manager.go
index 1cf93b18f..0720d260d 100644
--- a/internal/praefect/nodes/manager.go
+++ b/internal/praefect/nodes/manager.go
@@ -29,12 +29,8 @@ import (
// Shard is a primary with a set of secondaries
type Shard struct {
- // PreviousWritablePrimary is the virtual storage's previous
- // write-enabled primary.
- PreviousWritablePrimary Node
- IsReadOnly bool
- Primary Node
- Secondaries []Node
+ Primary Node
+ Secondaries []Node
}
func (s Shard) GetNode(storage string) (Node, error) {
@@ -67,11 +63,6 @@ func (s Shard) GetHealthySecondaries() []Node {
// Manager is responsible for returning shards for virtual storages
type Manager interface {
GetShard(virtualStorageName string) (Shard, error)
- // EnableWrites enables writes for a given virtual storage. Returns an
- // ErrPrimaryNotHealthy if the shard does not have a healthy primary.
- // ErrVirtualStorageNotExist if a virtual storage with the given name
- // does not exist.
- EnableWrites(ctx context.Context, virtualStorageName string) error
// GetSyncedNode returns a random storage node based on the state of the replication.
// It returns primary in case there are no up to date secondaries or error occurs.
GetSyncedNode(ctx context.Context, virtualStorageName, repoPath string) (Node, error)
@@ -117,7 +108,6 @@ type leaderElectionStrategy interface {
start(bootstrapInterval, monitorInterval time.Duration)
checkNodes(context.Context) error
GetShard() (Shard, error)
- enableWrites(context.Context) error
}
// ErrPrimaryNotHealthy indicates the primary of a shard is not in a healthy state and hence
@@ -165,7 +155,7 @@ func NewManager(log *logrus.Entry, c config.Config, db *sql.DB, queue datastore.
if c.Failover.Enabled && c.Failover.ElectionStrategy == "sql" {
strategies[virtualStorage.Name] = newSQLElector(virtualStorage.Name, c, db, log, ns)
} else {
- strategies[virtualStorage.Name] = newLocalElector(virtualStorage.Name, c.Failover.Enabled, c.Failover.ReadOnlyAfterFailover, log, ns)
+ strategies[virtualStorage.Name] = newLocalElector(virtualStorage.Name, c.Failover.Enabled, log, ns)
}
}
@@ -215,15 +205,6 @@ func (n *Mgr) GetShard(virtualStorageName string) (Shard, error) {
return strategy.GetShard()
}
-func (n *Mgr) EnableWrites(ctx context.Context, virtualStorageName string) error {
- strategy, ok := n.strategies[virtualStorageName]
- if !ok {
- return ErrVirtualStorageNotExist
- }
-
- return strategy.enableWrites(ctx)
-}
-
func (n *Mgr) GetSyncedNode(ctx context.Context, virtualStorageName, repoPath string) (Node, error) {
shard, err := n.GetShard(virtualStorageName)
if err != nil {
diff --git a/internal/praefect/nodes/manager_test.go b/internal/praefect/nodes/manager_test.go
index c268ad878..d5b535cf0 100644
--- a/internal/praefect/nodes/manager_test.go
+++ b/internal/praefect/nodes/manager_test.go
@@ -25,10 +25,8 @@ type nodeAssertion struct {
}
type shardAssertion struct {
- PreviousWritablePrimary *nodeAssertion
- IsReadOnly bool
- Primary *nodeAssertion
- Secondaries []nodeAssertion
+ Primary *nodeAssertion
+ Secondaries []nodeAssertion
}
func toNodeAssertion(n Node) *nodeAssertion {
@@ -51,10 +49,8 @@ func assertShard(t *testing.T, exp shardAssertion, act Shard) {
}
require.Equal(t, exp, shardAssertion{
- PreviousWritablePrimary: toNodeAssertion(act.PreviousWritablePrimary),
- IsReadOnly: act.IsReadOnly,
- Primary: toNodeAssertion(act.Primary),
- Secondaries: actSecondaries,
+ Primary: toNodeAssertion(act.Primary),
+ Secondaries: actSecondaries,
})
}
@@ -210,7 +206,7 @@ func TestNodeManager(t *testing.T) {
confWithFailover := config.Config{
VirtualStorages: virtualStorages,
- Failover: config.Failover{Enabled: true, ReadOnlyAfterFailover: true},
+ Failover: config.Failover{Enabled: true},
}
confWithoutFailover := config.Config{
VirtualStorages: virtualStorages,
@@ -277,11 +273,8 @@ func TestNodeManager(t *testing.T) {
// shard with failover should have promoted a secondary to primary and demoted the primary to a secondary
assertShard(t, shardAssertion{
- // previous write enabled primary should have been recorded
- PreviousWritablePrimary: &nodeAssertion{node1.Storage, node1.Address},
- IsReadOnly: true,
- Primary: &nodeAssertion{node2.Storage, node2.Address},
- Secondaries: []nodeAssertion{{node1.Storage, node1.Address}},
+ Primary: &nodeAssertion{node2.Storage, node2.Address},
+ Secondaries: []nodeAssertion{{node1.Storage, node1.Address}},
}, shard)
// failing back to the original primary
@@ -293,23 +286,8 @@ func TestNodeManager(t *testing.T) {
require.NoError(t, err)
assertShard(t, shardAssertion{
- // previous rw primary is now the primary again, field remains the same
- // as node2 was not write enabled
- PreviousWritablePrimary: &nodeAssertion{node1.Storage, node1.Address},
- IsReadOnly: true,
- Primary: &nodeAssertion{node1.Storage, node1.Address},
- Secondaries: []nodeAssertion{{node2.Storage, node2.Address}},
- }, shard)
-
- require.NoError(t, nm.EnableWrites(context.Background(), "virtual-storage-0"))
- shard, err = nm.GetShard("virtual-storage-0")
- require.NoError(t, err)
-
- assertShard(t, shardAssertion{
- PreviousWritablePrimary: &nodeAssertion{node1.Storage, node1.Address},
- IsReadOnly: false,
- Primary: &nodeAssertion{node1.Storage, node1.Address},
- Secondaries: []nodeAssertion{{node2.Storage, node2.Address}},
+ Primary: &nodeAssertion{node1.Storage, node1.Address},
+ Secondaries: []nodeAssertion{{node2.Storage, node2.Address}},
}, shard)
healthSrv0.SetServingStatus("", grpc_health_v1.HealthCheckResponse_UNKNOWN)
@@ -318,8 +296,6 @@ func TestNodeManager(t *testing.T) {
_, err = nm.GetShard("virtual-storage-0")
require.Error(t, err, "should return error since no nodes are healthy")
- require.Equal(t, ErrPrimaryNotHealthy, nm.EnableWrites(context.Background(), "virtual-storage-0"),
- "should not be able to enable writes with unhealthy master")
}
func TestMgr_GetSyncedNode(t *testing.T) {
diff --git a/internal/praefect/nodes/sql_elector.go b/internal/praefect/nodes/sql_elector.go
index 38b74bbd2..502fa4681 100644
--- a/internal/praefect/nodes/sql_elector.go
+++ b/internal/praefect/nodes/sql_elector.go
@@ -74,14 +74,13 @@ type sqlCandidate struct {
// set, mutator RPCs against the storage shard should be blocked in order to prevent new primary from
// diverging from the previous primary before data recovery attempts have been made.
type sqlElector struct {
- m sync.RWMutex
- praefectName string
- shardName string
- nodes []*sqlCandidate
- primaryNode *sqlCandidate
- db *sql.DB
- log logrus.FieldLogger
- readOnlyAfterFailover bool
+ m sync.RWMutex
+ praefectName string
+ shardName string
+ nodes []*sqlCandidate
+ primaryNode *sqlCandidate
+ db *sql.DB
+ log logrus.FieldLogger
}
func newSQLElector(name string, c config.Config, db *sql.DB, log logrus.FieldLogger, ns []*nodeStatus) *sqlElector {
@@ -97,13 +96,12 @@ func newSQLElector(name string, c config.Config, db *sql.DB, log logrus.FieldLog
}
return &sqlElector{
- praefectName: praefectName,
- shardName: name,
- db: db,
- log: log,
- nodes: nodes,
- primaryNode: nodes[0],
- readOnlyAfterFailover: c.Failover.ReadOnlyAfterFailover,
+ praefectName: praefectName,
+ shardName: name,
+ db: db,
+ log: log,
+ nodes: nodes,
+ primaryNode: nodes[0],
}
}
@@ -184,7 +182,7 @@ func (s *sqlElector) checkNodes(ctx context.Context) error {
// The attempt to elect a primary may have conflicted with another
// node attempting to elect a primary. We check the database again
// to see the current state.
- candidate, _, _, err := s.lookupPrimary()
+ candidate, err := s.lookupPrimary()
if err != nil {
s.log.WithError(err).Error("error looking up primary")
return err
@@ -250,7 +248,7 @@ last_contact_attempt_at = NOW()`
// GetShard gets the current status of the shard. ErrPrimaryNotHealthy
// is returned if a primary does not exist.
func (s *sqlElector) GetShard() (Shard, error) {
- primary, readOnly, prevWritablePrimary, err := s.lookupPrimary()
+ primary, err := s.lookupPrimary()
if err != nil {
return Shard{}, err
}
@@ -268,10 +266,8 @@ func (s *sqlElector) GetShard() (Shard, error) {
}
return Shard{
- PreviousWritablePrimary: prevWritablePrimary,
- IsReadOnly: readOnly,
- Primary: primary,
- Secondaries: secondaries,
+ Primary: primary,
+ Secondaries: secondaries,
}, nil
}
@@ -436,15 +432,10 @@ func (s *sqlElector) electNewPrimary(candidates []*sqlCandidate) error {
DO UPDATE SET elected_by_praefect = EXCLUDED.elected_by_praefect
, node_name = EXCLUDED.node_name
, elected_at = EXCLUDED.elected_at
- , read_only = $5
, demoted = false
- , previous_writable_primary = CASE WHEN shard_primaries.read_only
- THEN shard_primaries.previous_writable_primary
- ELSE shard_primaries.node_name
- END
WHERE shard_primaries.elected_at < now() - INTERVAL '1 MICROSECOND' * $4
`
- _, err = s.db.Exec(q, s.praefectName, s.shardName, newPrimaryStorage, failoverTimeout.Microseconds(), s.readOnlyAfterFailover)
+ _, err = s.db.Exec(q, s.praefectName, s.shardName, newPrimaryStorage, failoverTimeout.Microseconds())
if err != nil {
s.log.Errorf("error updating new primary: %s", err)
return err
@@ -453,19 +444,6 @@ func (s *sqlElector) electNewPrimary(candidates []*sqlCandidate) error {
return nil
}
-func (s *sqlElector) enableWrites(ctx context.Context) error {
- const q = "UPDATE shard_primaries SET read_only = false WHERE shard_name = $1 AND demoted = false"
- if rslt, err := s.db.ExecContext(ctx, q, s.shardName); err != nil {
- return err
- } else if n, err := rslt.RowsAffected(); err != nil {
- return err
- } else if n == 0 {
- return ErrPrimaryNotHealthy
- }
-
- return nil
-}
-
func (s *sqlElector) validateAndUpdatePrimary() error {
quorumCount, err := s.getQuorumCount()
@@ -509,8 +487,7 @@ func (s *sqlElector) validateAndUpdatePrimary() error {
}
// Check if primary is in this list
- primaryNode, _, _, err := s.lookupPrimary()
-
+ primaryNode, err := s.lookupPrimary()
if err != nil {
s.log.WithError(err).Error("error looking up primary")
return err
@@ -527,34 +504,21 @@ func (s *sqlElector) validateAndUpdatePrimary() error {
return nil
}
-func (s *sqlElector) lookupPrimary() (*sqlCandidate, bool, Node, error) {
- var (
- primaryName string
- readOnly bool
- prevWritablePrimaryName sql.NullString
- )
-
- const q = `SELECT node_name, read_only, previous_writable_primary FROM shard_primaries WHERE shard_name = $1 AND demoted = false`
- if err := s.db.QueryRow(q, s.shardName).Scan(&primaryName, &readOnly, &prevWritablePrimaryName); err != nil {
+func (s *sqlElector) lookupPrimary() (*sqlCandidate, error) {
+ var primaryName string
+ const q = `SELECT node_name FROM shard_primaries WHERE shard_name = $1 AND demoted = false`
+ if err := s.db.QueryRow(q, s.shardName).Scan(&primaryName); err != nil {
if err == sql.ErrNoRows {
- return nil, false, nil, nil
+ return nil, nil
}
- return nil, false, nil, fmt.Errorf("error looking up primary: %w", err)
+ return nil, fmt.Errorf("error looking up primary: %w", err)
}
var primaryNode *sqlCandidate
if primaryName != "" {
primaryNode = s.lookupNodeByName(primaryName)
- metrics.ReadOnlyGauge.WithLabelValues(s.shardName).Set(metrics.BoolAsFloat(readOnly))
- }
-
- var prevWritablePrimary Node
- if prevWritablePrimaryName.Valid {
- if cand := s.lookupNodeByName(prevWritablePrimaryName.String); cand != nil {
- prevWritablePrimary = cand.Node
- }
}
- return primaryNode, readOnly, prevWritablePrimary, nil
+ return primaryNode, nil
}
diff --git a/internal/praefect/nodes/sql_elector_test.go b/internal/praefect/nodes/sql_elector_test.go
index a3bb5db96..6bef5c45c 100644
--- a/internal/praefect/nodes/sql_elector_test.go
+++ b/internal/praefect/nodes/sql_elector_test.go
@@ -68,12 +68,7 @@ func TestBasicFailover(t *testing.T) {
praefectSocket := testhelper.GetTemporaryGitalySocketFileName()
socketName := "unix://" + praefectSocket
- conf := config.Config{
- SocketPath: socketName,
- Failover: config.Failover{
- ReadOnlyAfterFailover: true,
- },
- }
+ conf := config.Config{SocketPath: socketName}
internalSocket0, internalSocket1 := testhelper.GetTemporaryGitalySocketFileName(), testhelper.GetTemporaryGitalySocketFileName()
srv0, healthSrv0 := testhelper.NewServerWithHealth(t, internalSocket0)
@@ -117,7 +112,6 @@ func TestBasicFailover(t *testing.T) {
shard, err := elector.GetShard()
require.NoError(t, err)
assertShard(t, shardAssertion{
- IsReadOnly: false,
Primary: &nodeAssertion{cs0.GetStorage(), cs0.GetAddress()},
Secondaries: []nodeAssertion{{cs1.GetStorage(), cs1.GetAddress()}},
}, shard)
@@ -132,7 +126,6 @@ func TestBasicFailover(t *testing.T) {
shard, err = elector.GetShard()
require.NoError(t, err)
assertShard(t, shardAssertion{
- IsReadOnly: false,
Primary: &nodeAssertion{cs0.GetStorage(), cs0.GetAddress()},
Secondaries: []nodeAssertion{{cs1.GetStorage(), cs1.GetAddress()}},
}, shard)
@@ -149,11 +142,8 @@ func TestBasicFailover(t *testing.T) {
shard, err = elector.GetShard()
require.NoError(t, err)
assertShard(t, shardAssertion{
- // previous primary was write-enabled, so we should record it
- PreviousWritablePrimary: &nodeAssertion{cs0.GetStorage(), cs0.GetAddress()},
- IsReadOnly: true,
- Primary: &nodeAssertion{cs1.GetStorage(), cs1.GetAddress()},
- Secondaries: []nodeAssertion{{cs0.GetStorage(), cs0.GetAddress()}},
+ Primary: &nodeAssertion{cs1.GetStorage(), cs1.GetAddress()},
+ Secondaries: []nodeAssertion{{cs0.GetStorage(), cs0.GetAddress()}},
}, shard)
// Failover back to the original node
@@ -166,24 +156,8 @@ func TestBasicFailover(t *testing.T) {
shard, err = elector.GetShard()
require.NoError(t, err)
assertShard(t, shardAssertion{
- // failing back to the original node means the primary is the same as the
- // previous write-enabled primary. Node 2 was read-only, so field is not
- // modified
- PreviousWritablePrimary: &nodeAssertion{cs0.GetStorage(), cs0.GetAddress()},
- IsReadOnly: true,
- Primary: &nodeAssertion{cs0.GetStorage(), cs0.GetAddress()},
- Secondaries: []nodeAssertion{{cs1.GetStorage(), cs1.GetAddress()}},
- }, shard)
-
- // We should be able to enable writes on the new primary
- require.NoError(t, elector.enableWrites(ctx))
- shard, err = elector.GetShard()
- require.NoError(t, err)
- assertShard(t, shardAssertion{
- PreviousWritablePrimary: &nodeAssertion{cs0.GetStorage(), cs0.GetAddress()},
- IsReadOnly: false,
- Primary: &nodeAssertion{cs0.GetStorage(), cs0.GetAddress()},
- Secondaries: []nodeAssertion{{cs1.GetStorage(), cs1.GetAddress()}},
+ Primary: &nodeAssertion{cs0.GetStorage(), cs0.GetAddress()},
+ Secondaries: []nodeAssertion{{cs1.GetStorage(), cs1.GetAddress()}},
}, shard)
// Bring second node down
@@ -195,8 +169,6 @@ func TestBasicFailover(t *testing.T) {
// No new candidates
_, err = elector.GetShard()
require.Error(t, ErrPrimaryNotHealthy, err)
- require.Error(t, ErrPrimaryNotHealthy, elector.enableWrites(ctx),
- "shouldn't be able to enable writes with unhealthy master")
}
func TestElectDemotedPrimary(t *testing.T) {
@@ -214,13 +186,13 @@ func TestElectDemotedPrimary(t *testing.T) {
candidates := []*sqlCandidate{{Node: &nodeStatus{node: node}}}
require.NoError(t, elector.electNewPrimary(candidates))
- primary, _, _, err := elector.lookupPrimary()
+ primary, err := elector.lookupPrimary()
require.NoError(t, err)
require.Equal(t, node.Storage, primary.GetStorage())
require.NoError(t, elector.demotePrimary())
- primary, _, _, err = elector.lookupPrimary()
+ primary, err = elector.lookupPrimary()
require.NoError(t, err)
require.Nil(t, primary)
@@ -228,7 +200,7 @@ func TestElectDemotedPrimary(t *testing.T) {
require.NoError(t, err)
require.NoError(t, elector.electNewPrimary(candidates))
- primary, _, _, err = elector.lookupPrimary()
+ primary, err = elector.lookupPrimary()
require.NoError(t, err)
require.Equal(t, node.Storage, primary.GetStorage())
}
@@ -373,14 +345,12 @@ func TestElectNewPrimary(t *testing.T) {
t.Run(testCase.desc, func(t *testing.T) {
db.TruncateAll(t)
- conf := config.Config{Failover: config.Failover{ReadOnlyAfterFailover: true}}
- elector := newSQLElector(shardName, conf, db.DB, testhelper.DiscardTestLogger(t), ns)
+ elector := newSQLElector(shardName, config.Config{}, db.DB, testhelper.DiscardTestLogger(t), ns)
require.NoError(t, elector.electNewPrimary(candidates))
- primary, readOnly, _, err := elector.lookupPrimary()
+ primary, err := elector.lookupPrimary()
require.NoError(t, err)
require.Equal(t, "gitaly-1", primary.GetStorage(), "since replication queue is empty the first candidate should be chosen")
- require.False(t, readOnly)
predateElection(t, db, shardName, failoverTimeout)
_, err = db.Exec(testCase.initialReplQueueInsert)
@@ -392,10 +362,9 @@ func TestElectNewPrimary(t *testing.T) {
elector.log = logger
require.NoError(t, elector.electNewPrimary(candidates))
- primary, readOnly, _, err = elector.lookupPrimary()
+ primary, err = elector.lookupPrimary()
require.NoError(t, err)
require.Equal(t, testCase.expectedPrimary, primary.GetStorage())
- require.True(t, readOnly)
incompleteCounts := hook.LastEntry().Data["incomplete_counts"].([]targetNodeIncompleteCounts)
require.Equal(t, testCase.incompleteCounts, incompleteCounts)
diff --git a/internal/praefect/replicator.go b/internal/praefect/replicator.go
index d126798a1..109acab65 100644
--- a/internal/praefect/replicator.go
+++ b/internal/praefect/replicator.go
@@ -468,12 +468,7 @@ func (r ReplMgr) processBacklog(ctx context.Context, b BackoffFunc, virtualStora
if err != nil {
logger.WithError(err).Error("error when getting primary and secondaries")
} else {
- targetNodes := shard.Secondaries
- if shard.IsReadOnly {
- targetNodes = append(targetNodes, shard.Primary)
- }
-
- for _, target := range targetNodes {
+ for _, target := range append(shard.Secondaries, shard.Primary) {
totalEvents += r.handleNode(ctx, logger, shard, virtualStorage, target)
}
}
diff --git a/internal/praefect/replicator_test.go b/internal/praefect/replicator_test.go
index 7b713dbeb..af11ca524 100644
--- a/internal/praefect/replicator_test.go
+++ b/internal/praefect/replicator_test.go
@@ -729,7 +729,6 @@ func TestProcessBacklog_ReplicatesToReadOnlyPrimary(t *testing.T) {
GetShardFunc: func(vs string) (nodes.Shard, error) {
require.Equal(t, virtualStorage, vs)
return nodes.Shard{
- IsReadOnly: true,
Primary: &nodes.MockNode{
StorageName: primaryStorage,
Conn: primaryConn,
diff --git a/internal/praefect/service/info/server.go b/internal/praefect/service/info/server.go
index 3c1cb20ea..8b93072cd 100644
--- a/internal/praefect/service/info/server.go
+++ b/internal/praefect/service/info/server.go
@@ -2,7 +2,6 @@ package info
import (
"context"
- "errors"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/internal/praefect/config"
@@ -30,18 +29,6 @@ func NewServer(nodeMgr nodes.Manager, conf config.Config, queue datastore.Replic
}
}
-func (s *Server) EnableWrites(ctx context.Context, req *gitalypb.EnableWritesRequest) (*gitalypb.EnableWritesResponse, error) {
- if err := s.nodeMgr.EnableWrites(ctx, req.GetVirtualStorage()); err != nil {
- if errors.Is(err, nodes.ErrVirtualStorageNotExist) {
- return nil, helper.ErrInvalidArgument(err)
- }
-
- return nil, helper.ErrInternal(err)
- }
-
- return &gitalypb.EnableWritesResponse{}, nil
-}
-
func (s *Server) SetAuthoritativeStorage(ctx context.Context, req *gitalypb.SetAuthoritativeStorageRequest) (*gitalypb.SetAuthoritativeStorageResponse, error) {
storages := s.conf.StorageNames()[req.VirtualStorage]
if storages == nil {
diff --git a/internal/praefect/service/server/info.go b/internal/praefect/service/server/info.go
index d72c14a25..30c17374e 100644
--- a/internal/praefect/service/server/info.go
+++ b/internal/praefect/service/server/info.go
@@ -69,7 +69,7 @@ func (s *Server) ServerInfo(ctx context.Context, in *gitalypb.ServerInfoRequest)
// From the perspective of the praefect client, the primary internal gitaly node's storage status is equivalent
// to the virtual storage's storage status.
storageStatuses[i].StorageName = virtualStorage.Name
- storageStatuses[i].Writeable = !shard.IsReadOnly && storageStatus.Writeable
+ storageStatuses[i].Writeable = storageStatus.Writeable
storageStatuses[i].ReplicationFactor = replicas
break
}
diff --git a/proto/go/gitalypb/praefect.pb.go b/proto/go/gitalypb/praefect.pb.go
index 06703bb14..3e156657d 100644
--- a/proto/go/gitalypb/praefect.pb.go
+++ b/proto/go/gitalypb/praefect.pb.go
@@ -110,77 +110,6 @@ func (m *SetAuthoritativeStorageResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_SetAuthoritativeStorageResponse proto.InternalMessageInfo
-type EnableWritesRequest struct {
- // virtual_storage is the name of the virtual storage to enable writes for.
- VirtualStorage string `protobuf:"bytes,1,opt,name=virtual_storage,json=virtualStorage,proto3" json:"virtual_storage,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *EnableWritesRequest) Reset() { *m = EnableWritesRequest{} }
-func (m *EnableWritesRequest) String() string { return proto.CompactTextString(m) }
-func (*EnableWritesRequest) ProtoMessage() {}
-func (*EnableWritesRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_d32bf44842ead735, []int{2}
-}
-
-func (m *EnableWritesRequest) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_EnableWritesRequest.Unmarshal(m, b)
-}
-func (m *EnableWritesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_EnableWritesRequest.Marshal(b, m, deterministic)
-}
-func (m *EnableWritesRequest) XXX_Merge(src proto.Message) {
- xxx_messageInfo_EnableWritesRequest.Merge(m, src)
-}
-func (m *EnableWritesRequest) XXX_Size() int {
- return xxx_messageInfo_EnableWritesRequest.Size(m)
-}
-func (m *EnableWritesRequest) XXX_DiscardUnknown() {
- xxx_messageInfo_EnableWritesRequest.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_EnableWritesRequest proto.InternalMessageInfo
-
-func (m *EnableWritesRequest) GetVirtualStorage() string {
- if m != nil {
- return m.VirtualStorage
- }
- return ""
-}
-
-type EnableWritesResponse struct {
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *EnableWritesResponse) Reset() { *m = EnableWritesResponse{} }
-func (m *EnableWritesResponse) String() string { return proto.CompactTextString(m) }
-func (*EnableWritesResponse) ProtoMessage() {}
-func (*EnableWritesResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_d32bf44842ead735, []int{3}
-}
-
-func (m *EnableWritesResponse) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_EnableWritesResponse.Unmarshal(m, b)
-}
-func (m *EnableWritesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_EnableWritesResponse.Marshal(b, m, deterministic)
-}
-func (m *EnableWritesResponse) XXX_Merge(src proto.Message) {
- xxx_messageInfo_EnableWritesResponse.Merge(m, src)
-}
-func (m *EnableWritesResponse) XXX_Size() int {
- return xxx_messageInfo_EnableWritesResponse.Size(m)
-}
-func (m *EnableWritesResponse) XXX_DiscardUnknown() {
- xxx_messageInfo_EnableWritesResponse.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_EnableWritesResponse proto.InternalMessageInfo
-
type DatalossCheckRequest struct {
VirtualStorage string `protobuf:"bytes,1,opt,name=virtual_storage,json=virtualStorage,proto3" json:"virtual_storage,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -192,7 +121,7 @@ func (m *DatalossCheckRequest) Reset() { *m = DatalossCheckRequest{} }
func (m *DatalossCheckRequest) String() string { return proto.CompactTextString(m) }
func (*DatalossCheckRequest) ProtoMessage() {}
func (*DatalossCheckRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_d32bf44842ead735, []int{4}
+ return fileDescriptor_d32bf44842ead735, []int{2}
}
func (m *DatalossCheckRequest) XXX_Unmarshal(b []byte) error {
@@ -234,7 +163,7 @@ func (m *DatalossCheckResponse) Reset() { *m = DatalossCheckResponse{} }
func (m *DatalossCheckResponse) String() string { return proto.CompactTextString(m) }
func (*DatalossCheckResponse) ProtoMessage() {}
func (*DatalossCheckResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_d32bf44842ead735, []int{5}
+ return fileDescriptor_d32bf44842ead735, []int{3}
}
func (m *DatalossCheckResponse) XXX_Unmarshal(b []byte) error {
@@ -283,7 +212,7 @@ func (m *DatalossCheckResponse_Repository) Reset() { *m = DatalossCheckR
func (m *DatalossCheckResponse_Repository) String() string { return proto.CompactTextString(m) }
func (*DatalossCheckResponse_Repository) ProtoMessage() {}
func (*DatalossCheckResponse_Repository) Descriptor() ([]byte, []int) {
- return fileDescriptor_d32bf44842ead735, []int{5, 0}
+ return fileDescriptor_d32bf44842ead735, []int{3, 0}
}
func (m *DatalossCheckResponse_Repository) XXX_Unmarshal(b []byte) error {
@@ -334,7 +263,7 @@ func (m *DatalossCheckResponse_Repository_Storage) Reset() {
func (m *DatalossCheckResponse_Repository_Storage) String() string { return proto.CompactTextString(m) }
func (*DatalossCheckResponse_Repository_Storage) ProtoMessage() {}
func (*DatalossCheckResponse_Repository_Storage) Descriptor() ([]byte, []int) {
- return fileDescriptor_d32bf44842ead735, []int{5, 0, 0}
+ return fileDescriptor_d32bf44842ead735, []int{3, 0, 0}
}
func (m *DatalossCheckResponse_Repository_Storage) XXX_Unmarshal(b []byte) error {
@@ -380,7 +309,7 @@ func (m *RepositoryReplicasRequest) Reset() { *m = RepositoryReplicasReq
func (m *RepositoryReplicasRequest) String() string { return proto.CompactTextString(m) }
func (*RepositoryReplicasRequest) ProtoMessage() {}
func (*RepositoryReplicasRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_d32bf44842ead735, []int{6}
+ return fileDescriptor_d32bf44842ead735, []int{4}
}
func (m *RepositoryReplicasRequest) XXX_Unmarshal(b []byte) error {
@@ -420,7 +349,7 @@ func (m *RepositoryReplicasResponse) Reset() { *m = RepositoryReplicasRe
func (m *RepositoryReplicasResponse) String() string { return proto.CompactTextString(m) }
func (*RepositoryReplicasResponse) ProtoMessage() {}
func (*RepositoryReplicasResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_d32bf44842ead735, []int{7}
+ return fileDescriptor_d32bf44842ead735, []int{5}
}
func (m *RepositoryReplicasResponse) XXX_Unmarshal(b []byte) error {
@@ -471,7 +400,7 @@ func (m *RepositoryReplicasResponse_RepositoryDetails) String() string {
}
func (*RepositoryReplicasResponse_RepositoryDetails) ProtoMessage() {}
func (*RepositoryReplicasResponse_RepositoryDetails) Descriptor() ([]byte, []int) {
- return fileDescriptor_d32bf44842ead735, []int{7, 0}
+ return fileDescriptor_d32bf44842ead735, []int{5, 0}
}
func (m *RepositoryReplicasResponse_RepositoryDetails) XXX_Unmarshal(b []byte) error {
@@ -527,7 +456,7 @@ func (m *ConsistencyCheckRequest) Reset() { *m = ConsistencyCheckRequest
func (m *ConsistencyCheckRequest) String() string { return proto.CompactTextString(m) }
func (*ConsistencyCheckRequest) ProtoMessage() {}
func (*ConsistencyCheckRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_d32bf44842ead735, []int{8}
+ return fileDescriptor_d32bf44842ead735, []int{6}
}
func (m *ConsistencyCheckRequest) XXX_Unmarshal(b []byte) error {
@@ -594,7 +523,7 @@ func (m *ConsistencyCheckResponse) Reset() { *m = ConsistencyCheckRespon
func (m *ConsistencyCheckResponse) String() string { return proto.CompactTextString(m) }
func (*ConsistencyCheckResponse) ProtoMessage() {}
func (*ConsistencyCheckResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_d32bf44842ead735, []int{9}
+ return fileDescriptor_d32bf44842ead735, []int{7}
}
func (m *ConsistencyCheckResponse) XXX_Unmarshal(b []byte) error {
@@ -653,8 +582,6 @@ func (m *ConsistencyCheckResponse) GetReferenceStorage() string {
func init() {
proto.RegisterType((*SetAuthoritativeStorageRequest)(nil), "gitaly.SetAuthoritativeStorageRequest")
proto.RegisterType((*SetAuthoritativeStorageResponse)(nil), "gitaly.SetAuthoritativeStorageResponse")
- proto.RegisterType((*EnableWritesRequest)(nil), "gitaly.EnableWritesRequest")
- proto.RegisterType((*EnableWritesResponse)(nil), "gitaly.EnableWritesResponse")
proto.RegisterType((*DatalossCheckRequest)(nil), "gitaly.DatalossCheckRequest")
proto.RegisterType((*DatalossCheckResponse)(nil), "gitaly.DatalossCheckResponse")
proto.RegisterType((*DatalossCheckResponse_Repository)(nil), "gitaly.DatalossCheckResponse.Repository")
@@ -669,55 +596,52 @@ func init() {
func init() { proto.RegisterFile("praefect.proto", fileDescriptor_d32bf44842ead735) }
var fileDescriptor_d32bf44842ead735 = []byte{
- // 754 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 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0x67, 0x59,
- 0xb3, 0x81, 0xe9, 0xe8, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe5, 0x56, 0xd8, 0xc4, 0x64, 0x08,
- 0x00, 0x00,
+ // 715 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4d, 0x6e, 0xd3, 0x40,
+ 0x18, 0x95, 0x9d, 0xd0, 0xba, 0x5f, 0xfa, 0x93, 0x0e, 0x2d, 0x0d, 0x06, 0xda, 0xd4, 0x08, 0x1a,
+ 0x89, 0x36, 0xa9, 0x52, 0x24, 0x24, 0x76, 0xb4, 0x65, 0x51, 0x54, 0x41, 0xe5, 0x4a, 0x2c, 0xd8,
+ 0x58, 0x63, 0x67, 0x9a, 0x0c, 0x38, 0x1e, 0x33, 0x33, 0xa9, 0x94, 0x1b, 0x70, 0x03, 0x0e, 0xc0,
+ 0x8a, 0x05, 0x27, 0x40, 0x6c, 0xb9, 0x01, 0xc7, 0xe0, 0x02, 0xac, 0x90, 0xed, 0xb1, 0xeb, 0x24,
+ 0x4e, 0x8b, 0xc2, 0xce, 0xf3, 0xfd, 0xbc, 0x6f, 0xde, 0x7b, 0x33, 0x63, 0x58, 0x0e, 0x39, 0x26,
+ 0x17, 0xc4, 0x93, 0xcd, 0x90, 0x33, 0xc9, 0xd0, 0x5c, 0x97, 0x4a, 0xec, 0x0f, 0x4d, 0xf0, 0x69,
+ 0xa0, 0x62, 0xe6, 0xa2, 0xe8, 0x61, 0x4e, 0x3a, 0xc9, 0xca, 0xfa, 0xaa, 0xc1, 0xe6, 0x39, 0x91,
+ 0x2f, 0x06, 0xb2, 0xc7, 0x38, 0x95, 0x58, 0xd2, 0x4b, 0x72, 0x2e, 0x19, 0xc7, 0x5d, 0x62, 0x93,
+ 0x8f, 0x03, 0x22, 0x24, 0xda, 0x83, 0x95, 0x4b, 0xca, 0xe5, 0x00, 0xfb, 0x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0x5f, 0x6d, 0xab, 0xcb, 0xd4, 0x3a, 0x74, 0xdd, 0xb9, 0x38, 0x74, 0xf0, 0x37, 0x00,
+ 0x00, 0xff, 0xff, 0xb0, 0xb3, 0x43, 0x09, 0xb1, 0x07, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -741,9 +665,6 @@ type PraefectInfoServiceClient interface {
// DatalossCheck checks for nodes which are not up to date with the previous writable primary.
// This indicates possible data loss after a failover event.
DatalossCheck(ctx context.Context, in *DatalossCheckRequest, opts ...grpc.CallOption) (*DatalossCheckResponse, error)
- // EnableWrites enables writes for a storage that was switched to a read-only mode
- // following a failover.
- EnableWrites(ctx context.Context, in *EnableWritesRequest, opts ...grpc.CallOption) (*EnableWritesResponse, error)
// SetAuthoritativeStorage sets the authoritative storage for a repository on a given virtual storage.
// This causes the current version of the repository on the authoritative storage to be considered the
// latest and overwrite any other version on the virtual storage.
@@ -808,15 +729,6 @@ func (c *praefectInfoServiceClient) DatalossCheck(ctx context.Context, in *Datal
return out, nil
}
-func (c *praefectInfoServiceClient) EnableWrites(ctx context.Context, in *EnableWritesRequest, opts ...grpc.CallOption) (*EnableWritesResponse, error) {
- out := new(EnableWritesResponse)
- err := c.cc.Invoke(ctx, "/gitaly.PraefectInfoService/EnableWrites", in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
func (c *praefectInfoServiceClient) SetAuthoritativeStorage(ctx context.Context, in *SetAuthoritativeStorageRequest, opts ...grpc.CallOption) (*SetAuthoritativeStorageResponse, error) {
out := new(SetAuthoritativeStorageResponse)
err := c.cc.Invoke(ctx, "/gitaly.PraefectInfoService/SetAuthoritativeStorage", in, out, opts...)
@@ -837,9 +749,6 @@ type PraefectInfoServiceServer interface {
// DatalossCheck checks for nodes which are not up to date with the previous writable primary.
// This indicates possible data loss after a failover event.
DatalossCheck(context.Context, *DatalossCheckRequest) (*DatalossCheckResponse, error)
- // EnableWrites enables writes for a storage that was switched to a read-only mode
- // following a failover.
- EnableWrites(context.Context, *EnableWritesRequest) (*EnableWritesResponse, error)
// SetAuthoritativeStorage sets the authoritative storage for a repository on a given virtual storage.
// This causes the current version of the repository on the authoritative storage to be considered the
// latest and overwrite any other version on the virtual storage.
@@ -859,9 +768,6 @@ func (*UnimplementedPraefectInfoServiceServer) ConsistencyCheck(req *Consistency
func (*UnimplementedPraefectInfoServiceServer) DatalossCheck(ctx context.Context, req *DatalossCheckRequest) (*DatalossCheckResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DatalossCheck not implemented")
}
-func (*UnimplementedPraefectInfoServiceServer) EnableWrites(ctx context.Context, req *EnableWritesRequest) (*EnableWritesResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method EnableWrites not implemented")
-}
func (*UnimplementedPraefectInfoServiceServer) SetAuthoritativeStorage(ctx context.Context, req *SetAuthoritativeStorageRequest) (*SetAuthoritativeStorageResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetAuthoritativeStorage not implemented")
}
@@ -927,24 +833,6 @@ func _PraefectInfoService_DatalossCheck_Handler(srv interface{}, ctx context.Con
return interceptor(ctx, in, info, handler)
}
-func _PraefectInfoService_EnableWrites_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(EnableWritesRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(PraefectInfoServiceServer).EnableWrites(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/gitaly.PraefectInfoService/EnableWrites",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PraefectInfoServiceServer).EnableWrites(ctx, req.(*EnableWritesRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
func _PraefectInfoService_SetAuthoritativeStorage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetAuthoritativeStorageRequest)
if err := dec(in); err != nil {
@@ -976,10 +864,6 @@ var _PraefectInfoService_serviceDesc = grpc.ServiceDesc{
Handler: _PraefectInfoService_DatalossCheck_Handler,
},
{
- MethodName: "EnableWrites",
- Handler: _PraefectInfoService_EnableWrites_Handler,
- },
- {
MethodName: "SetAuthoritativeStorage",
Handler: _PraefectInfoService_SetAuthoritativeStorage_Handler,
},
diff --git a/proto/praefect.proto b/proto/praefect.proto
index 1e2f4ef45..aaad1570f 100644
--- a/proto/praefect.proto
+++ b/proto/praefect.proto
@@ -34,15 +34,6 @@ service PraefectInfoService {
};
}
- // EnableWrites enables writes for a storage that was switched to a read-only mode
- // following a failover.
- rpc EnableWrites(EnableWritesRequest) returns (EnableWritesResponse) {
- option (op_type) = {
- op: MUTATOR
- scope_level: STORAGE
- };
- }
-
// SetAuthoritativeStorage sets the authoritative storage for a repository on a given virtual storage.
// This causes the current version of the repository on the authoritative storage to be considered the
// latest and overwrite any other version on the virtual storage.
@@ -62,13 +53,6 @@ message SetAuthoritativeStorageRequest {
message SetAuthoritativeStorageResponse {}
-message EnableWritesRequest {
- // virtual_storage is the name of the virtual storage to enable writes for.
- string virtual_storage = 1 [(storage)=true];
-}
-
-message EnableWritesResponse {}
-
message DatalossCheckRequest {
string virtual_storage = 1 [(storage)=true];
}
diff --git a/ruby/proto/gitaly/praefect_pb.rb b/ruby/proto/gitaly/praefect_pb.rb
index cd8fb9abb..e4df490f0 100644
--- a/ruby/proto/gitaly/praefect_pb.rb
+++ b/ruby/proto/gitaly/praefect_pb.rb
@@ -13,11 +13,6 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
end
add_message "gitaly.SetAuthoritativeStorageResponse" do
end
- add_message "gitaly.EnableWritesRequest" do
- optional :virtual_storage, :string, 1
- end
- add_message "gitaly.EnableWritesResponse" do
- end
add_message "gitaly.DatalossCheckRequest" do
optional :virtual_storage, :string, 1
end
@@ -62,8 +57,6 @@ end
module Gitaly
SetAuthoritativeStorageRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.SetAuthoritativeStorageRequest").msgclass
SetAuthoritativeStorageResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.SetAuthoritativeStorageResponse").msgclass
- EnableWritesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.EnableWritesRequest").msgclass
- EnableWritesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.EnableWritesResponse").msgclass
DatalossCheckRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.DatalossCheckRequest").msgclass
DatalossCheckResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.DatalossCheckResponse").msgclass
DatalossCheckResponse::Repository = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.DatalossCheckResponse.Repository").msgclass
diff --git a/ruby/proto/gitaly/praefect_services_pb.rb b/ruby/proto/gitaly/praefect_services_pb.rb
index 97b1c9fa6..275b1c35e 100644
--- a/ruby/proto/gitaly/praefect_services_pb.rb
+++ b/ruby/proto/gitaly/praefect_services_pb.rb
@@ -23,9 +23,6 @@ module Gitaly
# DatalossCheck checks for nodes which are not up to date with the previous writable primary.
# This indicates possible data loss after a failover event.
rpc :DatalossCheck, DatalossCheckRequest, DatalossCheckResponse
- # EnableWrites enables writes for a storage that was switched to a read-only mode
- # following a failover.
- rpc :EnableWrites, EnableWritesRequest, EnableWritesResponse
# SetAuthoritativeStorage sets the authoritative storage for a repository on a given virtual storage.
# This causes the current version of the repository on the authoritative storage to be considered the
# latest and overwrite any other version on the virtual storage.