Back

What does a "failed" index mean?

  • 0
  • Databases
Drake
13 May, 2023, 03:23

It means it didn't successfully created. You should check the docker logs for the appwrite-worker-databases container for more info

TL;DR
The user is asking about what a "failed" index means and how to deal with it on a dev server and on a production server. They also mention a failure in deleting and recreating a collection. The suggested solution is to recreate the collection or manually delete rows and the index in mariadb. The user also asks about an easier way to view logs and suggests deleting the index and attempting to recreate it. The response is to check the docker logs for more information.
mauricev
13 May, 2023, 03:25

this happened a while ago and those logs are long lost. Can I delete the index and attempt to re-create it?

Drake
13 May, 2023, 03:27

Maybe

mauricev
13 May, 2023, 03:27

The log looks new: it just says "appwrite_vm /var/lib/docker/containers/5333ffe519c45470a703b31bbe7ea2e4adccfad4fe9dffc170f480b3028a8691 # more 5333ffe519c45470a703b31bbe7ea2e4adccfad4fe9dffc170f480b3028a8691-json.log {"log":"\u001b[32mAppwrite database worker v1 has started\n","stream":"stdout","time":"2023-05-02T02:30:33.965141813Z"} {"log":"\u001b[0m\n","stream":"stdout","time":"2023-05-02T02:30:33.965189813Z"} {"log":"[notice] Starting worker 5333ffe519c4:7:v1-database\n","stream":"stdout","time":"2023-05-02T02:30:33.974499813Z"}"

Drake
13 May, 2023, 03:28

Why are you looking at the logs like this?

mauricev
13 May, 2023, 03:28

Am I doing something stupid?

mauricev
13 May, 2023, 03:28

Recreating also fails

Drake
13 May, 2023, 03:29

With what?

Drake
13 May, 2023, 03:29

Check the logs

mauricev
13 May, 2023, 03:30

You seem to be suggesting there's an easier way to view the log aside from reading on the terminal. Now the log is ginormous

Drake
13 May, 2023, 03:32

You typically check docker logs using the docker logs command or docker compose logs. There are various options you can pass too

mauricev
13 May, 2023, 03:33

A-ha! It says "Index already exists"

mauricev
13 May, 2023, 03:38

But that's occurring upon recreating it after I deleted it, so it appears that 1) the deletion code isn't doing its job and 2) the recreation code should first call delete on its own. The deletion code doesn't appear to be reporting any errors.

Drake
13 May, 2023, 03:46

The thing is you don't know what happened the first time it failed. It could be the index already exists but it failed to create some of the Appwrite metadata so Appwrite thinks the index doesn't exist but it does exist in mariadb.

To fix this, the easiest thing to do is recreate the collection. Otherwise, you'd need to manually delete rows in some of the tables and the index in mariadb

mauricev
13 May, 2023, 03:58

This is a dev server, but how would we deal with this on a real-world production server?

mauricev
13 May, 2023, 04:03

OK, by recreate the collection you mean just database fields and this won't delete the actual data or am I confused?

Drake
13 May, 2023, 04:04

No, deleting the collection would delete the data.

Drake
13 May, 2023, 04:04

You would have to do the 2nd option

mauricev
13 May, 2023, 04:06

which particular rows would I delete and how would that fix it? Also, if this happened on a production server, this failure seems somewhat catastrophic.

Drake
13 May, 2023, 04:08

You'd have to dig around a bit...I can help you look tomorrow if you need.

It's just annoying to see a failed index. It's not that catastrophic.

mauricev
13 May, 2023, 04:09

this is just a dev server, but i can recreate the schema from scratch when we go into production to avoid any failed indices from getting copied over

Drake
13 May, 2023, 04:21

I suggest using the Appwrite CLI to quickly deploy your collections.

https://appwrite.io/docs/command-line-deployment

mauricev
13 May, 2023, 04:28

If I understand correctly, I will produce an appwrite.json file from the dev server, and I copy it to the new server and upload it, but what isn't clear is how do I access the CLI? Is this happening on the shell of the appwrite containers themselves?

Drake
13 May, 2023, 04:44

You don't need to copy it to the server. You can use the CLI from wherever

Drake
13 May, 2023, 04:44
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more