We have some challenges in ensuring the pseudo database is flushed to disk in things like docker containers since the processes can be killed with no warning at container termination. Rightly or wrongly, we need to handle this better.
There is no current way to flush the DB but there is a shutdoen request mechanism. Whilst we can't force a shutdown from bitbake due to the multiple connected clients and the existing 3s shutdown isn't enough, we can take the hint to flush the DB at this time. Further writes are unlikely. Signed-off-by: Richard Purdie <[email protected]> --- pseudo_db.c | 2 +- pseudo_db.h | 1 + pseudo_server.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pseudo_db.c b/pseudo_db.c index 6c48cc8..14bafcb 100644 --- a/pseudo_db.c +++ b/pseudo_db.c @@ -399,7 +399,7 @@ signed_ino(ino_t ino) { #ifdef USE_MEMORY_DB -static void +void pdb_backup() { sqlite3_backup *pBackup; /* no point in doing this if we don't have a database to back up, diff --git a/pseudo_db.h b/pseudo_db.h index 5a4aa59..9d01232 100644 --- a/pseudo_db.h +++ b/pseudo_db.h @@ -26,6 +26,7 @@ typedef struct { char *program; } log_entry; +extern void pdb_backup(void); extern int pdb_maybe_backup(void); extern int pdb_cancel_unlink_file(pseudo_msg_t *msg); extern int pdb_did_unlink_file(char *path, pseudo_msg_t *msg, int deleting); diff --git a/pseudo_server.c b/pseudo_server.c index 84cef05..815c76b 100644 --- a/pseudo_server.c +++ b/pseudo_server.c @@ -568,6 +568,7 @@ serve_client(int i) { } in->pathlen = (s - response_path) + 1; /* exit quickly once clients go away, though */ + pdb_backup(); pseudo_server_timeout = 3; } else { in->type = PSEUDO_MSG_ACK; -- 2.32.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#156343): https://lists.openembedded.org/g/openembedded-core/message/156343 Mute This Topic: https://lists.openembedded.org/mt/85857567/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
