Skip to content

Commit

Permalink
Merge index-gateway into store-gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
harry671003 committed Oct 27, 2023
1 parent bb01419 commit e78cbbe
Show file tree
Hide file tree
Showing 13 changed files with 235 additions and 358 deletions.
2 changes: 1 addition & 1 deletion pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func (a *API) RegisterRing(r *ring.Ring) {

// RegisterStoreGateway registers the ring UI page associated with the store-gateway.
func (a *API) RegisterStoreGateway(s *storegateway.StoreGateway) {
storegatewaypb.RegisterIndexGatewayServer(a.server.GRPC, s)
storegatewaypb.RegisterStoreGatewayServer(a.server.GRPC, s)

a.indexPage.AddLink(SectionAdminEndpoints, "/store-gateway/ring", "Store Gateway Ring")
a.RegisterRoute("/store-gateway/ring", http.HandlerFunc(s.RingHandler), false, "GET", "POST")
Expand Down
8 changes: 4 additions & 4 deletions pkg/cortex/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const (
Configs string = "configs"
AlertManager string = "alertmanager"
Compactor string = "compactor"
IndexGateway string = "index-gateway"
StoreGateway string = "store-gateway"
ChunksGateway string = "chunks-gateway"
MemberlistKV string = "memberlist-kv"
TenantDeletion string = "tenant-deletion"
Expand Down Expand Up @@ -774,7 +774,7 @@ func (t *Cortex) setupModuleManager() error {
mm.RegisterModule(Configs, t.initConfig)
mm.RegisterModule(AlertManager, t.initAlertManager)
mm.RegisterModule(Compactor, t.initCompactor)
mm.RegisterModule(IndexGateway, t.initStoreGateway)
mm.RegisterModule(StoreGateway, t.initStoreGateway)
mm.RegisterModule(ChunksGateway, t.initChunksGateway)
mm.RegisterModule(TenantDeletion, t.initTenantDeletionAPI, modules.UserInvisibleModule)
mm.RegisterModule(Purger, nil)
Expand Down Expand Up @@ -806,12 +806,12 @@ func (t *Cortex) setupModuleManager() error {
Configs: {API},
AlertManager: {API, MemberlistKV, Overrides},
Compactor: {API, MemberlistKV, Overrides},
IndexGateway: {API, Overrides, MemberlistKV},
StoreGateway: {API, Overrides, MemberlistKV},
ChunksGateway: {API, Overrides, MemberlistKV},
TenantDeletion: {API, Overrides, DeleteRequestsStore},
Purger: {TenantDeletion},
TenantFederation: {Queryable},
All: {QueryFrontend, Querier, Ingester, Distributor, Purger, ChunksGateway, IndexGateway, Ruler},
All: {QueryFrontend, Querier, Ingester, Distributor, Purger, ChunksGateway, StoreGateway, Ruler},
}
if t.Cfg.ExternalPusher != nil && t.Cfg.ExternalQueryable != nil {
deps[Ruler] = []string{Overrides, DeleteRequestsStore, RulerStorage}
Expand Down
2 changes: 1 addition & 1 deletion pkg/querier/blocks_store_queryable.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type BlocksFinder interface {
// BlocksStoreClient is the interface that should be implemented by any client used
// to query a backend store-gateway.
type BlocksStoreClient interface {
storegatewaypb.IndexGatewayClient
storegatewaypb.StoreGatewayClient

// RemoteAddress returns the address of the remote store-gateway and is used to uniquely
// identify a store-gateway backend instance.
Expand Down
4 changes: 2 additions & 2 deletions pkg/querier/blocks_store_queryable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,7 @@ type storeGatewayClientMock struct {
mockedLabelValuesErr error
}

func (m *storeGatewayClientMock) Series(ctx context.Context, in *storepb.SeriesRequest, opts ...grpc.CallOption) (storegatewaypb.IndexGateway_SeriesClient, error) {
func (m *storeGatewayClientMock) Series(ctx context.Context, in *storepb.SeriesRequest, opts ...grpc.CallOption) (storegatewaypb.StoreGateway_SeriesClient, error) {
seriesClient := &storeGatewaySeriesClientMock{
mockedResponses: m.mockedSeriesResponses,
mockedSeriesStreamErr: m.mockedSeriesStreamErr,
Expand All @@ -1737,7 +1737,7 @@ func (m *storeGatewayClientMock) Series(ctx context.Context, in *storepb.SeriesR
return seriesClient, m.mockedSeriesErr
}

func (m *storeGatewayClientMock) Select(ctx context.Context, in *storepb.SelectRequest, opts ...grpc.CallOption) (storegatewaypb.IndexGateway_SelectClient, error) {
func (m *storeGatewayClientMock) Select(ctx context.Context, in *storepb.SelectRequest, opts ...grpc.CallOption) (storegatewaypb.StoreGateway_SelectClient, error) {
seriesClient := &storeGatewaySelectClientMock{
mockedResponses: m.mockedSelectResponses,
mockedSeriesStreamErr: m.mockedSeriesStreamErr,
Expand Down
4 changes: 2 additions & 2 deletions pkg/querier/store_gateway_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func dialStoreGatewayClient(clientCfg grpcclient.Config, addr string, requestDur
}

return &storeGatewayClient{
IndexGatewayClient: storegatewaypb.NewIndexGatewayClient(conn),
StoreGatewayClient: storegatewaypb.NewStoreGatewayClient(conn),
HealthClient: grpc_health_v1.NewHealthClient(conn),
conn: conn,
}, nil
Expand Down Expand Up @@ -100,7 +100,7 @@ func (c *chunksGatewayClient) RemoteAddress() string {
}

type storeGatewayClient struct {
storegatewaypb.IndexGatewayClient
storegatewaypb.StoreGatewayClient
grpc_health_v1.HealthClient
conn *grpc.ClientConn
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/querier/store_gateway_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func Test_newStoreGatewayClientFactory(t *testing.T) {
defer grpcServer.GracefulStop()

srv := &mockStoreGatewayServer{}
storegatewaypb.RegisterIndexGatewayServer(grpcServer, srv)
storegatewaypb.RegisterStoreGatewayServer(grpcServer, srv)

listener, err := net.Listen("tcp", "localhost:0")
require.NoError(t, err)
Expand Down Expand Up @@ -70,11 +70,11 @@ func Test_newStoreGatewayClientFactory(t *testing.T) {

type mockStoreGatewayServer struct{}

func (m *mockStoreGatewayServer) Series(_ *storepb.SeriesRequest, srv storegatewaypb.IndexGateway_SeriesServer) error {
func (m *mockStoreGatewayServer) Series(_ *storepb.SeriesRequest, srv storegatewaypb.StoreGateway_SeriesServer) error {
return nil
}

func (m *mockStoreGatewayServer) Select(_ *storepb.SelectRequest, srv storegatewaypb.IndexGateway_SelectServer) error {
func (m *mockStoreGatewayServer) Select(_ *storepb.SelectRequest, srv storegatewaypb.StoreGateway_SelectServer) error {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/storegateway/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ func (s *BucketStore) Series(req *storepb.SeriesRequest, seriesSrv storepb.Store
return srv.Flush()
}

func (s *BucketStore) Select(req *storepb.SelectRequest, srv storepb.IndexStore_SelectServer) (err error) {
func (s *BucketStore) Select(req *storepb.SelectRequest, srv storepb.Store_SelectServer) (err error) {
if s.queryGate != nil {
tracing.DoInSpan(srv.Context(), "store_query_gate_ismyturn", func(ctx context.Context) {
err = s.queryGate.Start(srv.Context())
Expand Down
2 changes: 1 addition & 1 deletion pkg/storegateway/bucket_stores.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func (u *BucketStores) Series(req *storepb.SeriesRequest, srv storepb.Store_Seri
}

// Series makes a series request to the underlying user bucket store.
func (u *BucketStores) Select(req *storepb.SelectRequest, srv storepb.IndexStore_SelectServer) error {
func (u *BucketStores) Select(req *storepb.SelectRequest, srv storepb.Store_SelectServer) error {
spanLog, spanCtx := spanlogger.New(srv.Context(), "BucketStores.Series")
defer spanLog.Span.Finish()

Expand Down
4 changes: 2 additions & 2 deletions pkg/storegateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,11 @@ func (g *StoreGateway) syncStores(ctx context.Context, reason string) {
}
}

func (g *StoreGateway) Series(req *storepb.SeriesRequest, srv storegatewaypb.IndexGateway_SeriesServer) error {
func (g *StoreGateway) Series(req *storepb.SeriesRequest, srv storegatewaypb.StoreGateway_SeriesServer) error {
return g.stores.Series(req, srv)
}

func (g *StoreGateway) Select(req *storepb.SelectRequest, srv storegatewaypb.IndexGateway_SelectServer) error {
func (g *StoreGateway) Select(req *storepb.SelectRequest, srv storegatewaypb.StoreGateway_SelectServer) error {
return g.stores.Select(req, srv)
}

Expand Down
Loading

0 comments on commit e78cbbe

Please sign in to comment.