orchestracities / ngsi-timeseries-api

QuantumLeap: a FIWARE Generic Enabler to support the usage of NGSIv2 (and NGSI-LD experimentally) data in time-series databases
https://quantumleap.rtfd.io/
MIT License
38 stars 49 forks source link

Always trying to create md_ets_metadata table even if it exists. #774

Open tzzed opened 2 months ago

tzzed commented 2 months ago

Describe the bug I always get log of create table md_ets_metadata. Is due to a bad config ?

To Reproduce Steps to reproduce the behavior: LOG: statement: create table if not exists md_ets_metadata (table_name text primary key, entity_attrs jsonb)

Expected behavior Should be log only once

Environment (please complete the following information):

Additional context I use quantumleap with timescaleDB

c0c0n3 commented 2 months ago

hi @tzzed :-)

Thanks for reporting this.

I always get log of create table md_ets_metadata. Is due to a bad config ?

No it's just one (of the many) QuantumLeap warts :-) Because QL creates tables dynamically, it can't know beforehand if the metadata table is already there, so it tries creating it everytime. If the table exists, the DB will do nothing because of the if not exists clause.

Should be log only once

Easier said than done. There's no transactions, no ACID semantics. So how would you handle concurrency? E.g. think of ten QuantumLeap processes executing that statement at about the same time...