-
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
Notification not processed, Column __original_ngsi_entity__ unknown #381
Comments
@pinkerltm by chance did you create/edit manually your table? can you do "SHOW CREATE TABLE" on the related table? |
@pinkerltm any feedback? |
@pinkerltm thanks for reporting this :-)
QL adds that automatically since #335---have a look at that PR for details of what that column is and what is for.
...and you guessed it right, Sir :-)
In general, I'd advise you against changing QL generated tables in any way since it could result in all sorts of wonderful and mysterious errors if e.g. the table definition gets out of sync w/r/t entity metadata stored in the metadata table :-) Now the above two changes combined have the side-effect that every time an entity with a duplicate key is notified, the insert will fail and QL will try saving the entity data as is in
Yes, I'd say that may well be the case. The one thing I still don't understand is why this exception got raised:
The one reason could be the table's column policy isn't set to
@chicco785 it looks like another issue @pinkerltm is going to have (sorry @pinkerltm!) is that the JSON payload contains nested arrays:
so even if he had never manually modified the table, every time an insert had failed (for whichever reason), QL would have crashed on trying to save the original data anyway, see #344 about it. |
@chicco785 @c0c0n3 my apologies for the long delay ...had another project which claimed all my attention recently, I guess you are aware of such situations. As stated above, we rely on QL to create the table, and I just altered it to have a primary key to keep it clean of duplicates. We are really struggling to not lose any measurements/state changes, therefore we collect them in Kafka (as an queue) before handing them over to Orion-QL-Crate... and as we also want to prevent postprocessing of the QL generated table (i.e. after several kafka-consumer-replays) we need to prohibit the creation of duplicates. Anyway, heres the output of
|
@c0c0n3 ok, if I understand all that right, I think the best approach for our scenario is to alter the type my P.S. sorry, giving up the primary key/duplicate prevention is not really an option for us ;) |
@pinkerltm, thank you for getting back to us, no need to apologise! :-) So I think I've got to the bottom of this. I've posted below detailed explanations but here's the take-home:
(4) will take a while to fix, we have two issues to juggle: #344 and #375. One thing you can do until we fix this is ignore errors in the logs related to (4). What caused the reported errorYour table has a column policy of
Notice if you don't specify a column policy, Crate defaults it to
Unfortunately the first statement has no effect so the table definition is left unchanged---exactly the same problem as in #375. In particular the column policy is still
So it looks like, strictly speaking, this isn't a bug in QL, the column policy shouldn't have been manually changed from An accident waiting to happenNow I think you can keep the PK constraint since it won't interfere with QL's normal operation. But you should definitely change
Cool. The meanies are lying in wait though :-) In fact, next time both the conditions below are met
Then the second insert QL attempts to recover from the first failing will fail too because the
Now say QL gets notified of an entity update, tries to insert it
and it goes well but soon afterwards, it gets notified of the same update again, so the PK constraint will make the insert fail---notice the insert could fail for any other reason, the crux of the matter here is that there's a location in the payload containing nested arrays. Next thing QL tries to do is stash away the original JSON POSTed to the
but this will fail too because the JSON in the |
@pinkerltm i suppose we can close the issue given that |
@chicco785 wasn't able to verify it yet, but with the great explanation I should be able to fix it. Thanks a lot |
@pinkerltm fyi in PR#373 we are changing columns default from dynamic to strict and manage the add of columns in ql, which would avoid any issue, when it's released. it may be experimental for a while though, due to the fact of quite some changes we introduced, and that may need additional testing. these are all updates coming:
|
In our QL logs there is often the following entry:
Neither do we send any attribute called
__original_ngsi_entity__
in our payload nor did we define the etdevice table in crate ourselves. Mostly did I trust that QL will create a working schema on its own. We just defined primary keys afterwards to prohibit duplicates. The name of the missing column indicates that the sql translator tries to persist an private python attribute, but thats just my uneducated guess.I added
__original_ngsi_entity__
as a text column to our crate table, but since then I wasn't able to reproduce the error. Nevertheless its just a matter of time until we will get those Errors again.The text was updated successfully, but these errors were encountered: