-
Notifications
You must be signed in to change notification settings - Fork 88
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
[yugabyte] Yugabyte compatible implementation #1143
base: master
Are you sure you want to change the base?
Conversation
968bb04
to
ea1debf
Compare
fe834e0
to
e735f9a
Compare
f07f19c
to
38dd892
Compare
4ddbfb2
to
29fc46a
Compare
29fc46a
to
6e5a1d0
Compare
6e5a1d0
to
ed79acc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only minor comments, LGTM otherwise.
dlv --headless --listen=:4000 --api-version=2 --accept-multiclient exec --continue /usr/bin/core-service -- \ | ||
-cockroach_host local-dss-crdb \ | ||
# Linter is disabled to properly unwrap $DATASTORE_CONNECTION. | ||
# shellcheck disable=SC2086 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -56,7 +61,7 @@ services: | |||
image: interuss-local/dss | |||
entrypoint: /usr/bin/db-manager migrate --schemas_dir=/db-schemas/yugabyte/scd --db_version "latest" --cockroach_host local-dss-ybdb --cockroach_user yugabyte --cockroach_port 5433 | |||
depends_on: | |||
local-dss-crdb: | |||
local-dss-ybdb: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was an issue present before already, right?
(nothing to change)
networks: | ||
- dss_sandbox_default_network | ||
healthcheck: | ||
test: wget -O - 'http://localhost/healthy' || exit 1 | ||
interval: 3m | ||
start_period: 30s | ||
start_interval: 5s | ||
profiles: ["", "with-yugabyte"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the empty string? Is this supposed to represent 'no profile'?
@@ -87,7 +87,7 @@ func (r *repo) MaxSubscriptionCountInCellsByOwner(ctx context.Context, cells s2. | |||
// strict we could keep this count in memory, (or in some other storage). | |||
var query = ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q1
and q2
are added but never used. Are they really necessary for yagabyte?
%s`, constraintFieldsWithoutPrefix, constraintFieldsWithPrefix) | ||
%s`, | ||
constraintFieldsWithoutPrefix, | ||
constraintFieldsWithIndices[0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If those are referenced individually, might as well directly set them in the query, this would be more readable.
@@ -203,7 +228,8 @@ func (c *repo) SearchConstraints(ctx context.Context, v4d *dssmodels.Volume4D) ( | |||
COALESCE(starts_at <= $3, true) | |||
AND | |||
COALESCE(ends_at >= $2, true) | |||
LIMIT $4`, constraintFieldsWithoutPrefix) | |||
LIMIT $4; | |||
`, constraintFieldsWithoutPrefix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is setting a final ;
required for yugabyte? If so, why is it not the case of query on scd_constraints and availabilities above? And if not, why adding it here?
scd_operations | ||
(%s) | ||
VALUES | ||
($1, $2, $3, $4, $5, $6, $7, $8, $9, transaction_timestamp(), $10, $11, $12, $13) | ||
RETURNING | ||
%s`, operationFieldsWithoutPrefix, operationFieldsWithPrefix) | ||
ON CONFLICT (%s) DO UPDATE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: better specify directly the field names if they are referenced individually.
RETURNING | ||
%s`, subscriptionFieldsWithoutPrefix, subscriptionFieldsWithPrefix) | ||
%s`, | ||
subscriptionFieldsWithoutPrefix, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: better specify directly the field names if they are referenced individually.
%s = $3::int, | ||
%s = $4, | ||
%s = $5::int, | ||
%s = $6, | ||
%s = $7, | ||
%s = $8::bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is setting the types here required for yugabyte? If so, why is it not required as well for operational intents?
@@ -0,0 +1,2 @@ | |||
CREATE INDEX s_cell_idx ON subscriptions USING ybgin (cells); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If yugabyte is not deployed anywhere, might as well update v1.0.0 IMO. And it probably makes sense keeping doing so until the v1.0.0 is actually a true working v1 that is released.
This PR introduces the ability to run core-service with a yugabyte datastore.
Key changes:
Note that it was identified that the current implementation may show some failing test runs of the prober with Yugabyte. Current assumption is that the problem is due to default transaction isolation which is not the same in CRDB (Serializable) and Yugabyte (Snapshot). The later may lead to serialization anomalies for single statement queries. Adapting the code to support this specific use case with Yugabyte may require extensive refactoring which may better be addressed in a separate PR.
Prober tests are catching this issue unreliably. It has been kept disabled for Yugabyte until the implementation is stable.
Commits have been organised in order to facilitate the review.