edge_dump.sh #1

  • //
  • guest/
  • perforce_software/
  • sdp/
  • main/
  • Server/
  • Unix/
  • p4/
  • common/
  • bin/
  • edge_dump.sh
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/bin/bash
#==============================================================================
# Copyright and license info is available in the LICENSE file included with
# the Server Deployment Package (SDP), and also available online:
# https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE
#------------------------------------------------------------------------------

# This script is designed to create a filter checkpoint for an Edge server
#
# Note:
# This is not required unless you are filtering data via the server spec. If you are not
# doing that, then you can reseed the edge using the latest checkpoint of the master.
#
# The script requires the SDP instance, the edge server ID and the checkpoint name as parameters to the script.

# Run example:
#  ./edge_dump.sh 1 sfo_edge /depotdata/p4_1.edgeckp.9188.gz

export SDP_INSTANCE=${SDP_INSTANCE:-Undefined}
export SDP_INSTANCE=${1:-$SDP_INSTANCE}
if [[ $SDP_INSTANCE == Undefined ]]; then
   echo "Instance parameter not supplied."
   echo "You must supply the Perforce instance as a parameter to this script."
   exit 1
fi

. /p4/common/bin/p4_vars $SDP_INSTANCE
. /p4/common/bin/backup_functions.sh
LOGFILE=$LOGS/edge_dump.log

######### Start of Script ##########

check_vars
set_vars

if [[ "$3" == "" ]]; then
   echo You must pass in the edge server ID and the full path and filename of the checkpoint you want to create.
   exit 2
fi

EDGEID=$2
EDGECKP=$3

# With -k we filter out the various Edge-specific tables which will be replaced with 
# current live versions.
EXCLUDED_TABLES=db.have,db.working,db.resolve,db.locks,db.revsh,db.workingx,db.resolvex

log "Create checkpoint from master offline_db skipping tables not used on the edge and using the edge server form for any filtered data."
{ time /p4/${SDP_INSTANCE}/bin/p4d_${SDP_INSTANCE} -r /p4/${SDP_INSTANCE}/offline_db/ -k $EXCLUDED_TABLES -P EDGEID -jd -z $EDGECKP; } >> $LOGFILE 2>&1 || { die "Edge reseed checkpoint dump failed!"; }

log "Edge reseed checkpoint complete."

# Inform the user about follow up tasks
log "You now need to copy $EDGECKP to the edge server and use /p4/common/bin/recover_edge.sh to reseed the edge server."

cat $LOGFILE

# Change User Description Committed
#7 27331 C. Thomas Tyler Released SDP 2020.1.27325 (2021/01/29).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#6 25951 C. Thomas Tyler Released SDP 2019.2.25949 (2019/08/12).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#5 25940 C. Thomas Tyler Released SDP 2019.2.25938 (2019/08/05).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#4 25933 C. Thomas Tyler Released SDP 2019.2.25923 (2019/08/05).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#3 23331 C. Thomas Tyler Released SDP 2017.4.23329 (2017/12/05).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#2 23006 C. Thomas Tyler Released SDP 2017.3.23003 (2017/10/19).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#1 22685 Russell C. Jackson (Rusty) Update main with current changes from dev.
//guest/perforce_software/sdp/dev/Server/Unix/p4/common/bin/edge_dump.sh
#3 22617 Russell C. Jackson (Rusty) Added +x
#2 22615 Russell C. Jackson (Rusty) Added suggested comments.
By passing review since this is a comment only change.
#1 22614 Russell C. Jackson (Rusty) New script to create a filtered checkpoint to use to rebuild an edge server.
This is not required unless you are filtering data via the server spec. If you are not
doing that, then you can reseed the edge using the latest checkpoint of the master.