"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: don't delete pack files that are too younger
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Tue, 11 Jul 2023 17:27:05 +0200

Download raw body.

Thread
On Tue, Jul 11, 2023 at 05:15:58PM +0200, Omar Polo wrote:
> similar to what we do for the loose objects.  This prevents races when
> gotadmin load, got fetch or gotd are installing a new pack file and a
> concurrent gotadmin cleanup wants to delete it as redundant because it
> hasn't seen the new refs.

> @@ -1203,6 +1204,17 @@ purge_redundant_pack(struct got_repository *repo, cons
>  		return got_error(GOT_ERR_NO_SPACE);
>  
>  	/*
> +	 * Do not delete pack files which are younger than our maximum
> +	 * modification time threshold.  This prevents a race where a
> +	 * new pack file which is being added to the repository
> +	 * concurrently would be deleted.
> +	 */
> +	if (fstatat(got_repo_get_fd(repo), path, &sb, 0) == -1)

Shouldn't this ignore ENOENT?

> +		return got_error_from_errno2("fstatat", path);
> +	if (!ignore_mtime && sb.st_mtime > max_mtime)
> +		*remove = 0;
> +