Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

snh
Copy link
Member

@snh snh commented Mar 7, 2016

This PR prevents Git GC operations and some other maintenance jobs from running while repositories are being restored using ghe-restore-repositories-rsync, ghe-restore-repositories-dgit and ghe-restore-repositories-gist.

This makes use of the existing $GHE_REMOTE_DATA_USER_DIR/repositories/.sync_in_progress file, which is already used by ghe-backup-repositories-rsync and ghe-backup-repositories-cluster, and largely copies the existing code from these.

Also waits for Git GC operations to finish before beginning restore, much like backups already do.

/cc @github/backup-utils

@snh
Copy link
Member Author

snh commented Mar 19, 2016

Updated to include cluster support.

@snh
Copy link
Member Author

snh commented Mar 19, 2016

Also waits for Git GC operations to finish before beginning restore, much like backups already do.

trap 'cleanup' INT TERM EXIT

wait_pids=""
for hostname in $hostnames; do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this will match all the servers in the cluster, not only git servers. Is that the intention?

Running something like:

ghe-cluster-each -r git -p

will return the list of git servers only. Same applies when cleaning up the sync_in_progress_file.

@snh
Copy link
Member Author

snh commented Mar 24, 2016

@rubiojr Thanks for the detailed and valuable feedback. I very much appreciate it! ✨

I have just pushed a couple of new commits that refactor a number of areas as a result of @rubiojr's feedback.

As a lot of this code was copy and pastes from existing code in the repository backup scripts, there is some refactoring to be done to those areas too. This is best done as a seperate activity since this PR only deals with the restore side.

@rubiojr
Copy link
Member

rubiojr commented Mar 24, 2016

@snh 🤘, I really like how you approached this. Let me 👀 that one more time.

@@ -0,0 +1,48 @@
#!/bin/sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#!/usr/bin/env bash here?

@snh
Copy link
Member Author

snh commented Mar 26, 2016

@rubiojr Thanks for the latest feedback. I've made a few changes as a result. Does the way I have re-jigged the working directory stuff look OK? My plan would be to do a new PR to update all the other scripts.

# Bring in the backup configuration
cd $(dirname "$0")/../..
. share/github-backup-utils/ghe-backup-config
export GHE_BACKUP_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid the export here to prevent potential regression/behaviour change in a patch release.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean avoid the export and don't use the GHE_BACKUP_ROOT variable name for now. That'd change ghe-backup-config behaviour I think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did try and avoid changing ghe-backup-config behavior but ran in to a
issue with it requiring the working dir be changed to the root backup utils
dir before being called.

In share/github-backup-utils/ghe-gc-disable
#179 (comment):

@@ -9,8 +9,8 @@
set -e

Bring in the backup configuration

-cd $(dirname "$0")/../..
-. share/github-backup-utils/ghe-backup-config
+export GHE_BACKUP_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"

I mean avoid the export and don't use the GHE_BACKUP_ROOT variable name for
now. That'd change ghe-backup-config behaviour I think.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/github/backup-utils/pull/179/files/26feaa1f4392b21b825040e0c268ecf1cb0fd5da..3427dfe7df2867bd54250b37ee7c4ae7e150efef#r57606669

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snh ah, gotcha. Then leaning towards reverting the change, keep using pwd for now and address this in a future PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is, reverting 3427dfe.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rubiojr Sounds like a plan. I will revert that commit.

@rubiojr
Copy link
Member

rubiojr commented Mar 28, 2016

Does the way I have re-jigged the working directory stuff look OK?

Added some comments to avoid changing behaviour and potential regressions for now but the rest looks great to me.

My plan would be to do a new PR to update all the other scripts.

That'd be great.

@rubiojr
Copy link
Member

rubiojr commented Mar 28, 2016

Thanks Steven, :shipit: when you want.

@snh snh merged commit b470d0d into master Mar 29, 2016
@rubiojr rubiojr deleted the snh/restore-lockfile branch March 29, 2016 13:33
cjonsmith pushed a commit that referenced this pull request Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants