# Deleting Data in InfluxDB2 fails

**URL:** <https://community.influxdata.com/t/deleting-data-in-influxdb2-fails/17549>\
**Category:** InfluxDB 2\
**Created:** [January 9, 2021, 10:01pm UTC](https://community.influxdata.com/t/deleting-data-in-influxdb2-fails/17549 "2021-01-09T22:01:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris\_b](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@chris\_b](https://community.influxdata.com/u/chris_b)\
**Post date:** [January 9, 2021, 10:01pm UTC](https://community.influxdata.com/t/deleting-data-in-influxdb2-fails/17549/1 "2021-01-09T22:01:08Z")

</div>

Hi,  
I have a problem regarding data deletion in InfluxDB2. I tried the command `influx delete ...` but this fails with the following error:

```auto
Error: Failed to delete data: unable to delete: cannot delete data. DB contains shards using both inmem and tsi1 indexes. Please convert all shards to use the same index type to delete data.: cannot delete data. DB contains shards using both inmem and tsi1 indexes. Please convert all shards to use the same index type to delete data.
See 'influx delete -h' for help

```

**How can I convert those indices?** I found nothing in the docs. And the -h command is not helpful with this problem.

Secondary question: Does this happen due to the fact that I started collection data with InfluxDB1 and migrated this data? Or is this not related to the upgrade process?

---

<div class="post-metadata">

**Author:** ![LazyLinuxLover](https://avatars.discourse-cdn.com/v4/letter/l/8dc957/32.png) [@LazyLinuxLover](https://community.influxdata.com/u/LazyLinuxLover)\
**Post date:** [January 10, 2021, 8:38am UTC](https://community.influxdata.com/t/deleting-data-in-influxdb2-fails/17549/2 "2021-01-10T08:38:56Z")

</div>

Hi @chris_b  
I don’t know why there is two type of index in your influxdb, but there is a doc for better memory management in this [link](https://www.influxdata.com/blog/how-to-overcome-memory-usage-challenges-with-the-time-series-index/). The point is it shows how to convert indexes to tsi1.  
I hope it helps you.

---

<div class="post-metadata">

**Author:** ![chris\_b](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@chris\_b](https://community.influxdata.com/u/chris_b)\
**Post date:** [January 10, 2021, 12:49pm UTC](https://community.influxdata.com/t/deleting-data-in-influxdb2-fails/17549/3 "2021-01-10T12:49:34Z")

</div>

Hi,  
thanks for your reply. Unfortunately `influx_inspect buildtsi` is not available on InfluxDB 2.x and I didn’t manage to find any equivalent.

---

<div class="post-metadata">

**Author:** ![tim.hall](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/tim.hall/32/39_2.png) [@tim.hall](https://community.influxdata.com/u/tim.hall)\
**Post date:** [January 20, 2021, 9:48pm UTC](https://community.influxdata.com/t/deleting-data-in-influxdb2-fails/17549/4 "2021-01-20T21:48:42Z")

</div>

did you upgrade your instance from v1? InfluxDB v2 only possesses the tsi1 style index.

---

<div class="post-metadata">

**Author:** ![chris\_b](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@chris\_b](https://community.influxdata.com/u/chris_b)\
**Post date:** [January 21, 2021, 11:30am UTC](https://community.influxdata.com/t/deleting-data-in-influxdb2-fails/17549/5 "2021-01-21T11:30:39Z")

</div>

Hi @tim.hall,  
That’s correct, I upgraded from v1. Any idea what I can do now to solve my problem?

Thanks

---

<div class="post-metadata">

**Author:** ![dan-moran](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/dan-moran/32/5885_2.png) [@dan-moran](https://community.influxdata.com/u/dan-moran)\
**Post date:** [January 21, 2021, 5:47pm UTC](https://community.influxdata.com/t/deleting-data-in-influxdb2-fails/17549/6 "2021-01-21T17:47:28Z")

</div>

@chris_b you might be able to get by for now by setting the `index-version` config key to `"inmem"` (you could also set `INFLUXD_INDEX_VERSION=inmem` in the env, or pass `--index-version inmem` when you run `influxd`)

The good news is that we’ve already identified & fixed the issue, to be included in the upcoming 2.0.4 release. The fix is going to truly remove the “inmem” index option, and include logic to rebuild missing TSI indexes on startup when needed.

---

<div class="post-metadata">

**Author:** ![chris\_b](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@chris\_b](https://community.influxdata.com/u/chris_b)\
**Post date:** [January 21, 2021, 7:04pm UTC](https://community.influxdata.com/t/deleting-data-in-influxdb2-fails/17549/7 "2021-01-21T19:04:55Z")

</div>

Hey @dan-moran ,  
thanks for replying! That sounds like good news. I have no pressure to delete the affected data so I will happily wait for the 2.0.4 release 🙂

---

<div class="post-metadata">

**Author:** ![tim.hall](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/tim.hall/32/39_2.png) [@tim.hall](https://community.influxdata.com/u/tim.hall)\
**Post date:** [February 24, 2021, 7:05pm UTC](https://community.influxdata.com/t/deleting-data-in-influxdb2-fails/17549/8 "2021-02-24T19:05:01Z")

</div>

should be available now @chris_b

[Downloads (influxdata.com)](https://portal.influxdata.com/downloads/)

---

<div class="post-metadata">

**Author:** ![Jarek\_Jaz](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jarek_jaz/32/6086_2.png) [@Jarek\_Jaz](https://community.influxdata.com/u/Jarek_Jaz)\
**Post date:** [September 5, 2021, 3:42pm UTC](https://community.influxdata.com/t/deleting-data-in-influxdb2-fails/17549/9 "2021-09-05T15:42:53Z")

</div>

Hi tim.hall  
I am using influxdb v 2.0.7 and Influx CLI 2.0.7 (git: 2a45f0c037) build\_date: 2021-06-04T19:17:40Z on centos 8 and I am trying to delete data from measuremrnt, accordingly to documentation [influx delete | InfluxDB OSS 2.0 Documentation](https://docs.influxdata.com/influxdb/v2.0/reference/cli/influx/delete/), and data stil exists in influx.  
I am trying to do this with:  
influx delete --org my-org --bucket my-bucket --start 2020-01-01T00:00:00Z --stop 2021-09-05T00:00:00Z --predicate ‘\_measurement=“mymeasurement”’ --token my\_token

Kind regards.
