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

Removing explicit_timestamp from an interface makes AppEngine and DUP crash #832

Open
Pavinati opened this issue Aug 2, 2023 · 0 comments
Labels
app:appengine_api This issue or pull request is about astarte_appengine_api application app:data_updater_plant This issue or pull request is about astarte_data_updater_plant application bug Something isn't working
Milestone

Comments

@Pavinati
Copy link
Collaborator

Pavinati commented Aug 2, 2023

Setup used for testing:

Astarte v1.0.3
an Astarte interface with

  • version 0.1
  • type: datastream
  • object aggregated
  • explicit timestamp: true

then, stream some data

update said interface to

  • version 0.2
  • explicit timestamp: false

stream data on the new interface version


AppEngine log:

Aug  2 13:24:55 |INFO| Sent reply. elapsed=19ms realm=test tag=sent_reply status_code=500 device_id=RbbMIyemWTOI99N6XZx1hA interface=com.foo.Bar request_id=625e5a84e86430ff8235e9fd05bc49d0
Aug  2 13:24:55 |ERRO| #PID<0.1469.8> running Astarte.AppEngine.APIWeb.Endpoint (connection #PID<0.711.8>, stream id 22) terminated
Server: api.test.astarte.cloud:80 (http)
Request: GET /v1/test/devices/RbbMIyemWTOI99N6XZx1hA/interfaces/com.foo.Bar?since=2023-08-01T13%3A24%3A55.684Z&to=2023-08-02T13%3A24%3A55.684Z&limit=1000
** (exit) an exception was raised:
    ** (CQEx.Error) "PRIMARY KEY column \"reception_timestamp\" cannot be restricted as preceding column \"value_timestamp\" is not restricted (Code 8704)\nStatement: SELECT  v_mode,  v_name,  v_number,  reception_timestamp FROM com_foo_bar_v0 WHERE device_id=:device_id AND reception_timestamp >= :since AND path=:path AND reception_timestamp < :to_timestamp LIMIT :limit_nrows ;;\nValues: %{device_id: <<69, 182, 204, 35, 39, 166, 89, 51, 136, 247, 211, 122, 93, 156, 117, 132>>, limit_nrows: 1000, path: \"/value\", since: 1690896295684, to_timestamp: 1690982695684}"
        (cqex 1.0.1) lib/cqex/query.ex:116: CQEx.Query.call!/2
        (astarte_appengine_api 1.0.3) lib/astarte_appengine_api/device/queries.ex:1215: Astarte.AppEngine.API.Device.Queries.retrieve_object_datastream_values/6
        (astarte_appengine_api 1.0.3) lib/astarte_appengine_api/device/device.ex:1241: Astarte.AppEngine.API.Device.retrieve_endpoint_values/9
        (astarte_appengine_api 1.0.3) lib/astarte_appengine_api/device/device.ex:1149: Astarte.AppEngine.API.Device.retrieve_endpoint_values/9
        (astarte_appengine_api 1.0.3) lib/astarte_appengine_api/device/device.ex:978: Astarte.AppEngine.API.Device.do_get_interface_values!/9
        (astarte_appengine_api 1.0.3) lib/astarte_appengine_api_web/controllers/interface_values_controller.ex:57: Astarte.AppEngine.APIWeb.InterfaceValuesController.show/2
        (astarte_appengine_api 1.0.3) lib/astarte_appengine_api_web/controllers/interface_values_controller.ex:18: Astarte.AppEngine.APIWeb.InterfaceValuesController.action/2
        (astarte_appengine_api 1.0.3) lib/astarte_appengine_api_web/controllers/interface_values_controller.ex:18: Astarte.AppEngine.APIWeb.InterfaceValuesController.phoenix_controller_pipeline/2

DUP log:

Aug  2 14:02:48 |ERRO| GenServer {Registry.DataUpdater, {"test", <<69, 182, 204, 35, 39, 166, 89, 51, 136, 247, 211, 122, 93, 156, 117, 132>>}} terminating
** (CQEx.Error) "PRIMARY KEY column \"reception_timestamp\" cannot be restricted as preceding column \"value_timestamp\" is not restricted (Code 8704)\nStatement: INSERT INTO com_foo_bar_v0 (device_id, path,  v_mode,  v_name,  v_number,  reception_timestamp, reception_timestamp_submillis) VALUES (:device_id, :path,  :v_mode,  :v_name,  :v_number, :reception_timestamp, :reception_timestamp_submillis) USING TTL 31556952;\nValues: %{device_id: <<69, 182, 204, 35, 39, 166, 89, 51, 136, 247, 211, 122, 93, 156, 117, 132>>, path: \"/value\", reception_timestamp: 1690981543949, reception_timestamp_submillis: 9300, v_mode: 0, v_name: \"\", v_number: 12, value_timestamp: 1690981543949}"
    (cqex 1.0.1) lib/cqex/query.ex:116: CQEx.Query.call!/2
    (astarte_data_updater_plant 1.0.3) lib/astarte_data_updater_plant/data_updater/queries.ex:295: Astarte.DataUpdaterPlant.DataUpdater.Queries.insert_value_into_db/9
    (astarte_data_updater_plant 1.0.3) lib/astarte_data_updater_plant/data_updater/impl.ex:498: Astarte.DataUpdaterPlant.DataUpdater.Impl.handle_data/6
    (astarte_data_updater_plant 1.0.3) lib/astarte_data_updater_plant/data_updater/server.ex:73: Astarte.DataUpdaterPlant.DataUpdater.Server.handle_cast/2
    (stdlib 3.14.2.2) gen_server.erl:689: :gen_server.try_dispatch/4
    (stdlib 3.14.2.2) gen_server.erl:765: :gen_server.handle_msg/6
    (stdlib 3.14.2.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
@Pavinati Pavinati added app:appengine_api This issue or pull request is about astarte_appengine_api application app:data_updater_plant This issue or pull request is about astarte_data_updater_plant application bug Something isn't working labels Aug 2, 2023
@Annopaolo Annopaolo added this to the v1.3 milestone Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app:appengine_api This issue or pull request is about astarte_appengine_api application app:data_updater_plant This issue or pull request is about astarte_data_updater_plant application bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

2 participants