All of lore.kernel.org
 help / color / mirror / Atom feed
From: Khem Raj <raj.khem@gmail.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>,
	openembedded-core@lists.openembedded.org
Cc: seebs@seebs.net
Subject: Re: [OE-core] [PATCH] pseudo_db: Flush DB if there is a shutdown request
Date: Sat, 25 Sep 2021 07:08:58 -0700	[thread overview]
Message-ID: <9e8e0aed-b7d3-201c-46c2-e827334f7912@gmail.com> (raw)
In-Reply-To: <20210925093539.1780545-1-richard.purdie@linuxfoundation.org>



On 9/25/21 2:35 AM, Richard Purdie wrote:
> 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

typo shutdoen/shutdown

> 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 <richard.purdie@linuxfoundation.org>
> ---
>   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;
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> 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/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


      reply	other threads:[~2021-09-25 14:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-25  9:35 [PATCH] pseudo_db: Flush DB if there is a shutdown request Richard Purdie
2021-09-25 14:08 ` Khem Raj [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e8e0aed-b7d3-201c-46c2-e827334f7912@gmail.com \
    --to=raj.khem@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    --cc=seebs@seebs.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.