Hello!
If you run the command pragma sync_status
you will see that the database is not yet ready for modifications.
Look at the db_is_ready
field:
sqlite> .open "file:test1.db?node=primary&total_primary_nodes=3&bind=tcp://0.0.0.0:9111"
sqlite> pragma sync_status;
{
"use_litesync": true,
"node_type": "primary",
"node_id": 0,
"db_is_ready": false,
"sync_down_state": "unknown",
"sync_up_state": "unknown",
"last_tid": 0,
"log_storage": "keep",
"peers": []
}
You (or your app) must always check this field before making any modifications.
The reason of the difference is because when the total_primary_nodes
is missing, it defaults to 1 and as this node is the single primary node, it can go forward and initialize the database alone.
But when it is set to 3, this node alone cannot go forward. It needs majority to agree on details. On this case majority of 3 is 2, so it needs at least 1 another node connecting to it so they can go forward.
After the db_is_ready
is true
, you can make modifications on the database, on any of the nodes that return true
.
Just a note: this error also appears then the database has more than 1 table. Note that the free version has a limit of just 1 table per database. So if this error appears on that situation, you already know the reason.