Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsdb index gateway #6158

Merged
merged 5 commits into from
May 18, 2022
Merged

tsdb index gateway #6158

merged 5 commits into from
May 18, 2022

Conversation

sandeepsukhani
Copy link
Contributor

What this PR does / why we need it:

  1. enable new grpc calls on index gateway and add GetSeries call
  2. Use index gateway client when enabled for boltdb-shipper index store.

Special notes for your reviewer:

  • Please do not merge this PR until we are ready to enable new grpc calls or we add a flag to control it since we had disabled them until we can improve index gateway performance.
  • We rely on boltdb-shipper config for now to initialize the index gateway client. We will have to discuss and decide how we want to proceed with tsdb config. I feel that we should share the same config to avoid complexities.

Copy link
Member

@owen-d owen-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick review; this is looking good!

Please do not merge this PR until we are ready to enable new grpc calls or we add a flag to control it since we had disabled them until we can improve index gateway performance.

Instead, can we create two clients, one which uses the new form and one which uses the old form? Then we can enable the new form when tsdb is enabled, but keep the old form elsewhere.


// TODO(owen-d): add TSDB index-gateway support
// ToDo(Sandeep): Refactor code to not use boltdb-shipper index gateway client config
if shouldUseBoltDBIndexGatewayClient(s.cfg) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be better to have this function accept on the tsdb-shipper config as an argument instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should all be cleaned up once I get to migrate boltdb-shipper to index-shipper.

@@ -25,17 +25,6 @@ type StoreLimits interface {
MaxQueryLength(userID string) time.Duration
}

type Index interface {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we move this into series.IndexStore?

Copy link
Contributor Author

@sandeepsukhani sandeepsukhani May 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to pass an interface to series.NewIndexGatewayClientStore without which it was not possible to pass tsdb index client. I had to move it to series.IndexStore to avoid circular dependency.

}

type IndexGatewayClient interface {
GetChunkRef(ctx context.Context, in *indexgatewaypb.GetChunkRefRequest, opts ...grpc.CallOption) (*indexgatewaypb.GetChunkRefResponse, error)
GetSeries(ctx context.Context, in *indexgatewaypb.GetSeriesRequest, opts ...grpc.CallOption) (*indexgatewaypb.GetSeriesResponse, error)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3 Adding this here, thanks.

idx := tsdb.NewIndexClient(headManager, p)
writer := tsdb.NewChunkWriter(f, p, headManager)
// ToDo(Sandeep): Avoid initializing writer when in read only mode
writer, idx, err := tsdb.NewStore(s.cfg.TSDBShipperConfig, p, f, objectClient, s.limits, indexClientReg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see tsdb.NewStore implemented yet, is that right? I'm guessing we'll just copy this over to the new function (we can also add a check on whether to enable the head manager as well).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed pushing the file. I have pushed it yesterday.

@sandeepsukhani
Copy link
Contributor Author

Did a quick review; this is looking good!

Please do not merge this PR until we are ready to enable new grpc calls or we add a flag to control it since we had disabled them until we can improve index gateway performance.

Instead, can we create two clients, one which uses the new form and one which uses the old form? Then we can enable the new form when tsdb is enabled, but keep the old form elsewhere.

We already have a fallback mechanism for backwards compatibility. I think we should add a flag to reuse most of the code then.

@grafanabot
Copy link
Collaborator

./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki

Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell.

+           ingester	0%
-        distributor	-0.3%
+            querier	0%
+ querier/queryrange	0%
+               iter	0%
+            storage	0.1%
+           chunkenc	0%
+              logql	0%
+               loki	0%

@sandeepsukhani
Copy link
Contributor Author

sandeepsukhani commented May 18, 2022

Did a quick review; this is looking good!

Please do not merge this PR until we are ready to enable new grpc calls or we add a flag to control it since we had disabled them until we can improve index gateway performance.

Instead, can we create two clients, one which uses the new form and one which uses the old form? Then we can enable the new form when tsdb is enabled, but keep the old form elsewhere.

We already have a fallback mechanism for backwards compatibility. I think we should add a flag to reuse most of the code then.

I have temporarily disabled using IndexGatewayClientStore for boltdb-shipper since that is what tries the new storage grpc calls on index gateway. Index gateway should continue to work as is since we create index gateway client instance here anyways.

@grafanabot
Copy link
Collaborator

./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki

Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell.

+           ingester	0%
+        distributor	0%
+            querier	0%
+ querier/queryrange	0%
+               iter	0%
+            storage	0.5%
+           chunkenc	0%
+              logql	0%
+               loki	0.6%

@sandeepsukhani sandeepsukhani marked this pull request as ready for review May 18, 2022 13:43
@sandeepsukhani sandeepsukhani requested a review from a team as a code owner May 18, 2022 13:43
@owen-d
Copy link
Member

owen-d commented May 18, 2022

I think we should move around the IndexStore definition to it's own location (doesn't make sense in the series pkg to me), but LGTM. I'd probably put it in a pkg/storage/stores/index package instead, but this is a nit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants