[PATCH 2/2] dim: handle conflicts when updating the rerere-cache

Rodrigo Vivi rodrigo.vivi at intel.com
Mon Dec 18 20:43:15 UTC 2017


On Fri, Dec 15, 2017 at 03:34:50PM +0000, Daniel Vetter wrote:
> Ever since we implemented the explicit garbage-collection logic for
> the rr-cache/ entries there's been reports by committers that the git
> pull in drm-rerere failed. I think I've seen that now enough times to
> distill at least 2 patters:
> 
> - Race with someone else hitting the same conflict, or at least a
>   conflict with the same conflict-sha1. Then you have locally preimage
>   (and perhaps other files) which conflict. Because those files are
>   numbered it's pretty hard to merge them automatically, so best to
>   just throw away the local stuff.
> 
> - git gc removed a bunch of rr-cache/ entries. We've never figured out
>   how exactly the gc logic for rr-cache entries works, except it seems
>   to be atime based and extremely erratic. Again best option is to
>   just reset and let dim gc rr-cache/ entries explicitly (and in a
>   much more consistent way).
> 
> I think the only risk in this patch is if 2 people resolved the exact
> same conflict in drm-tip, but then maybe they should start talking
> with each another on irc instead of just looking at dim output.
> Throwing away the 2nd conflict resolution shouldn't result in much
> harm at least.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> ---
>  dim | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/dim b/dim
> index ab58ceedc7aa..7da988aa710a 100755
> --- a/dim
> +++ b/dim
> @@ -517,12 +517,23 @@ function pull_rerere_cache
>  	fi
>  
>  	if ! git pull -q ; then
> -		echoerr "Failed to update the rerere cache."
> -		echoerr "Please manually run"
> -		echoerr "	$ cd $DIM_PREFIX/drm-rerere ; git pull"
> -		echoerr "and fixup any issues."
> +		# We raced with someone else hitting the same conflict, or the
> +		# erratic git gc for rr-cache entries nuke a few entries we
> +		# still want to keep. Clean up and try, but only when the
> +		# initial pull fails since otherwise there's no way to keep new
> +		# resolutions around.
> +		echo "Conflict in the rr-cache, cleaning up"
> +		git clean -fdx rr-cache/

\o/ - I had to do this manually sometimes already.

> +		git checkout -f ':(glob)rr-cache/**'

I just learned a new very useful trick... I didn't know this glob... :)

> +
> +		if ! git pull -q ; then
> +			echoerr "Failed to update the rerere cache."
> +			echoerr "Please manually run"
> +			echoerr "	$ cd $DIM_PREFIX/drm-rerere ; git pull"
> +			echoerr "and fixup any issues."
>  
> -		return 1
> +			return 1
> +		fi
>  	fi
>  	cd - > /dev/null
>  }
> --

Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

> 2.15.1
> 
> _______________________________________________
> dim-tools mailing list
> dim-tools at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dim-tools


More information about the dim-tools mailing list