ngsi-timeseries-api icon indicating copy to clipboard operation
ngsi-timeseries-api copied to clipboard

Crate version check still needed?

Open c0c0n3 opened this issue 4 years ago • 3 comments

Is your feature request related to a problem? Please describe. Everytime we get a notification, we issue a query to get the Crate version. As @chicco785 noted in PR #299, we could actually cache this so that we don't have to waste a query on each notification. Perhaps we could even get rid of it altogether.

Describe the solution you'd like

Review the _adjust_gh_44 method of Crate translator as this is the only reason we do the version check. It looks like the SQL tweak is only needed for Crate < 2.3. So one option would be to drop support for Crate versions older than 2.3, change _adjust_gh_44 accordingly (hopefully give it a better name) and ditch the get_db_version method. Alternatively, we could cache the version upfront to avoid issuing the query on each and every notification---but keep in mind the deployment issue noted in PR #299.

Additional context

Have a look at PR #299 which fixed a performance hotspot by moving the version call outside of a loop.

c0c0n3 avatar Apr 06 '20 10:04 c0c0n3

I suspect that also for the differences between crate 3 and 4 we may need the version check. But I may be wrong.

chicco785 avatar Apr 06 '20 12:04 chicco785

I've had a quick look at it. If we won't need any more changes than you pushed to PR #300 so far, then your stuff is actually backward compatible between v4 and v3 (but not v2). In fact,

ON CONFLICT (column_ident [, ...]) DO UPDATE SET...

is supported both in v3 and v4

  • https://crate.io/docs/crate/reference/en/3.3/sql/statements/insert.html
  • https://crate.io/docs/crate/reference/en/4.1/sql/statements/insert.html

Ditto for column-policy

  • https://crate.io/docs/crate/reference/en/3.3/sql/statements/create-table.html#column-policy
  • https://crate.io/docs/crate/reference/en/4.1/sql/statements/create-table.html#column-policy

Of course, we'll need more testing to make sure stuff still works as advertised regardless of syntax, like you found out yourself the hard way---crate/crate#9854 :-)

c0c0n3 avatar Apr 06 '20 13:04 c0c0n3

Stale issue message

github-actions[bot] avatar Mar 10 '21 02:03 github-actions[bot]