-
Notifications
You must be signed in to change notification settings - Fork 49
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
updates to support crate 4.4+ #481
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ |
@@ -46,7 +46,9 @@ def test_integration_basic(): | |||
try: | |||
entities = load_data() | |||
assert len(entities) > 1 | |||
check_data(entities) | |||
# it seems data consolidation takes now longer in cratedb | |||
time.sleep(20) |
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.
sjoe! 20 seconds to actually be able to query data just inserted? Am I missing something here? i.e. is there something else going on under the bonnet besides Crate being slow?
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.
To be honest, I haven't checked if the issue is the notification from orion or the consolidation from crate.
I tend to think the second, because with crate 4.1.x we use shorter time.
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.
oh dear, something we'll need to think about in prod when we upgrade...
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.
Dear Federico and Andrea,
while I am not into the details here, maybe this advise might help you along. Apologies upfront if this does not apply here.
In general you need to refresh a table [1] after inserting some data in order to make data consolidate/synchronize immediately. If that applies to the code here, I am still wondering why it would take 20 seconds, as the default refresh interval is set to 1000 milliseconds.
In any case, we usually invoke REFRESH TABLE foobar;
within our integration test scenarios after inserting data into the database [2,3]. Otherwise, the test suite would fail more often than not.
With kind regards,
Andreas.
[1] https://crate.io/docs/crate/reference/en/4.5/general/dql/refresh.html
[2] https://github.com/crate/crate-qa/blob/6630834/tests/client_tests/python/asyncpg/test_asyncpg.py#L38-L42
[3] https://github.com/crate/crate-qa/blob/6630834/tests/client_tests/node-postgres/tests/test_insert_multivalue.js#L15-L19
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.
thx @amotl the test invoked works for both crate and timescaledb, so that's why we don't apply a refresh to crate, probably something clever can be done to force it only for cratedb tests. but i am not sure it is worth. on ci-circle we would just save 20 secs over 8 minutes :)
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.
but even if we don't refresh explicitly just waiting 1 second after the last insert should be enough right?
default refresh interval is set to 1000 milliseconds
or am I misinterpreting the above statement?
@@ -25,7 +25,9 @@ def test_geo_point(translator): | |||
translator.insert([entity]) | |||
|
|||
# Check location is saved as a geo_point column in crate | |||
op = 'select latitude(location), longitude(location) from etroom' | |||
|
|||
op = "select latitude(_doc['location']), longitude(_doc['location']) " \ |
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.
oh dear, what's going on here?! why do we have to pick the location
column from _doc
now? is it a Crate SQL interface change?
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.
yes :( if you want to have the original precision, and not the approximate one
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.
cool, thanks for the heads up, I've opened an issue about it: #483
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.
Hi again,
I just want to point out #430 (comment) ff. here as a reference why this change happened.
With kind regards,
Andreas.
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.
thx @amotl personally I think the approximate precision will be good enough in most of the cases, so i would not rewrite queries to use the full precision
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.
agreed, I don't think we need sub metre accuracy
@chicco785 excellent job. I've just submitted my review. All the comments there are just questions I asked out of curiosity or to understand what to do about possible issues going forward. No need to actually answer any of them, it's quicker if we talk about that stuff in the next meeting. The only thing I wasn't sure about is the catching of Exception instead of Programming error in the |
61a98f9
to
1735976
Compare
so it looks like there's some issues w/ our Redis cache, at least w/ Redis 4 which is the one I've been testing the work q with. after turning on the Redis cache (
it looks like cache entries can't be added up b/c of a type error, but it needs more digging to find out what's actually happening and why... |
1c690ef
to
45df4f4
Compare
how this relates with this PR? I think the issue is that service is None |
According to Orion documentation:
so If the header is not present in the HTTP request, the default service/tenant is used. i.e. in the integration there should never be a |
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.
Thanks a stack for working on this! I also added some comments and hope they are valuable.
I thought it was a regression issue. In fact, the benchmark tests we've got from back in the day don't use a tenant, but if memory serves, caching was on. I'll have a look next week to see what's the story there.
cool thx, I'll check that. But then that means we can't use a cache if QL subscribes for notifications w/ an Orion instance that's not configured for multi tenancy? |
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.
excellent, good to go!
Proposed changes
Test new version of services: Orion 2.6.1, Crate 4.5.1, Timescale 1.7.5-pg12, Redis 6.2.3.
Updates to code to support changes in Crate 4.4+
Types of changes
What types of changes does your code introduce to the project: Put
an
x
in the boxes that applyfunctionality to not work as expected)
Checklist
Put an
x
in the boxes that apply. You can also fill these out aftercreating the PR. If you're unsure about any of them, don't hesitate to
ask. We're here to help! This is simply a reminder of what we are going
to look for before merging your code.
feature works
downstream modules
Further comments
N/A