Tag and Field with same name - will the RP clean the mess?

I’m in a tricky situation, in which the DB structure has to be changed, and some tags and fields must be switched, meaning that a key “session_id” has to be changed from field → tag, for other keys the opposite will happen.

I’m knowledgeable about this kind of situation and how to generally fix it, but I’m wondering if I can just wait it out, and let the Retention Policy “fix” it. (as it’s not critical and very troublesome to “fix” this situation)

Let’s say that I have a 3 days retention, is the below scenario corrector not?

2022-06-20 | "session_id" is a field
2022-06-21 | "session_id" is a field
2022-06-22 | "session_id" is a field and also a tag --schema change
2022-06-23 | "session_id" is a field and also a tag
2022-06-24 | "session_id" is a field and also a tag
2022-06-25 | "session_id" is a tag --RP deleted all the shards in which it was a field
2022-06-26 | "session_id" is a tag

The question is simple, once all the data in which “session_id” is a field are out of retention, will InfluxDB detect that “session_id” exists only as a tag? or will the structure still be “mixed”?

My theory is that it should be fixed, as the data itself should be contained by shard, but I’m looking for confirmation.


Hello @Giovanni_Luisotto,
I agree. I believe it will be fixed when the shard gets deleted.

1 Like