restore-in-progress
A restore is running, which refuses reads and writes until it has finished.
- Routes:
write-events,read-events,observe-events,run-eventql-query,register-event-schema,read-subjects,read-event-types,read-event-type,create-backup,restore-backup,import-events,export-events, andverify-store - Description:
restore is in progress: try again once it has finished - Details:
operation, the operation that the database refuses:read,write, orobserve.
Why It Happens#
While it restores a backup or imports events, through the routes restore-backup and import-events, EventSourcingDB keeps every other request away from the data, readers and writers alike, since what they would read or change is being replaced. This includes a second restore or import. An observation that runs when a restore begins ends with this error, after the events it has sent so far, and so can a read that is under way.
An export that a restore refuses at its start answers with this error as a single envelope, with the content type application/json, since an export carries no error items. Some operations wait for the restore instead of being refused: an audit, from its start on, and, once they have begun, a backup, an export, a verification of the store, and the check of the stored events that registering a schema makes. If the database refuses a request for another reason as well, that reason is reported instead, such as store-read-only for a write in read-only mode.
How to Fix It#
Wait until the restore has finished, then send the request again; it can succeed then. An observation that ended this way has to be started anew, since the restore has replaced the events it was reading.
Example#
To read the events of /books/42 while a backup is being restored, EventSourcingDB answers with this error, as a line of the stream, and then ends the stream with its end item:
{
"type": "error",
"data": {
"code": "https://docs.eventsourcingdb.io/errors/restore-in-progress",
"description": "restore is in progress: try again once it has finished",
"details": {
"operation": "read"
}
}
}