Why is my tag get duplicated suddenly and I can't select using the tag

I’m creating a measurement named “master_version” that consist of tags (app_version & status) and field (version_code) using a client for javascript (influx - npm).
There’s no issue with inserting and showing the data, but one day I use the influxdb CLI to insert a new point, and the “status” suddenly duplicated (into status and status_1).
All of the old statuses are inserted to status_1 while the new one that I insert become status. I was shocked so I immediately delete the point. But unfortunately, the tags are not changing back.
Now I have a difficulty in doing a select query using where to filter status.
Please help enlighten me which have gone wrong, I’m providing the queries I tried on the following image.

@lpf_jk_jk,

Thanks for your question. This is really strange. Do you remember what you used to insert a new point? What version of influx are you using?

@katy any ideas?

I would also try to gather more context about when your writes are happening in your application and whether they are writing in the data you expect.

1 Like

hi @Anaisdg @katy
thank you so much for your responses. I’m using influxdb v1.7.7.
Yesterday I realized that my line protocol was wrong when inserting, the “status” should be tag, but I inserted it as field instead. Here’s the command I used:
insert master_version,app_version="3.49.0" version_code="31490000000",status="full"

But then, as I explained above, I was shocked and then removed that point. But the status still remains 2 (status and status_1).
My question is, why is the original status became status_1 and not the new status that was modified, and can I move back all that’s in status_1 to status again? Because of this, I can’t do any “where” query using status or status_1 (as seen on the image I provided above)

1 Like

Hey @lpf_jk_jk,

Are you sure all of your tag fields were duplicated into the new tag? Even historical data? I don’t think that’s possible…

Because of this, I can’t do any “where” query using status or status_1 (as seen on the image I provided above)

Can you try the where query with double quotes around your tagkeys please? I also don’t see a query in your picture with an OR statement. Can you share the output from that?

Finally, how are you writing your data? Is it all manual? Through single line imports?

Thanks

Hi @Anaisdg,

Yes all of my previous tag fields are moved to the new one (with _1) and I can’t do query with where in it.
I’m not sure with this I also don’t see a query in your picture with an OR statement. , but I’ve querying an OR statement for you (you can see in the image).
Apparently this is a new measurement (different than the above) because I accidentally dropped that one before… but I managed to reproduce it so here you go:

As for inserting the data, all the previous datas I input to influx through a script in js using a client for javascript (influx - npm). While it began to duplicate when I was inserting the point in influx cli but with a wrong '“schema” (status should be tag, not field but I inserted it wrong). The script for writing point is like this:

var db_name = "hula_data"
var measurement = "master_version"
var db_schema = {
    measurement: measurement,
    fields: {version_code: Influx.FieldType.STRING},
    tags:['app_version', 'status']
}       
var point = {
   measurement: measurement,
   tags: {app_version: '3.49.1', status: 'Ongoing 50.00%'},
   fields:{version_code: '314901000'},
   timestamp: timestamp}

   // define which db to use
   const influx = new Influx.InfluxDB({
        host: 'localhost',
        database: db_name,
        schema:[db_schema]
    })

  //write a point and return the whole measurement table
  return influx.writePoints([point])

Please let me know if you need enything else, or if my OR statement is not answering your question. Thanks!

Sorry, I think I do the select query wrong in the above picture haha (how silly of me)
Here’s the correct one:

@lpf_jk_jk,

I’m having trouble getting help to help you. In the meantime, could you please create an issue and share the link here? Perhaps @rawkode, has some solutions for you? Thank you. I’m sorry this is happening, and I hope I can give you a concrete solution soon. There is another community member experiencing the same problem. I’m sharing their post in case you two find a solution.

Right now the only suggestion I have is for you to delete the shard, unfortunately.

UPDATE:
I got the following advice from support, typically they do:
-A select into – for the entire measurement.
-You articulate all the fields and then you group by all the tags (less the one you are trying to get rid of)
-Then you drop the measurement
-Then you re-run the select into and move the data back.
-If you have massive amounts of data already, this can be painful. The select into requires memory. The guidance is to typically chunk this into data sizes that will fit within memory.

UPDATE:
I got the following advice from support, typically they do:
-A select into – for the entire measurement.
-You articulate all the fields and then you group by all the tags (less the one you are trying to get rid of)
-Then you drop the measurement
-Then you re-run the select into and move the data back.
-If you have massive amounts of data already, this can be painful. The select into requires memory. The guidance is to typically chunk this into data sizes that will fit within memory.

hi @Anaisdg,
Sorry for late reply.
I looked in to the thread link you gave me above. Unfortunately I think we still experience the same problem. If only there is any way we can move back from the _1 tag to the old one…

@lpf_jk_jk,
Did you try the steps I mentioned above? Those are the steps to convert from the _1 tag to the old one.

Hello,

I am having the same problem.
Is it possible to give us a more precise step by step solution?
Like:

  1. select tag1,tag2,tag3 into master_version_temp from master_version
  2. ?
  3. drop database measurement (OK): DROP Measurement “master_version”
  4. select * into master_version_temp from master_version
    Does this look OK to you?
    Or am I missing something?