i tried to modify some data from la serie, but data have been lost. I notice that field list have changed.
Before:
time dc host tag_value topic value
1662415610882756732 tos-r3 puertos/mod_0001/D_temp1 85
1670091821006288178 tos-r3 puertos/mod_0001/D_temp1 85
Modify
INSERT mqtt_consumer host=“tos-r3”,topic=“puertos/mod_0001/D_temp1”,value=30.0 1662415610882756732
INSERT mqtt_consumer host=“tos-r3”,topic=“puertos/mod_0001/D_temp1”,value=30.0 1670091821006288178
After:
time dc host host_1 tag_value topic topic_1 value
1662415610882756732 tos-r3 puertos/mod_0001/D_temp1 30
1670091821006288178 tos-r3 puertos/mod_0001/D_temp1 30
Those fields were added and the full measurement doesn´t work.
Can I fix this?
thanks.
Looking at your insert and before/after situation this should be your schema
-
tags:
dc,host
-
fields:
value
You wanted to override some data, but the insert went wrong (because it’s not written properly, read about line protocol) and your schema is now messed up.
Your insert added all the values as fields, but since the key already existed as tag the suffix _1
has been added.
The data is not lost at all but since you are filtering on tags those points are excluded.
How to FIx it
- Delete the data at the defined timestamp, since you can’t filter this delete with anything but measurement and time (you can filter deletes by measurement,time and tags), I suggest you export all the data at that defined timestamp so you can re-insert the data you want to keep
- Deleting the data should also fix your schema, as no point will have that field keys
- Insert your data, in the proper way this time… might look like the line below
INSERT mqtt_consumer,host=tos-r3,topic=puertos/mod_0001/D_temp1 value=30i 1662415610882756732
note that it makes difference to use integer (append i
→30i
) or floats (just 30
), and it might mess up your some stuff (at least temporarily), check for the correct datatype before writing the insert
Thanks a lot, Giovanni.
I understood your recommendation but it isn´t working any select instruction about old series (all series of database) before the modification only i can select wrong data.
How can i export old data, even i can’t see it from grafana explore.
How you can delete only wrong data?
any select instruction about old series (all series of database) before the modification only i can select wrong data.
I don’t understand what you mean by that, the data themselves should be fine and a plain select should work.
something like
SELECT * FROM mqtt_consumer WHERE time = 1662415610882756732
should return the “wrong data”
Thanks, Giovanni but apparently all data has been lost.
Any select return no one value.
Is there some UI Admin data of database?
Thanks a lot for your help.
InfluxDB 2 should have its own Web UI, but I ignore what you can do from it, the other option is the CLI