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

feat: add dbname and health check api #18

Merged
merged 8 commits into from
Mar 26, 2023
Merged

feat: add dbname and health check api #18

merged 8 commits into from
Mar 26, 2023

Conversation

sunng87
Copy link
Member

@sunng87 sunng87 commented Mar 22, 2023

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

  • add dbname for consistent with protocols like mysql and http
  • add health check service for integration with tools that require probing

Checklist

  • I have written the necessary comments.
  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

@sunng87 sunng87 marked this pull request as ready for review March 23, 2023 03:16
@sunng87 sunng87 enabled auto-merge (squash) March 23, 2023 03:26
Copy link
Contributor

@shuiyisong shuiyisong left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -22,6 +22,8 @@ message RequestHeader {
string schema = 2;
// The `authorization` header, much like http's authorization header.
AuthHeader authorization = 3;
// The `dbname` for the request
string dbname = 4;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since "dbname = catalog + '-' + schema", I suggest using "oneof":

message RequestHeader {
  message CatalogAndSchema {
    string catalog = 1;
    string schema = 2;
  }
  oneof database_ident {
    CatalogAndSchema catalog_and_schema = 1;
    string dbname = 2;
  }
  AuthHeader authorization = 3;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

This is preferred solution, to have consistency in proto semantic and implementation. However, I'm afraid this will become backward incompatible so I chose to append dbname to the header.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well, currently we have only one outside use of grpc client, and the one is in early adoption stage. I think we can afford to make this breaking change?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we consider keeping the proto unchanged and just splitting/combining the catalog-schema at the upper level?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since the proto is also used in our intra-cluster communication, changing this can result in a incompatible upgrade from existing cluster..

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need the dbname in proto file? Can it be handled at the code level?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but here I try to avoid leaking dbname generation pattern to client, for better extensibility. The pattern catalog-schema we are using for now might not be a perfect solution.

@sunng87 sunng87 merged commit ff8c55b into main Mar 26, 2023
@sunng87 sunng87 deleted the feature/dbname branch March 26, 2023 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants