diff options
author | Toon Claes <toon@gitlab.com> | 2021-07-16 11:50:22 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2021-07-16 11:50:22 +0300 |
commit | 7ece1e42a36a60e2174041cf835eb8c88fea8adc (patch) | |
tree | cd2d704dc70b587d1a3d7b714f0614d013ad22a3 | |
parent | acd3f8e4903958d92ebece465453f2d14c22d177 (diff) | |
parent | 0c48ca9e3f368f03d0d78de0a31540d2fe248242 (diff) |
Merge branch 'smh-remove-reconcile-subcmd' into 'master'
Remove `praefect reconcile` subcommand
Closes #3628 and #3558
See merge request gitlab-org/gitaly!3667
-rw-r--r-- | cmd/praefect/main.go | 24 | ||||
-rw-r--r-- | cmd/praefect/subcmd.go | 13 | ||||
-rw-r--r-- | cmd/praefect/subcmd_accept_dataloss_test.go | 2 | ||||
-rw-r--r-- | cmd/praefect/subcmd_dataloss_test.go | 2 | ||||
-rw-r--r-- | cmd/praefect/subcmd_reconcile.go | 210 | ||||
-rw-r--r-- | cmd/praefect/subcmd_set_replication_factor_test.go | 2 | ||||
-rw-r--r-- | internal/praefect/protoregistry/protoregistry_test.go | 1 | ||||
-rw-r--r-- | internal/praefect/server.go | 2 | ||||
-rw-r--r-- | internal/praefect/service/info/consistencycheck.go | 306 | ||||
-rw-r--r-- | internal/praefect/service/info/consistencycheck_test.go | 391 | ||||
-rw-r--r-- | internal/praefect/service/info/server.go | 4 | ||||
-rw-r--r-- | proto/go/gitalypb/praefect.pb.go | 352 | ||||
-rw-r--r-- | proto/go/gitalypb/praefect_grpc.pb.go | 74 | ||||
-rw-r--r-- | proto/praefect.proto | 32 | ||||
-rw-r--r-- | ruby/proto/gitaly/praefect_pb.rb | 16 | ||||
-rw-r--r-- | ruby/proto/gitaly/praefect_services_pb.rb | 5 |
16 files changed, 77 insertions, 1359 deletions
diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go index a906ee21c..d7b7fb4b5 100644 --- a/cmd/praefect/main.go +++ b/cmd/praefect/main.go @@ -34,30 +34,6 @@ // // praefect -config PATH_TO_CONFIG dial-nodes // -// Reconcile -// -// The subcommand "reconcile" performs a consistency check of a backend storage -// against the primary or another storage in the same virtual storage group. -// -// praefect -config PATH_TO_CONFIG reconcile -virtual <vstorage> -target -// <t-storage> [-reference <r-storage>] [-f] -// -// "-virtual" specifies which virtual storage the target and reference -// belong to. -// -// "-target" specifies the storage name of the backend Gitaly you wish to -// reconcile. -// -// "-reference" is an optional argument that specifies which storage location to -// check the target against. If an inconsistency is found, the target will -// attempt to repair itself using the reference as the source of truth. If the -// reference storage is omitted, Praefect will perform the check against the -// current primary. If the primary is the same as the target, an error will -// occur. -// -// By default, a dry-run is performed where no replications are scheduled. When -// the flag "-f" is provided, the replications will actually schedule. -// // Dataloss // // The subcommand "dataloss" identifies Gitaly nodes which are missing data from the diff --git a/cmd/praefect/subcmd.go b/cmd/praefect/subcmd.go index 70ddff3c1..dee97f487 100644 --- a/cmd/praefect/subcmd.go +++ b/cmd/praefect/subcmd.go @@ -3,6 +3,7 @@ package main import ( "context" "database/sql" + "errors" "flag" "fmt" "os" @@ -27,7 +28,6 @@ var ( "sql-ping": &sqlPingSubcommand{}, "sql-migrate": &sqlMigrateSubcommand{}, "dial-nodes": &dialNodesSubcommand{}, - "reconcile": &reconcileSubcommand{}, "sql-migrate-down": &sqlMigrateDownSubcommand{}, "sql-migrate-status": &sqlMigrateStatusSubcommand{}, "dataloss": newDatalossSubcommand(), @@ -67,6 +67,17 @@ func subCommand(conf config.Config, arg0 string, argRest []string) int { return 0 } +func getNodeAddress(cfg config.Config) (string, error) { + switch { + case cfg.SocketPath != "": + return "unix:" + cfg.SocketPath, nil + case cfg.ListenAddr != "": + return "tcp://" + cfg.ListenAddr, nil + default: + return "", errors.New("no Praefect address configured") + } +} + type sqlPingSubcommand struct{} func (s *sqlPingSubcommand) FlagSet() *flag.FlagSet { diff --git a/cmd/praefect/subcmd_accept_dataloss_test.go b/cmd/praefect/subcmd_accept_dataloss_test.go index c3e30c3f6..d1ca3f6c3 100644 --- a/cmd/praefect/subcmd_accept_dataloss_test.go +++ b/cmd/praefect/subcmd_accept_dataloss_test.go @@ -61,7 +61,7 @@ func TestAcceptDatalossSubcommand(t *testing.T) { }, } - ln, clean := listenAndServe(t, []svcRegistrar{registerPraefectInfoServer(info.NewServer(nil, conf, q, rs, nil, nil, nil))}) + ln, clean := listenAndServe(t, []svcRegistrar{registerPraefectInfoServer(info.NewServer(conf, q, rs, nil, nil, nil))}) defer clean() conf.SocketPath = ln.Addr().String() diff --git a/cmd/praefect/subcmd_dataloss_test.go b/cmd/praefect/subcmd_dataloss_test.go index bfe7c03b3..870914d74 100644 --- a/cmd/praefect/subcmd_dataloss_test.go +++ b/cmd/praefect/subcmd_dataloss_test.go @@ -86,7 +86,7 @@ func TestDatalossSubcommand(t *testing.T) { require.NoError(t, gs.SetGeneration(ctx, "virtual-storage-1", "repository-2", "gitaly-3", 0)) ln, clean := listenAndServe(t, []svcRegistrar{ - registerPraefectInfoServer(info.NewServer(nil, cfg, nil, gs, nil, nil, nil))}) + registerPraefectInfoServer(info.NewServer(cfg, nil, gs, nil, nil, nil))}) defer clean() for _, tc := range []struct { desc string diff --git a/cmd/praefect/subcmd_reconcile.go b/cmd/praefect/subcmd_reconcile.go deleted file mode 100644 index 47917501f..000000000 --- a/cmd/praefect/subcmd_reconcile.go +++ /dev/null @@ -1,210 +0,0 @@ -package main - -import ( - "bytes" - "context" - "errors" - "flag" - "fmt" - "io" - "log" - - "gitlab.com/gitlab-org/gitaly/v14/internal/praefect/config" - "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" -) - -type nodeReconciler struct { - conf config.Config - virtualStorage string - targetStorage string - referenceStorage string - disableReconciliation bool -} - -type reconcileSubcommand struct { - virtual string - target string - reference string - force bool -} - -func (s *reconcileSubcommand) FlagSet() *flag.FlagSet { - fs := flag.NewFlagSet("reconcile", flag.ExitOnError) - fs.StringVar(&s.virtual, "virtual", "", "virtual storage for target storage") - fs.StringVar(&s.target, "target", "", "target storage to reconcile") - fs.StringVar(&s.reference, "reference", "", "reference storage to reconcile (optional)") - fs.BoolVar(&s.force, "f", false, "actually schedule replications") - return fs -} - -func (s *reconcileSubcommand) Exec(flags *flag.FlagSet, conf config.Config) error { - logger.Warn("The reconcile sub-command has been deprecated in GitLab 13.12 and is scheduled for removal in GitLab 14.0. Use the automatic reconciler instead: https://docs.gitlab.com/ee/administration/gitaly/praefect.html#automatic-reconciliation") - - nr := nodeReconciler{ - conf: conf, - virtualStorage: s.virtual, - targetStorage: s.target, - referenceStorage: s.reference, - disableReconciliation: !s.force, - } - - if err := nr.reconcile(); err != nil { - return fmt.Errorf("unable to reconcile: %s", err) - } - - return nil -} - -func getNodeAddress(cfg config.Config) (string, error) { - switch { - case cfg.SocketPath != "": - return "unix:" + cfg.SocketPath, nil - case cfg.ListenAddr != "": - return "tcp://" + cfg.ListenAddr, nil - default: - return "", errors.New("no Praefect address configured") - } -} - -func (nr nodeReconciler) reconcile() error { - if err := nr.validateArgs(); err != nil { - return err - } - - nodeAddr, err := getNodeAddress(nr.conf) - if err != nil { - return err - } - - cc, err := subCmdDial(nodeAddr, nr.conf.Auth.Token) - if err != nil { - return err - } - - pCli := gitalypb.NewPraefectInfoServiceClient(cc) - - if nr.disableReconciliation { - log.Print("Performing a DRY RUN - no changes will be made until '-f' flag is provided") - } else { - log.Print("Performing a LIVE RUN - any repositories on target that are inconsistent with reference will be overwritten with the version present on reference") - } - - request := &gitalypb.ConsistencyCheckRequest{ - VirtualStorage: nr.virtualStorage, - TargetStorage: nr.targetStorage, - ReferenceStorage: nr.referenceStorage, - DisableReconcilliation: nr.disableReconciliation, - } - stream, err := pCli.ConsistencyCheck(context.TODO(), request) - if err != nil { - return err - } - - log.Print("Checking consistency...") - if err := nr.consumeStream(stream); err != nil { - return err - } - - return nil -} - -func (nr nodeReconciler) validateArgs() error { - var vsFound, tFound, rFound bool - - for _, vs := range nr.conf.VirtualStorages { - if vs.Name != nr.virtualStorage { - continue - } - vsFound = true - - for _, n := range vs.Nodes { - if n.Storage == nr.targetStorage { - tFound = true - } - if n.Storage == nr.referenceStorage { - rFound = true - } - } - } - - if !vsFound { - return fmt.Errorf( - "cannot find virtual storage %s in config", nr.virtualStorage, - ) - } - if !tFound { - return fmt.Errorf( - "cannot find target storage %s in virtual storage %q in config", - nr.targetStorage, nr.virtualStorage, - ) - } - if nr.referenceStorage != "" && !rFound { - return fmt.Errorf( - "cannot find reference storage %q in virtual storage %q in config", - nr.referenceStorage, nr.virtualStorage, - ) - } - - return nil -} - -func (nr nodeReconciler) consumeStream(stream gitalypb.PraefectInfoService_ConsistencyCheckClient) error { - var rStorage string - var i uint - - for ; ; i++ { - resp, err := stream.Recv() - if err == io.EOF { - break - } - if err != nil { - return err - } - - if resp.ReferenceStorage != rStorage { - rStorage = resp.ReferenceStorage - log.Print("Reference storage being used: " + rStorage) - } - - if len(resp.Errors) > 0 { - var composedErrMsg bytes.Buffer - for _, errMsg := range resp.Errors { - composedErrMsg.WriteString("\t") - composedErrMsg.WriteString(errMsg) - composedErrMsg.WriteString("\n") - } - log.Printf("FAILURE: Internal error(s) occurred for the repo %s: %s", resp.GetRepoRelativePath(), composedErrMsg.String()) - continue - } - - if resp.GetReferenceChecksum() == resp.GetTargetChecksum() { - log.Print("CONSISTENT: " + resp.GetRepoRelativePath()) - continue - } - - checksumPrint := func(checksum string) string { - if checksum == "" { - return "null" - } - return checksum - } - - log.Printf( - "INCONSISTENT: Repo %s has checksum %s on target but checksum %s on reference storage %s", - resp.GetRepoRelativePath(), - checksumPrint(resp.GetTargetChecksum()), - checksumPrint(resp.GetReferenceChecksum()), - resp.GetReferenceStorage(), - ) - if resp.GetReplJobId() != 0 { - log.Printf( - "SCHEDULED: Replication job %d will update repo %s", - resp.GetReplJobId(), - resp.GetRepoRelativePath(), - ) - } - } - - log.Printf("FINISHED: %d repos were checked for consistency", i) - return nil -} diff --git a/cmd/praefect/subcmd_set_replication_factor_test.go b/cmd/praefect/subcmd_set_replication_factor_test.go index f2598f192..741bc8745 100644 --- a/cmd/praefect/subcmd_set_replication_factor_test.go +++ b/cmd/praefect/subcmd_set_replication_factor_test.go @@ -94,7 +94,7 @@ func TestSetReplicationFactorSubcommand(t *testing.T) { ) ln, clean := listenAndServe(t, []svcRegistrar{registerPraefectInfoServer( - info.NewServer(nil, config.Config{}, nil, nil, store, nil, nil), + info.NewServer(config.Config{}, nil, nil, store, nil, nil), )}) defer clean() diff --git a/internal/praefect/protoregistry/protoregistry_test.go b/internal/praefect/protoregistry/protoregistry_test.go index 9ba516579..b4ae7a167 100644 --- a/internal/praefect/protoregistry/protoregistry_test.go +++ b/internal/praefect/protoregistry/protoregistry_test.go @@ -185,7 +185,6 @@ func TestNewProtoRegistry_IsInterceptedMethod(t *testing.T) { }, "PraefectInfoService": { "RepositoryReplicas", - "ConsistencyCheck", "DatalossCheck", "SetAuthoritativeStorage", }, diff --git a/internal/praefect/server.go b/internal/praefect/server.go index bb5db95a1..017d6742f 100644 --- a/internal/praefect/server.go +++ b/internal/praefect/server.go @@ -154,7 +154,7 @@ func registerServices( ) { // ServerServiceServer is necessary for the ServerInfo RPC gitalypb.RegisterServerServiceServer(srv, server.NewServer(conf, conns)) - gitalypb.RegisterPraefectInfoServiceServer(srv, info.NewServer(nm, conf, queue, rs, assignmentStore, conns, primaryGetter)) + gitalypb.RegisterPraefectInfoServiceServer(srv, info.NewServer(conf, queue, rs, assignmentStore, conns, primaryGetter)) gitalypb.RegisterRefTransactionServer(srv, transaction.NewServer(tm)) healthpb.RegisterHealthServer(srv, health.NewServer()) diff --git a/internal/praefect/service/info/consistencycheck.go b/internal/praefect/service/info/consistencycheck.go deleted file mode 100644 index 549dcba7a..000000000 --- a/internal/praefect/service/info/consistencycheck.go +++ /dev/null @@ -1,306 +0,0 @@ -package info - -import ( - "context" - "errors" - "io" - - "gitlab.com/gitlab-org/gitaly/v14/internal/helper" - "gitlab.com/gitlab-org/gitaly/v14/internal/middleware/metadatahandler" - "gitlab.com/gitlab-org/gitaly/v14/internal/praefect/config" - "gitlab.com/gitlab-org/gitaly/v14/internal/praefect/datastore" - "gitlab.com/gitlab-org/gitaly/v14/internal/praefect/nodes" - "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" - "gitlab.com/gitlab-org/labkit/correlation" - "golang.org/x/sync/errgroup" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -var errRepositorySpecificPrimariesUnsupported = status.Error(codes.FailedPrecondition, "`praefect reconcile` should not be used with repository specific primaries enabled. Please enable automatic reconciler instead.") - -var errReconciliationInternal = errors.New("internal error(s) occurred during execution") - -func (s *Server) validateConsistencyCheckRequest(req *gitalypb.ConsistencyCheckRequest) error { - if s.conf.Failover.ElectionStrategy == config.ElectionStrategyPerRepository { - return errRepositorySpecificPrimariesUnsupported - } - - if req.GetTargetStorage() == "" { - return status.Error(codes.InvalidArgument, "missing target storage") - } - if req.GetVirtualStorage() == "" { - return status.Error(codes.InvalidArgument, "missing virtual storage") - } - if req.GetReferenceStorage() == req.GetTargetStorage() { - return status.Errorf( - codes.InvalidArgument, - "target storage %q cannot match reference storage %q", - req.GetTargetStorage(), req.GetReferenceStorage(), - ) - } - - return nil -} - -func (s *Server) getNodes(ctx context.Context, req *gitalypb.ConsistencyCheckRequest) (target, reference nodes.Node, _ error) { - shard, err := s.nodeMgr.GetShard(ctx, req.GetVirtualStorage()) - if err != nil { - return nil, nil, status.Error(codes.NotFound, err.Error()) - } - - // search for target node amongst all nodes in shard - for _, n := range append(shard.Secondaries, shard.Primary) { - if n.GetStorage() == req.GetTargetStorage() { - target = n - break - } - } - if target == nil { - return nil, nil, status.Errorf( - codes.NotFound, - "unable to find target storage %q", - req.GetTargetStorage(), - ) - } - - // set reference node to default or requested storage - switch { - case req.GetReferenceStorage() == "" && req.GetTargetStorage() == shard.Primary.GetStorage(): - return nil, nil, status.Errorf( - codes.InvalidArgument, - "target storage %q is same as current primary, must provide alternate reference", - req.GetTargetStorage(), - ) - case req.GetReferenceStorage() == "": - reference = shard.Primary // default - case req.GetReferenceStorage() != "": - for _, secondary := range append(shard.Secondaries, shard.Primary) { - if secondary.GetStorage() == req.GetReferenceStorage() { - reference = secondary - break - } - } - if reference == nil { - return nil, nil, status.Errorf( - codes.NotFound, - "unable to find reference storage %q in nodes for shard %q", - req.GetReferenceStorage(), - req.GetVirtualStorage(), - ) - } - } - - return target, reference, nil -} - -func walkRepos(ctx context.Context, walkerQ chan<- string, reference nodes.Node) error { - defer close(walkerQ) - - iClient := gitalypb.NewInternalGitalyClient(reference.GetConnection()) - req := &gitalypb.WalkReposRequest{ - StorageName: reference.GetStorage(), - } - - walkStream, err := iClient.WalkRepos(ctx, req) - if err != nil { - return err - } - - for { - resp, err := walkStream.Recv() - if err == io.EOF { - return nil - } - if err != nil { - return err - } - - select { - case <-ctx.Done(): - return ctx.Err() - case walkerQ <- resp.GetRelativePath(): - } - } -} - -func checksumRepo(ctx context.Context, relpath string, node nodes.Node) (string, error) { - cli := gitalypb.NewRepositoryServiceClient(node.GetConnection()) - resp, err := cli.CalculateChecksum(ctx, &gitalypb.CalculateChecksumRequest{ - Repository: &gitalypb.Repository{ - RelativePath: relpath, - StorageName: node.GetStorage(), - }, - }) - if err != nil { - return "", err - } - - return resp.GetChecksum(), nil -} - -type checksumResult struct { - virtualStorage string - relativePath string - target string - reference string - targetStorage string - referenceStorage string - errs []error -} - -func checksumRepos(ctx context.Context, relpathQ <-chan string, checksumResultQ chan<- checksumResult, target, reference nodes.Node, virtualStorage string) error { - defer close(checksumResultQ) - - for { - var repoRelPath string - select { - case <-ctx.Done(): - return ctx.Err() - case repoPath, ok := <-relpathQ: - if !ok { - return nil - } - repoRelPath = repoPath - } - - cs := checksumResult{ - virtualStorage: virtualStorage, - relativePath: repoRelPath, - targetStorage: target.GetStorage(), - referenceStorage: reference.GetStorage(), - } - - g, gctx := errgroup.WithContext(ctx) - - var targetErr error - g.Go(func() error { - cs.target, targetErr = checksumRepo(gctx, repoRelPath, target) - if status.Code(targetErr) == codes.NotFound { - // missing repo on target is okay, we need to - // replicate from reference - targetErr = nil - return nil - } - return targetErr - }) - - var referenceErr error - g.Go(func() error { - cs.reference, referenceErr = checksumRepo(gctx, repoRelPath, reference) - return referenceErr - }) - - if err := g.Wait(); err != nil { - // we don't care about err as it is one of the targetErr or referenceErr - // and we return it back to the caller to make the opeartion execution more verbose - if targetErr != nil { - cs.errs = append(cs.errs, targetErr) - } - - if referenceErr != nil { - cs.errs = append(cs.errs, referenceErr) - } - } - - select { - case <-ctx.Done(): - return ctx.Err() - case checksumResultQ <- cs: - } - } -} - -func scheduleReplication(ctx context.Context, csr checksumResult, q datastore.ReplicationEventQueue, resp *gitalypb.ConsistencyCheckResponse) error { - event, err := q.Enqueue(ctx, datastore.ReplicationEvent{ - Job: datastore.ReplicationJob{ - Change: datastore.UpdateRepo, - VirtualStorage: csr.virtualStorage, - RelativePath: csr.relativePath, - TargetNodeStorage: csr.targetStorage, - SourceNodeStorage: csr.referenceStorage, - }, - Meta: datastore.Params{metadatahandler.CorrelationIDKey: correlation.ExtractFromContext(ctx)}, - }) - - if err != nil { - return err - } - - resp.ReplJobId = event.ID - - return nil -} - -func ensureConsistency(ctx context.Context, disableReconcile bool, checksumResultQ <-chan checksumResult, q datastore.ReplicationEventQueue, stream gitalypb.PraefectInfoService_ConsistencyCheckServer) error { - var erroneous bool - for { - var csr checksumResult - select { - case res, ok := <-checksumResultQ: - if !ok { - if erroneous { - return helper.ErrInternal(errReconciliationInternal) - } - return nil - } - csr = res - case <-ctx.Done(): - return ctx.Err() - } - - resp := &gitalypb.ConsistencyCheckResponse{ - RepoRelativePath: csr.relativePath, - ReferenceChecksum: csr.reference, - TargetChecksum: csr.target, - ReferenceStorage: csr.referenceStorage, - } - for _, err := range csr.errs { - resp.Errors = append(resp.Errors, err.Error()) - erroneous = true - } - - if csr.reference != csr.target && !disableReconcile { - if err := scheduleReplication(ctx, csr, q, resp); err != nil { - resp.Errors = append(resp.Errors, err.Error()) - erroneous = true - } - } - - if err := stream.Send(resp); err != nil { - return err - } - } -} - -func (s *Server) ConsistencyCheck(req *gitalypb.ConsistencyCheckRequest, stream gitalypb.PraefectInfoService_ConsistencyCheckServer) error { - if err := s.validateConsistencyCheckRequest(req); err != nil { - return err - } - - g, ctx := errgroup.WithContext(stream.Context()) - - // target is the node we are checking, reference is the node we are - // checking against (e.g. the primary node) - target, reference, err := s.getNodes(ctx, req) - if err != nil { - return err - } - - walkerQ := make(chan string) - checksumResultQ := make(chan checksumResult) - - // the following goroutines form a pipeline where data flows from top - // to bottom - g.Go(func() error { - return walkRepos(ctx, walkerQ, reference) - }) - g.Go(func() error { - return checksumRepos(ctx, walkerQ, checksumResultQ, target, reference, req.GetVirtualStorage()) - }) - g.Go(func() error { - return ensureConsistency(ctx, req.GetDisableReconcilliation(), checksumResultQ, s.queue, stream) - }) - - return g.Wait() -} diff --git a/internal/praefect/service/info/consistencycheck_test.go b/internal/praefect/service/info/consistencycheck_test.go deleted file mode 100644 index 5c7664bf2..000000000 --- a/internal/praefect/service/info/consistencycheck_test.go +++ /dev/null @@ -1,391 +0,0 @@ -package info - -import ( - "context" - "fmt" - "io" - "net" - "os" - "path/filepath" - "strings" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitaly/v14/client" - "gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest" - "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/setup" - "gitlab.com/gitlab-org/gitaly/v14/internal/praefect/config" - "gitlab.com/gitlab-org/gitaly/v14/internal/praefect/datastore" - "gitlab.com/gitlab-org/gitaly/v14/internal/praefect/nodes" - "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper" - "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert" - "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testcfg" - "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver" - "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func TestServer_ConsistencyCheck_repositorySpecificPrimariesUnsupported(t *testing.T) { - require.Equal( - t, - errRepositorySpecificPrimariesUnsupported, - NewServer(nil, - config.Config{ - Failover: config.Failover{ElectionStrategy: config.ElectionStrategyPerRepository}, - }, nil, nil, nil, nil, nil, - ).ConsistencyCheck(nil, nil), - ) -} - -func TestServer_ConsistencyCheck(t *testing.T) { - const ( - firstRepoPath = "1.git" - secondRepoPath = "2.git" - thirdRepoPath = "3.git" - - checksum = "13d09299a4516e741be34e3252e3a35041b6b062" - - targetStorageName = "target" - referenceStorageName = "reference" - - virtualStorage = "virtualStorage" - ) - - referenceCfg := testcfg.Build(t, testcfg.WithStorages(referenceStorageName)) - targetCfg := testcfg.Build(t, testcfg.WithStorages(targetStorageName)) - - // firstRepoPath exists on both storages and has same state - gittest.CloneRepoAtStorage(t, referenceCfg, referenceCfg.Storages[0], firstRepoPath) - gittest.CloneRepoAtStorage(t, targetCfg, targetCfg.Storages[0], firstRepoPath) - - referenceAddr := testserver.RunGitalyServer(t, referenceCfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) - targetGitaly := testserver.StartGitalyServer(t, targetCfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) - - conf := config.Config{VirtualStorages: []*config.VirtualStorage{{ - Name: virtualStorage, - Nodes: []*config.Node{ - {Storage: referenceCfg.Storages[0].Name, Address: referenceAddr}, - {Storage: targetCfg.Storages[0].Name, Address: targetGitaly.Address()}, - }, - }}} - - ctx, cancel := testhelper.Context() - defer cancel() - - referenceConn, err := client.Dial(referenceAddr, nil) - require.NoError(t, err) - defer referenceConn.Close() - targetConn, err := client.Dial(targetGitaly.Address(), nil) - require.NoError(t, err) - defer targetConn.Close() - - nm := &nodes.MockManager{ - GetShardFunc: func(s string) (nodes.Shard, error) { - if s != conf.VirtualStorages[0].Name { - return nodes.Shard{}, nodes.ErrVirtualStorageNotExist - } - return nodes.Shard{ - Primary: &nodes.MockNode{ - GetStorageMethod: func() string { return referenceCfg.Storages[0].Name }, - Conn: referenceConn, - Healthy: true, - }, - Secondaries: []nodes.Node{&nodes.MockNode{ - GetStorageMethod: func() string { return targetCfg.Storages[0].Name }, - Conn: targetConn, - Healthy: true, - }}, - }, nil - }, - } - - praefectAddr := testhelper.GetTemporaryGitalySocketFileName(t) - praefectListener, err := net.Listen("unix", praefectAddr) - require.NoError(t, err) - defer praefectListener.Close() - - queue := datastore.NewReplicationEventQueueInterceptor(datastore.NewMemoryReplicationEventQueue(conf)) - queue.OnEnqueue(func(ctx context.Context, e datastore.ReplicationEvent, q datastore.ReplicationEventQueue) (datastore.ReplicationEvent, error) { - if e.Job.RelativePath == secondRepoPath { - return datastore.ReplicationEvent{}, assert.AnError - } - return datastore.ReplicationEvent{ID: 1}, nil - }) - - // praefect instance setup - praefectSrv := grpc.NewServer() - defer praefectSrv.Stop() - - gitalypb.RegisterPraefectInfoServiceServer(praefectSrv, NewServer(nm, conf, queue, nil, nil, nil, nil)) - go praefectSrv.Serve(praefectListener) - - praefectConn, err := client.Dial("unix://"+praefectAddr, nil) - require.NoError(t, err) - defer praefectConn.Close() - - infoClient := gitalypb.NewPraefectInfoServiceClient(praefectConn) - - execAndVerify := func(t *testing.T, req *gitalypb.ConsistencyCheckRequest, verify func(*testing.T, []*gitalypb.ConsistencyCheckResponse, error)) { - t.Helper() - response, err := infoClient.ConsistencyCheck(ctx, req) - require.NoError(t, err) - - var results []*gitalypb.ConsistencyCheckResponse - var result *gitalypb.ConsistencyCheckResponse - for { - result, err = response.Recv() - if err != nil { - break - } - results = append(results, result) - } - - if err == io.EOF { - err = nil - } - verify(t, results, err) - } - - t.Run("all in sync", func(t *testing.T) { - req := &gitalypb.ConsistencyCheckRequest{ - VirtualStorage: virtualStorage, - TargetStorage: targetStorageName, - ReferenceStorage: referenceStorageName, - DisableReconcilliation: true, - } - - execAndVerify(t, req, func(t *testing.T, responses []*gitalypb.ConsistencyCheckResponse, err error) { - require.NoError(t, err) - testassert.ProtoEqual(t, []*gitalypb.ConsistencyCheckResponse{ - { - RepoRelativePath: firstRepoPath, - ReferenceStorage: referenceStorageName, - TargetChecksum: checksum, - ReferenceChecksum: checksum, - }, - }, responses) - }) - }) - - // secondRepoPath generates an error, but it should not stop other repositories from being processed. - // Order does matter for the test to verify the flow. - gittest.CloneRepoAtStorage(t, referenceCfg, referenceCfg.Storages[0], secondRepoPath) - // thirdRepoPath exists only on the reference storage (where traversal happens). - gittest.CloneRepoAtStorage(t, referenceCfg, referenceCfg.Storages[0], thirdRepoPath) - // not.git is a folder on the reference storage that should be skipped as it is not a git repository. - require.NoError(t, os.MkdirAll(filepath.Join(referenceCfg.Storages[0].Path, "not.git"), os.ModePerm)) - - expErrStatus := status.Error(codes.Internal, errReconciliationInternal.Error()) - - for _, tc := range []struct { - desc string - req *gitalypb.ConsistencyCheckRequest - verify func(*testing.T, []*gitalypb.ConsistencyCheckResponse, error) - }{ - { - desc: "with replication event created", - req: &gitalypb.ConsistencyCheckRequest{ - VirtualStorage: virtualStorage, - TargetStorage: targetStorageName, - ReferenceStorage: referenceStorageName, - DisableReconcilliation: false, - }, - verify: func(t *testing.T, resp []*gitalypb.ConsistencyCheckResponse, err error) { - testassert.GrpcEqualErr(t, expErrStatus, err) - testassert.ProtoEqual(t, []*gitalypb.ConsistencyCheckResponse{ - { - RepoRelativePath: firstRepoPath, - TargetChecksum: checksum, - ReferenceChecksum: checksum, - ReplJobId: 0, - ReferenceStorage: referenceStorageName, - }, - { - RepoRelativePath: secondRepoPath, - TargetChecksum: "", - ReferenceChecksum: checksum, - ReplJobId: 0, - ReferenceStorage: referenceStorageName, - Errors: []string{assert.AnError.Error()}, - }, - { - RepoRelativePath: thirdRepoPath, - TargetChecksum: "", - ReferenceChecksum: checksum, - ReplJobId: 1, - ReferenceStorage: referenceStorageName, - }, - }, resp) - }, - }, - { - desc: "without replication event", - req: &gitalypb.ConsistencyCheckRequest{ - VirtualStorage: virtualStorage, - TargetStorage: targetStorageName, - ReferenceStorage: referenceStorageName, - DisableReconcilliation: true, - }, - verify: func(t *testing.T, resp []*gitalypb.ConsistencyCheckResponse, err error) { - require.NoError(t, err) - testassert.ProtoEqual(t, []*gitalypb.ConsistencyCheckResponse{ - { - RepoRelativePath: firstRepoPath, - TargetChecksum: checksum, - ReferenceChecksum: checksum, - ReplJobId: 0, - ReferenceStorage: referenceStorageName, - }, - { - RepoRelativePath: secondRepoPath, - TargetChecksum: "", - ReferenceChecksum: checksum, - ReplJobId: 0, - ReferenceStorage: referenceStorageName, - }, - { - RepoRelativePath: thirdRepoPath, - TargetChecksum: "", - ReferenceChecksum: checksum, - ReplJobId: 0, - ReferenceStorage: referenceStorageName, - }, - }, resp) - }, - }, - { - desc: "no target", - req: &gitalypb.ConsistencyCheckRequest{ - VirtualStorage: virtualStorage, - TargetStorage: "", - ReferenceStorage: targetStorageName, - }, - verify: func(t *testing.T, resp []*gitalypb.ConsistencyCheckResponse, err error) { - testassert.GrpcEqualErr(t, status.Error(codes.InvalidArgument, "missing target storage"), err) - }, - }, - { - desc: "unknown target", - req: &gitalypb.ConsistencyCheckRequest{ - VirtualStorage: virtualStorage, - TargetStorage: "unknown", - ReferenceStorage: targetStorageName, - }, - verify: func(t *testing.T, resp []*gitalypb.ConsistencyCheckResponse, err error) { - testassert.GrpcEqualErr(t, status.Error(codes.NotFound, `unable to find target storage "unknown"`), err) - }, - }, - { - desc: "no reference", - req: &gitalypb.ConsistencyCheckRequest{ - VirtualStorage: virtualStorage, - TargetStorage: referenceStorageName, - ReferenceStorage: "", - }, - verify: func(t *testing.T, resp []*gitalypb.ConsistencyCheckResponse, err error) { - expErr := status.Error( - codes.InvalidArgument, - fmt.Sprintf(`target storage %q is same as current primary, must provide alternate reference`, referenceStorageName), - ) - testassert.GrpcEqualErr(t, expErr, err) - }, - }, - { - desc: "unknown reference", - req: &gitalypb.ConsistencyCheckRequest{ - VirtualStorage: virtualStorage, - TargetStorage: referenceStorageName, - ReferenceStorage: "unknown", - }, - verify: func(t *testing.T, resp []*gitalypb.ConsistencyCheckResponse, err error) { - expErr := status.Error( - codes.NotFound, - fmt.Sprintf(`unable to find reference storage "unknown" in nodes for shard %q`, virtualStorage), - ) - testassert.GrpcEqualErr(t, expErr, err) - }, - }, - { - desc: "same storage", - req: &gitalypb.ConsistencyCheckRequest{ - VirtualStorage: virtualStorage, - TargetStorage: referenceStorageName, - ReferenceStorage: referenceStorageName, - }, - verify: func(t *testing.T, resp []*gitalypb.ConsistencyCheckResponse, err error) { - expErr := status.Error( - codes.InvalidArgument, - fmt.Sprintf(`target storage %q cannot match reference storage %q`, referenceStorageName, referenceStorageName), - ) - testassert.GrpcEqualErr(t, expErr, err) - }, - }, - { - desc: "no virtual", - req: &gitalypb.ConsistencyCheckRequest{ - VirtualStorage: "", - TargetStorage: referenceStorageName, - ReferenceStorage: targetStorageName, - }, - verify: func(t *testing.T, resp []*gitalypb.ConsistencyCheckResponse, err error) { - testassert.GrpcEqualErr(t, status.Error(codes.InvalidArgument, "missing virtual storage"), err) - }, - }, - { - desc: "unknown virtual", - req: &gitalypb.ConsistencyCheckRequest{ - VirtualStorage: "unknown", - TargetStorage: referenceStorageName, - ReferenceStorage: "unknown", - }, - verify: func(t *testing.T, resp []*gitalypb.ConsistencyCheckResponse, err error) { - testassert.GrpcEqualErr(t, status.Error(codes.NotFound, "virtual storage does not exist"), err) - }, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - execAndVerify(t, tc.req, tc.verify) - }) - } - - // this case needs to be the last as it terminates one of the gitaly instances - t.Run("one of gitalies is unreachable", func(t *testing.T) { - targetGitaly.Shutdown() - - req := &gitalypb.ConsistencyCheckRequest{ - VirtualStorage: virtualStorage, - TargetStorage: targetStorageName, - ReferenceStorage: referenceStorageName, - DisableReconcilliation: true, - } - - execAndVerify(t, req, func(t *testing.T, responses []*gitalypb.ConsistencyCheckResponse, err error) { - t.Helper() - testassert.GrpcEqualErr(t, expErrStatus, err) - errs := []string{ - fmt.Sprintf("rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial unix //%s: connect: no such file or directory\"", strings.TrimPrefix(targetGitaly.Address(), "unix://")), - "rpc error: code = Canceled desc = context canceled", - } - testassert.ProtoEqual(t, []*gitalypb.ConsistencyCheckResponse{ - { - RepoRelativePath: firstRepoPath, - ReferenceStorage: referenceStorageName, - Errors: errs, - }, - { - RepoRelativePath: secondRepoPath, - ReferenceStorage: referenceStorageName, - Errors: errs, - }, - { - RepoRelativePath: thirdRepoPath, - ReferenceStorage: referenceStorageName, - Errors: errs, - }, - }, responses) - }) - }) -} diff --git a/internal/praefect/service/info/server.go b/internal/praefect/service/info/server.go index 0a81c8cf3..fec5396a8 100644 --- a/internal/praefect/service/info/server.go +++ b/internal/praefect/service/info/server.go @@ -6,7 +6,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/helper" "gitlab.com/gitlab-org/gitaly/v14/internal/praefect/config" "gitlab.com/gitlab-org/gitaly/v14/internal/praefect/datastore" - "gitlab.com/gitlab-org/gitaly/v14/internal/praefect/nodes" "gitlab.com/gitlab-org/gitaly/v14/internal/praefect/service" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" ) @@ -35,7 +34,6 @@ type PrimaryGetter interface { // Server is a InfoService server type Server struct { gitalypb.UnimplementedPraefectInfoServiceServer - nodeMgr nodes.Manager conf config.Config queue datastore.ReplicationEventQueue rs datastore.RepositoryStore @@ -46,7 +44,6 @@ type Server struct { // NewServer creates a new instance of a grpc InfoServiceServer func NewServer( - nodeMgr nodes.Manager, conf config.Config, queue datastore.ReplicationEventQueue, rs datastore.RepositoryStore, @@ -55,7 +52,6 @@ func NewServer( primaryGetter PrimaryGetter, ) gitalypb.PraefectInfoServiceServer { return &Server{ - nodeMgr: nodeMgr, conf: conf, queue: queue, rs: rs, diff --git a/proto/go/gitalypb/praefect.pb.go b/proto/go/gitalypb/praefect.pb.go index 3049f8b73..9fdc2d146 100644 --- a/proto/go/gitalypb/praefect.pb.go +++ b/proto/go/gitalypb/praefect.pb.go @@ -444,175 +444,6 @@ func (x *RepositoryReplicasResponse) GetReplicas() []*RepositoryReplicasResponse return nil } -type ConsistencyCheckRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - VirtualStorage string `protobuf:"bytes,1,opt,name=virtual_storage,json=virtualStorage,proto3" json:"virtual_storage,omitempty"` - // The target storage is the storage you wish to check for inconsistencies - // against a reference storage (typically the current primary). - TargetStorage string `protobuf:"bytes,2,opt,name=target_storage,json=targetStorage,proto3" json:"target_storage,omitempty"` - // Optionally provide a reference storage to compare the target storage - // against. If a reference storage is omitted, the current primary will be - // used. - ReferenceStorage string `protobuf:"bytes,3,opt,name=reference_storage,json=referenceStorage,proto3" json:"reference_storage,omitempty"` - // Be default, reconcilliation is enabled. Disabling reconcilliation will - // make the request side-effect free. - DisableReconcilliation bool `protobuf:"varint,4,opt,name=disable_reconcilliation,json=disableReconcilliation,proto3" json:"disable_reconcilliation,omitempty"` -} - -func (x *ConsistencyCheckRequest) Reset() { - *x = ConsistencyCheckRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_praefect_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ConsistencyCheckRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ConsistencyCheckRequest) ProtoMessage() {} - -func (x *ConsistencyCheckRequest) ProtoReflect() protoreflect.Message { - mi := &file_praefect_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ConsistencyCheckRequest.ProtoReflect.Descriptor instead. -func (*ConsistencyCheckRequest) Descriptor() ([]byte, []int) { - return file_praefect_proto_rawDescGZIP(), []int{8} -} - -func (x *ConsistencyCheckRequest) GetVirtualStorage() string { - if x != nil { - return x.VirtualStorage - } - return "" -} - -func (x *ConsistencyCheckRequest) GetTargetStorage() string { - if x != nil { - return x.TargetStorage - } - return "" -} - -func (x *ConsistencyCheckRequest) GetReferenceStorage() string { - if x != nil { - return x.ReferenceStorage - } - return "" -} - -func (x *ConsistencyCheckRequest) GetDisableReconcilliation() bool { - if x != nil { - return x.DisableReconcilliation - } - return false -} - -type ConsistencyCheckResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RepoRelativePath string `protobuf:"bytes,1,opt,name=repo_relative_path,json=repoRelativePath,proto3" json:"repo_relative_path,omitempty"` - TargetChecksum string `protobuf:"bytes,2,opt,name=target_checksum,json=targetChecksum,proto3" json:"target_checksum,omitempty"` - ReferenceChecksum string `protobuf:"bytes,3,opt,name=reference_checksum,json=referenceChecksum,proto3" json:"reference_checksum,omitempty"` - // If resync was enabled, then each inconsistency will schedule a replication - // job. A replication ID is returned to track the corresponding job. - ReplJobId uint64 `protobuf:"varint,4,opt,name=repl_job_id,json=replJobId,proto3" json:"repl_job_id,omitempty"` - // If the reference storage was not specified, reply with the reference used - ReferenceStorage string `protobuf:"bytes,5,opt,name=reference_storage,json=referenceStorage,proto3" json:"reference_storage,omitempty"` - // The list of errors that appeared during the operation execution for the current repository. - Errors []string `protobuf:"bytes,6,rep,name=errors,proto3" json:"errors,omitempty"` -} - -func (x *ConsistencyCheckResponse) Reset() { - *x = ConsistencyCheckResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_praefect_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ConsistencyCheckResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ConsistencyCheckResponse) ProtoMessage() {} - -func (x *ConsistencyCheckResponse) ProtoReflect() protoreflect.Message { - mi := &file_praefect_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ConsistencyCheckResponse.ProtoReflect.Descriptor instead. -func (*ConsistencyCheckResponse) Descriptor() ([]byte, []int) { - return file_praefect_proto_rawDescGZIP(), []int{9} -} - -func (x *ConsistencyCheckResponse) GetRepoRelativePath() string { - if x != nil { - return x.RepoRelativePath - } - return "" -} - -func (x *ConsistencyCheckResponse) GetTargetChecksum() string { - if x != nil { - return x.TargetChecksum - } - return "" -} - -func (x *ConsistencyCheckResponse) GetReferenceChecksum() string { - if x != nil { - return x.ReferenceChecksum - } - return "" -} - -func (x *ConsistencyCheckResponse) GetReplJobId() uint64 { - if x != nil { - return x.ReplJobId - } - return 0 -} - -func (x *ConsistencyCheckResponse) GetReferenceStorage() string { - if x != nil { - return x.ReferenceStorage - } - return "" -} - -func (x *ConsistencyCheckResponse) GetErrors() []string { - if x != nil { - return x.Errors - } - return nil -} - type DatalossCheckResponse_Repository struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -631,7 +462,7 @@ type DatalossCheckResponse_Repository struct { func (x *DatalossCheckResponse_Repository) Reset() { *x = DatalossCheckResponse_Repository{} if protoimpl.UnsafeEnabled { - mi := &file_praefect_proto_msgTypes[10] + mi := &file_praefect_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -644,7 +475,7 @@ func (x *DatalossCheckResponse_Repository) String() string { func (*DatalossCheckResponse_Repository) ProtoMessage() {} func (x *DatalossCheckResponse_Repository) ProtoReflect() protoreflect.Message { - mi := &file_praefect_proto_msgTypes[10] + mi := &file_praefect_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -708,7 +539,7 @@ type DatalossCheckResponse_Repository_Storage struct { func (x *DatalossCheckResponse_Repository_Storage) Reset() { *x = DatalossCheckResponse_Repository_Storage{} if protoimpl.UnsafeEnabled { - mi := &file_praefect_proto_msgTypes[11] + mi := &file_praefect_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -721,7 +552,7 @@ func (x *DatalossCheckResponse_Repository_Storage) String() string { func (*DatalossCheckResponse_Repository_Storage) ProtoMessage() {} func (x *DatalossCheckResponse_Repository_Storage) ProtoReflect() protoreflect.Message { - mi := &file_praefect_proto_msgTypes[11] + mi := &file_praefect_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -784,7 +615,7 @@ type RepositoryReplicasResponse_RepositoryDetails struct { func (x *RepositoryReplicasResponse_RepositoryDetails) Reset() { *x = RepositoryReplicasResponse_RepositoryDetails{} if protoimpl.UnsafeEnabled { - mi := &file_praefect_proto_msgTypes[12] + mi := &file_praefect_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -797,7 +628,7 @@ func (x *RepositoryReplicasResponse_RepositoryDetails) String() string { func (*RepositoryReplicasResponse_RepositoryDetails) ProtoMessage() {} func (x *RepositoryReplicasResponse_RepositoryDetails) ProtoReflect() protoreflect.Message { - mi := &file_praefect_proto_msgTypes[12] + mi := &file_praefect_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -918,72 +749,37 @@ var file_praefect_proto_rawDesc = []byte{ 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x22, 0xcf, 0x01, - 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x43, 0x68, 0x65, - 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x76, 0x69, 0x72, - 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0e, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x61, - 0x67, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x73, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x72, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x53, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x37, 0x0a, 0x17, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, - 0x65, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x6c, 0x69, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, - 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x6c, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0x85, 0x02, 0x0a, 0x18, 0x43, 0x6f, 0x6e, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x12, - 0x72, 0x65, 0x70, 0x6f, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, - 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x52, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x73, 0x75, 0x6d, 0x12, 0x2d, 0x0a, 0x12, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x11, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, - 0x75, 0x6d, 0x12, 0x1e, 0x0a, 0x0b, 0x72, 0x65, 0x70, 0x6c, 0x5f, 0x6a, 0x6f, 0x62, 0x5f, 0x69, - 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x4a, 0x6f, 0x62, - 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, - 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x72, - 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x32, 0xee, 0x03, 0x0a, 0x13, 0x50, 0x72, 0x61, 0x65, - 0x66, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x5b, 0x0a, 0x12, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x73, 0x12, 0x21, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, - 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, - 0x79, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x10, - 0x43, 0x6f, 0x6e, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x12, 0x1f, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x69, 0x73, - 0x74, 0x65, 0x6e, 0x63, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x20, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x69, - 0x73, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x4c, 0x0a, 0x0d, 0x44, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x73, - 0x73, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1c, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, - 0x44, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x44, 0x61, - 0x74, 0x61, 0x6c, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x17, 0x53, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x26, - 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x53, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, - 0x53, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, - 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x61, 0x0a, 0x14, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x23, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, - 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, - 0x61, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x67, - 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x1a, 0x04, 0xf0, 0x97, 0x28, 0x01, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x6c, - 0x61, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2d, 0x6f, 0x72, - 0x67, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2f, 0x76, 0x31, 0x34, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x70, 0x62, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x32, 0x95, 0x03, + 0x0a, 0x13, 0x50, 0x72, 0x61, 0x65, 0x66, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5b, 0x0a, 0x12, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x12, 0x21, 0x2e, 0x67, 0x69, + 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, + 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, + 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0d, 0x44, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x73, 0x73, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x12, 0x1c, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x44, 0x61, 0x74, + 0x61, 0x6c, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1d, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x6c, + 0x6f, 0x73, 0x73, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x6a, 0x0a, 0x17, 0x53, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x61, + 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x26, 0x2e, 0x67, 0x69, + 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x53, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x61, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x53, 0x65, 0x74, + 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x14, + 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, + 0x63, 0x74, 0x6f, 0x72, 0x12, 0x23, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x53, 0x65, + 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x63, 0x74, + 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x67, 0x69, 0x74, 0x61, + 0x6c, 0x79, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, + 0x04, 0xf0, 0x97, 0x28, 0x01, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x67, + 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2f, 0x76, 0x31, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -998,7 +794,7 @@ func file_praefect_proto_rawDescGZIP() []byte { return file_praefect_proto_rawDescData } -var file_praefect_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_praefect_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_praefect_proto_goTypes = []interface{}{ (*SetReplicationFactorRequest)(nil), // 0: gitaly.SetReplicationFactorRequest (*SetReplicationFactorResponse)(nil), // 1: gitaly.SetReplicationFactorResponse @@ -1008,32 +804,28 @@ var file_praefect_proto_goTypes = []interface{}{ (*DatalossCheckResponse)(nil), // 5: gitaly.DatalossCheckResponse (*RepositoryReplicasRequest)(nil), // 6: gitaly.RepositoryReplicasRequest (*RepositoryReplicasResponse)(nil), // 7: gitaly.RepositoryReplicasResponse - (*ConsistencyCheckRequest)(nil), // 8: gitaly.ConsistencyCheckRequest - (*ConsistencyCheckResponse)(nil), // 9: gitaly.ConsistencyCheckResponse - (*DatalossCheckResponse_Repository)(nil), // 10: gitaly.DatalossCheckResponse.Repository - (*DatalossCheckResponse_Repository_Storage)(nil), // 11: gitaly.DatalossCheckResponse.Repository.Storage - (*RepositoryReplicasResponse_RepositoryDetails)(nil), // 12: gitaly.RepositoryReplicasResponse.RepositoryDetails - (*Repository)(nil), // 13: gitaly.Repository + (*DatalossCheckResponse_Repository)(nil), // 8: gitaly.DatalossCheckResponse.Repository + (*DatalossCheckResponse_Repository_Storage)(nil), // 9: gitaly.DatalossCheckResponse.Repository.Storage + (*RepositoryReplicasResponse_RepositoryDetails)(nil), // 10: gitaly.RepositoryReplicasResponse.RepositoryDetails + (*Repository)(nil), // 11: gitaly.Repository } var file_praefect_proto_depIdxs = []int32{ - 10, // 0: gitaly.DatalossCheckResponse.repositories:type_name -> gitaly.DatalossCheckResponse.Repository - 13, // 1: gitaly.RepositoryReplicasRequest.repository:type_name -> gitaly.Repository - 12, // 2: gitaly.RepositoryReplicasResponse.primary:type_name -> gitaly.RepositoryReplicasResponse.RepositoryDetails - 12, // 3: gitaly.RepositoryReplicasResponse.replicas:type_name -> gitaly.RepositoryReplicasResponse.RepositoryDetails - 11, // 4: gitaly.DatalossCheckResponse.Repository.storages:type_name -> gitaly.DatalossCheckResponse.Repository.Storage - 13, // 5: gitaly.RepositoryReplicasResponse.RepositoryDetails.repository:type_name -> gitaly.Repository + 8, // 0: gitaly.DatalossCheckResponse.repositories:type_name -> gitaly.DatalossCheckResponse.Repository + 11, // 1: gitaly.RepositoryReplicasRequest.repository:type_name -> gitaly.Repository + 10, // 2: gitaly.RepositoryReplicasResponse.primary:type_name -> gitaly.RepositoryReplicasResponse.RepositoryDetails + 10, // 3: gitaly.RepositoryReplicasResponse.replicas:type_name -> gitaly.RepositoryReplicasResponse.RepositoryDetails + 9, // 4: gitaly.DatalossCheckResponse.Repository.storages:type_name -> gitaly.DatalossCheckResponse.Repository.Storage + 11, // 5: gitaly.RepositoryReplicasResponse.RepositoryDetails.repository:type_name -> gitaly.Repository 6, // 6: gitaly.PraefectInfoService.RepositoryReplicas:input_type -> gitaly.RepositoryReplicasRequest - 8, // 7: gitaly.PraefectInfoService.ConsistencyCheck:input_type -> gitaly.ConsistencyCheckRequest - 4, // 8: gitaly.PraefectInfoService.DatalossCheck:input_type -> gitaly.DatalossCheckRequest - 2, // 9: gitaly.PraefectInfoService.SetAuthoritativeStorage:input_type -> gitaly.SetAuthoritativeStorageRequest - 0, // 10: gitaly.PraefectInfoService.SetReplicationFactor:input_type -> gitaly.SetReplicationFactorRequest - 7, // 11: gitaly.PraefectInfoService.RepositoryReplicas:output_type -> gitaly.RepositoryReplicasResponse - 9, // 12: gitaly.PraefectInfoService.ConsistencyCheck:output_type -> gitaly.ConsistencyCheckResponse - 5, // 13: gitaly.PraefectInfoService.DatalossCheck:output_type -> gitaly.DatalossCheckResponse - 3, // 14: gitaly.PraefectInfoService.SetAuthoritativeStorage:output_type -> gitaly.SetAuthoritativeStorageResponse - 1, // 15: gitaly.PraefectInfoService.SetReplicationFactor:output_type -> gitaly.SetReplicationFactorResponse - 11, // [11:16] is the sub-list for method output_type - 6, // [6:11] is the sub-list for method input_type + 4, // 7: gitaly.PraefectInfoService.DatalossCheck:input_type -> gitaly.DatalossCheckRequest + 2, // 8: gitaly.PraefectInfoService.SetAuthoritativeStorage:input_type -> gitaly.SetAuthoritativeStorageRequest + 0, // 9: gitaly.PraefectInfoService.SetReplicationFactor:input_type -> gitaly.SetReplicationFactorRequest + 7, // 10: gitaly.PraefectInfoService.RepositoryReplicas:output_type -> gitaly.RepositoryReplicasResponse + 5, // 11: gitaly.PraefectInfoService.DatalossCheck:output_type -> gitaly.DatalossCheckResponse + 3, // 12: gitaly.PraefectInfoService.SetAuthoritativeStorage:output_type -> gitaly.SetAuthoritativeStorageResponse + 1, // 13: gitaly.PraefectInfoService.SetReplicationFactor:output_type -> gitaly.SetReplicationFactorResponse + 10, // [10:14] is the sub-list for method output_type + 6, // [6:10] is the sub-list for method input_type 6, // [6:6] is the sub-list for extension type_name 6, // [6:6] is the sub-list for extension extendee 0, // [0:6] is the sub-list for field type_name @@ -1144,30 +936,6 @@ func file_praefect_proto_init() { } } file_praefect_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConsistencyCheckRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_praefect_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConsistencyCheckResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_praefect_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DatalossCheckResponse_Repository); i { case 0: return &v.state @@ -1179,7 +947,7 @@ func file_praefect_proto_init() { return nil } } - file_praefect_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_praefect_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DatalossCheckResponse_Repository_Storage); i { case 0: return &v.state @@ -1191,7 +959,7 @@ func file_praefect_proto_init() { return nil } } - file_praefect_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_praefect_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RepositoryReplicasResponse_RepositoryDetails); i { case 0: return &v.state @@ -1210,7 +978,7 @@ func file_praefect_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_praefect_proto_rawDesc, NumEnums: 0, - NumMessages: 13, + NumMessages: 11, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/go/gitalypb/praefect_grpc.pb.go b/proto/go/gitalypb/praefect_grpc.pb.go index 5abdde92d..b09fcd6ae 100644 --- a/proto/go/gitalypb/praefect_grpc.pb.go +++ b/proto/go/gitalypb/praefect_grpc.pb.go @@ -19,11 +19,6 @@ const _ = grpc.SupportPackageIsVersion7 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type PraefectInfoServiceClient interface { RepositoryReplicas(ctx context.Context, in *RepositoryReplicasRequest, opts ...grpc.CallOption) (*RepositoryReplicasResponse, error) - // ConsistencyCheck will perform a consistency check on the requested - // virtual storage backend. A stream of repository statuses will be sent - // back indicating which repos are consistent with the primary and which ones - // need repair. - ConsistencyCheck(ctx context.Context, in *ConsistencyCheckRequest, opts ...grpc.CallOption) (PraefectInfoService_ConsistencyCheckClient, error) // DatalossCheck checks for unavailable repositories. DatalossCheck(ctx context.Context, in *DatalossCheckRequest, opts ...grpc.CallOption) (*DatalossCheckResponse, error) // SetAuthoritativeStorage sets the authoritative storage for a repository on a given virtual storage. @@ -58,38 +53,6 @@ func (c *praefectInfoServiceClient) RepositoryReplicas(ctx context.Context, in * return out, nil } -func (c *praefectInfoServiceClient) ConsistencyCheck(ctx context.Context, in *ConsistencyCheckRequest, opts ...grpc.CallOption) (PraefectInfoService_ConsistencyCheckClient, error) { - stream, err := c.cc.NewStream(ctx, &PraefectInfoService_ServiceDesc.Streams[0], "/gitaly.PraefectInfoService/ConsistencyCheck", opts...) - if err != nil { - return nil, err - } - x := &praefectInfoServiceConsistencyCheckClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type PraefectInfoService_ConsistencyCheckClient interface { - Recv() (*ConsistencyCheckResponse, error) - grpc.ClientStream -} - -type praefectInfoServiceConsistencyCheckClient struct { - grpc.ClientStream -} - -func (x *praefectInfoServiceConsistencyCheckClient) Recv() (*ConsistencyCheckResponse, error) { - m := new(ConsistencyCheckResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - func (c *praefectInfoServiceClient) DatalossCheck(ctx context.Context, in *DatalossCheckRequest, opts ...grpc.CallOption) (*DatalossCheckResponse, error) { out := new(DatalossCheckResponse) err := c.cc.Invoke(ctx, "/gitaly.PraefectInfoService/DatalossCheck", in, out, opts...) @@ -122,11 +85,6 @@ func (c *praefectInfoServiceClient) SetReplicationFactor(ctx context.Context, in // for forward compatibility type PraefectInfoServiceServer interface { RepositoryReplicas(context.Context, *RepositoryReplicasRequest) (*RepositoryReplicasResponse, error) - // ConsistencyCheck will perform a consistency check on the requested - // virtual storage backend. A stream of repository statuses will be sent - // back indicating which repos are consistent with the primary and which ones - // need repair. - ConsistencyCheck(*ConsistencyCheckRequest, PraefectInfoService_ConsistencyCheckServer) error // DatalossCheck checks for unavailable repositories. DatalossCheck(context.Context, *DatalossCheckRequest) (*DatalossCheckResponse, error) // SetAuthoritativeStorage sets the authoritative storage for a repository on a given virtual storage. @@ -152,9 +110,6 @@ type UnimplementedPraefectInfoServiceServer struct { func (UnimplementedPraefectInfoServiceServer) RepositoryReplicas(context.Context, *RepositoryReplicasRequest) (*RepositoryReplicasResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RepositoryReplicas not implemented") } -func (UnimplementedPraefectInfoServiceServer) ConsistencyCheck(*ConsistencyCheckRequest, PraefectInfoService_ConsistencyCheckServer) error { - return status.Errorf(codes.Unimplemented, "method ConsistencyCheck not implemented") -} func (UnimplementedPraefectInfoServiceServer) DatalossCheck(context.Context, *DatalossCheckRequest) (*DatalossCheckResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DatalossCheck not implemented") } @@ -195,27 +150,6 @@ func _PraefectInfoService_RepositoryReplicas_Handler(srv interface{}, ctx contex return interceptor(ctx, in, info, handler) } -func _PraefectInfoService_ConsistencyCheck_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ConsistencyCheckRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(PraefectInfoServiceServer).ConsistencyCheck(m, &praefectInfoServiceConsistencyCheckServer{stream}) -} - -type PraefectInfoService_ConsistencyCheckServer interface { - Send(*ConsistencyCheckResponse) error - grpc.ServerStream -} - -type praefectInfoServiceConsistencyCheckServer struct { - grpc.ServerStream -} - -func (x *praefectInfoServiceConsistencyCheckServer) Send(m *ConsistencyCheckResponse) error { - return x.ServerStream.SendMsg(m) -} - func _PraefectInfoService_DatalossCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DatalossCheckRequest) if err := dec(in); err != nil { @@ -294,12 +228,6 @@ var PraefectInfoService_ServiceDesc = grpc.ServiceDesc{ Handler: _PraefectInfoService_SetReplicationFactor_Handler, }, }, - Streams: []grpc.StreamDesc{ - { - StreamName: "ConsistencyCheck", - Handler: _PraefectInfoService_ConsistencyCheck_Handler, - ServerStreams: true, - }, - }, + Streams: []grpc.StreamDesc{}, Metadata: "praefect.proto", } diff --git a/proto/praefect.proto b/proto/praefect.proto index 71198a687..d89d2c3e0 100644 --- a/proto/praefect.proto +++ b/proto/praefect.proto @@ -11,11 +11,6 @@ service PraefectInfoService { option (intercepted) = true; rpc RepositoryReplicas(RepositoryReplicasRequest) returns (RepositoryReplicasResponse); - // ConsistencyCheck will perform a consistency check on the requested - // virtual storage backend. A stream of repository statuses will be sent - // back indicating which repos are consistent with the primary and which ones - // need repair. - rpc ConsistencyCheck(ConsistencyCheckRequest) returns (stream ConsistencyCheckResponse); // DatalossCheck checks for unavailable repositories. rpc DatalossCheck(DatalossCheckRequest) returns (DatalossCheckResponse); @@ -110,30 +105,3 @@ message RepositoryReplicasResponse{ RepositoryDetails primary = 1; repeated RepositoryDetails replicas = 2; } - -message ConsistencyCheckRequest { - string virtual_storage = 1; - // The target storage is the storage you wish to check for inconsistencies - // against a reference storage (typically the current primary). - string target_storage = 2; - // Optionally provide a reference storage to compare the target storage - // against. If a reference storage is omitted, the current primary will be - // used. - string reference_storage = 3; - // Be default, reconcilliation is enabled. Disabling reconcilliation will - // make the request side-effect free. - bool disable_reconcilliation = 4; -} - -message ConsistencyCheckResponse { - string repo_relative_path = 1; - string target_checksum = 2; - string reference_checksum = 3; - // If resync was enabled, then each inconsistency will schedule a replication - // job. A replication ID is returned to track the corresponding job. - uint64 repl_job_id = 4; - // If the reference storage was not specified, reply with the reference used - string reference_storage = 5; - // The list of errors that appeared during the operation execution for the current repository. - repeated string errors = 6; -} diff --git a/ruby/proto/gitaly/praefect_pb.rb b/ruby/proto/gitaly/praefect_pb.rb index 0e10b2162..d2784c57f 100644 --- a/ruby/proto/gitaly/praefect_pb.rb +++ b/ruby/proto/gitaly/praefect_pb.rb @@ -53,20 +53,6 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :repository, :message, 1, "gitaly.Repository" optional :checksum, :string, 2 end - add_message "gitaly.ConsistencyCheckRequest" do - optional :virtual_storage, :string, 1 - optional :target_storage, :string, 2 - optional :reference_storage, :string, 3 - optional :disable_reconcilliation, :bool, 4 - end - add_message "gitaly.ConsistencyCheckResponse" do - optional :repo_relative_path, :string, 1 - optional :target_checksum, :string, 2 - optional :reference_checksum, :string, 3 - optional :repl_job_id, :uint64, 4 - optional :reference_storage, :string, 5 - repeated :errors, :string, 6 - end end end @@ -82,6 +68,4 @@ module Gitaly RepositoryReplicasRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.RepositoryReplicasRequest").msgclass RepositoryReplicasResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.RepositoryReplicasResponse").msgclass RepositoryReplicasResponse::RepositoryDetails = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.RepositoryReplicasResponse.RepositoryDetails").msgclass - ConsistencyCheckRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.ConsistencyCheckRequest").msgclass - ConsistencyCheckResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.ConsistencyCheckResponse").msgclass end diff --git a/ruby/proto/gitaly/praefect_services_pb.rb b/ruby/proto/gitaly/praefect_services_pb.rb index a148f3357..c1045f01f 100644 --- a/ruby/proto/gitaly/praefect_services_pb.rb +++ b/ruby/proto/gitaly/praefect_services_pb.rb @@ -15,11 +15,6 @@ module Gitaly self.service_name = 'gitaly.PraefectInfoService' rpc :RepositoryReplicas, Gitaly::RepositoryReplicasRequest, Gitaly::RepositoryReplicasResponse - # ConsistencyCheck will perform a consistency check on the requested - # virtual storage backend. A stream of repository statuses will be sent - # back indicating which repos are consistent with the primary and which ones - # need repair. - rpc :ConsistencyCheck, Gitaly::ConsistencyCheckRequest, stream(Gitaly::ConsistencyCheckResponse) # DatalossCheck checks for unavailable repositories. rpc :DatalossCheck, Gitaly::DatalossCheckRequest, Gitaly::DatalossCheckResponse # SetAuthoritativeStorage sets the authoritative storage for a repository on a given virtual storage. |