Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't delete database entries anymore #903

Closed
Ne00n opened this issue Oct 16, 2021 · 4 comments
Closed

Can't delete database entries anymore #903

Ne00n opened this issue Oct 16, 2021 · 4 comments

Comments

@Ne00n
Copy link

Ne00n commented Oct 16, 2021

What version are you running?
6.6.0
What did you do?
Deleting an existing entry in the database
What did you expect to happen?
That it would actually get deleted
What happened instead?
The database is refusing to delete the entry.
"Error: attempt to write a readonly database"
Which makes no fucking sense on a standalone instance

I tested it with 5.10.1, an older version, works as expected.

@otoolep
Copy link
Member

otoolep commented Oct 16, 2021

Which makes no fucking sense on a standalone instance

Let's not forget our manners, OK?

You -- or the code you are using -- seem to be using the API incorrectly, and are trying to send a SQL command that changes the database to the query endpoint (/db/query). Please show me exactly how you are deleting the database -- via curl, the CLI, or a client library.

@Ne00n
Copy link
Author

Ne00n commented Oct 16, 2021

Of course, I am sorry.

I just browsed the documentation again, and it seems like I was sending DELETE queries to db/query which did work.
They should have been send to db/execute, which apparently now has been changed.

Still, can you please change that misleading error message?
Somewhat, incorrect endpoint instead of readonly database.

readonly makes sense if you know the background, but if you see this error at first, I thought rqlite did not had permissions or I was running out of storage.

@otoolep
Copy link
Member

otoolep commented Oct 17, 2021

Sending requests that change the database to the query endpoint will break rqlite -- because those changes will not go through Raft consensus (in most cases). It's critical that changes to the database go to the db/execute endpoint. As per the documentation:

Writes to the database must be sent to the /db/execute endpoint, and reads should be sent to the /db/query endpoint. It is important to use the correct endpoint for the operation you wish to perform.

The 6.0 series uses a read-only connection for the db/query endpoint precisely to prevent you from making a mistake. Also, that message is from SQLite, not, rqlite, so changing it would require some coding. I have some ideas that can help, let me look into it.

I will also make the docs a bit clearer about all this.

@otoolep
Copy link
Member

otoolep commented Oct 18, 2021

Error message improved in PR #907.

@otoolep otoolep closed this as completed Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants