#!/bin/bash #------------------------------------------------------------------------------ # Copyright (c) Perforce Software, Inc., 2007-2015. All rights reserved # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1 Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE # SOFTWARE, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH # DAMAGE. #----------------------------------------------------------------------------- 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 AWK=awk ID=id MAIL=mail OS=`uname` if [ "${OS}" = "SunOS" ] ; then AWK=/usr/xpg4/bin/awk ID=/usr/xpg4/bin/id MAIL=mailx elif [ "${OS}" = "AIX" ] ; then AWK=awk ID=id MAIL=mail fi export AWK export ID export MAIL cd /p4/common/bin common_dir=`pwd -P` . /p4/common/bin/backup_functions.sh if [ -d $common_dir ]; then cd $common_dir else echo $common_dir does not exist. exit 1 fi ######### Start of Script ########## check_vars set_vars check_dirs [ -f $common_dir/p4 ] || { echo "No p4 in $common_dir" ; exit 1 ;} [ -f $common_dir/p4d ] || { echo "No p4d in $common_dir" ; exit 1 ;} chmod 777 $common_dir/p4 chmod 700 $common_dir/p4d [[ -f $common_dir/p4broker ]] && chmod 755 $common_dir/p4broker P4RELNUM=`./p4 -V | grep -i Rev. | $AWK -F / '{print $3}'` P4DRELNUM=`./p4d -V | grep -i Rev. | $AWK -F / '{print $3}'` P4BLDNUM=`./p4 -V | grep -i Rev. | $AWK -F / '{print $4}' | awk '{print $1}'` P4DBLDNUM=`./p4d -V | grep -i Rev. | $AWK -F / '{print $4}' | awk '{print $1}'` CURRENT_RELNUM=`./p4d_${SDP_INSTANCE}_bin -V | grep -i Rev. | $AWK -F / '{print $3}'` LOGFILE=$LOGS/upgrade.log if [ -f $LOGFILE ]; then rm -f $LOGFILE fi log "Start $P4SERVER Upgrade" [ -f p4_$P4RELNUM.$P4BLDNUM ] || cp p4 p4_$P4RELNUM.$P4BLDNUM [ -f p4d_$P4DRELNUM.$P4DBLDNUM ] || cp p4d p4d_$P4DRELNUM.$P4DBLDNUM [ -f p4_${P4RELNUM}_bin ] && unlink p4_${P4RELNUM}_bin ln -s p4_$P4RELNUM.$P4BLDNUM p4_${P4RELNUM}_bin >> "$LOGFILE" 2>&1 [ -f p4d_${P4DRELNUM}_bin ] && unlink p4d_${P4DRELNUM}_bin ln -s p4d_$P4DRELNUM.$P4DBLDNUM p4d_${P4DRELNUM}_bin >> "$LOGFILE" 2>&1 [ -f p4_bin ] && unlink p4_bin ln -s p4_${P4RELNUM}_bin p4_bin >> "$LOGFILE" 2>&1 if [[ -L p4broker_${SDP_INSTANCE}_bin ]]; then /p4/${SDP_INSTANCE}/bin/p4broker_${SDP_INSTANCE}_init stop P4BRELNUM=`./p4broker -V | grep -i Rev. | $AWK -F / '{print $3}'` P4BBLDNUM=`./p4broker -V | grep -i Rev. | $AWK -F / '{print $4}' | $AWK '{print $1}'` [[ -f p4broker_$P4BRELNUM.$P4BBLDNUM ]] || cp p4broker p4broker_$P4BRELNUM.$P4BBLDNUM [[ -L p4broker_${P4BRELNUM}_bin ]] && unlink p4broker_${P4BRELNUM}_bin ln -s p4broker_$P4BRELNUM.$P4BBLDNUM p4broker_${P4BRELNUM}_bin [[ -L p4broker_${SDP_INSTANCE}_bin ]] && unlink p4broker_${SDP_INSTANCE}_bin ln -s p4broker_${P4BRELNUM}_bin p4broker_${SDP_INSTANCE}_bin /p4/${SDP_INSTANCE}/bin/p4broker_${SDP_INSTANCE}_init start fi /p4/common/bin/p4login if [ "$P4REPLICA" == "FALSE" ] || [ $EDGESERVER -eq 1 ] ; then get_journalnum fi stop_p4d # Don't upgrade the database for minor upgrades if [ $CURRENT_RELNUM != $P4DRELNUM ]; then if [ "$P4REPLICA" == "FALSE" ] || [ $EDGESERVER -eq 1 ] ; then if [ "$P4REPLICA" == "FALSE" ] ; then truncate_journal sleep 1 fi replay_journal_to_offline_db sleep 1 fi unlink p4d_${SDP_INSTANCE}_bin >> "$LOGFILE" 2>&1 ln -s p4d_${P4DRELNUM}_bin p4d_${SDP_INSTANCE}_bin >> "$LOGFILE" 2>&1 $P4DBIN -r $P4ROOT -J off -xu >> "$LOGFILE" 2>&1 if [ "$P4REPLICA" == "FALSE" ] || [ $EDGESERVER -eq 1 ] ; then $P4DBIN -r $OFFLINE_DB -J off -xu >> "$LOGFILE" 2>&1 fi fi start_p4d log "Finish $P4SERVER Upgrade"
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#63 | 30631 | C. Thomas Tyler |
Corrected one message indicating why a second journal rotation was skipped. Added a second message for a different reason that second journal rotations can be skipped, i.e if not running on commit server. This change does not change processing functionality or workflows; it affects output displayed. |
||
#62 | 30630 | C. Thomas Tyler | Added error handling for using an unknown option (starting with '-'). | ||
#61 | 30038 | C. Thomas Tyler |
Enhanced upgrade.sh to better prepare for a rollback, adding docs and skipping replay of the rotated journal to the offline_db for the second journal rotation after a major version upgrade. |
||
#60 | 30025 | C. Thomas Tyler | Minor doc refinements. | ||
#59 | 30023 | C. Thomas Tyler |
Doc enhancements to upgrade.sh: * Docs make it more clear that p4d is expected to be online at the start of processing. * Enhanced error message for scenario where a cautious admin stops p4d manually first, causing the script to abort the upgrade. * Verified that the call to 'verify_sdp.sh' is captured in the output; this is done by verify_sdp.sh itself. Fixes: SDP-845. #review-30024 |
||
#58 | 29748 | C. Thomas Tyler |
Fixed issue with 'setcap': * Prelfight checks failed in some cases due to differing variants of 'setcap'; not all support the '-v' option the same. * The preflight check would actually hang in some cases (even though the actual setcap call would not) due to sudo/PAM configuration variations. #review-29749 |
||
#57 | 29666 | C. Thomas Tyler |
Added logic to avoid applying the 'setcap' (the OOM Killer defense) in Docker environments (e.g. for testing). Info: Using the 'setcap' command on a binary in a Docker container renders the binary inoperable. Attempts to execute the binary result in an 'Operation not permitted' error. The workaround: Don't use 'setcap' on binaries in a Docker container. #review-29667 |
||
#56 | 29665 | C. Thomas Tyler |
Tweaked logic to ensure schema upgrades are done (i.e. 'p4d -xu) even if the live running p4d is older than the binary on the disk, even if the binary on the disk did not need to be updated. This completes a dev branch change started in @29659. |
||
#55 | 29659 | C. Thomas Tyler |
Fixed upgrade.sh issue with outer-to-inner upgrades with NFS on inner server. In an environment where /hxdepots (and thus /p4/common) is shared via NFS, an upgrade on the outer server will confuse the upgrade.sh script into thinking that the inner server has already been upgraded, and that only a patch update rather than a major version update (requiring p4d -xu) is needed. So the 'p4d -xu' step is skipped, resulting in a failed service start. This change fixes that. In the case of a new binary being in place on disk, and linked to with the usual SDP symlinks, but having a major version that the differs with the live running p4d binary, a message is displayed something like: The live running p4d binary will be restarted to update from 2021.1.2179737 to 2021.2.2410559. A major version upgrade for the live running p4d is needed. A schema upgrade will be performed. #review-29660 |
||
#54 | 29640 | C. Thomas Tyler |
In upgrade.sh, refined preflight check for 'sudo setcap' ability. #review-29641 |
||
#53 | 29607 | C. Thomas Tyler |
Refined logic for applying setcap to handle a wider array scenarios with respect to sudo access not being available or possibly not being verifiable. |
||
#52 | 29606 | C. Thomas Tyler | Added override to skip preflight checks to ensure sudo access. | ||
#51 | 29604 | C. Thomas Tyler |
Added support for p4d r23.1 upgrades. This adds a call to 'sudo setcap' per the P4D 2023.1 release notes. Several preflight checks are done to verify the needed sudo access is available to do 'sudo setcap'. If no such access is available, an error message is displayed, and we abort in the preflight phase. The code for the sudo preflight checks avoids a password prompt/hang from 'sudo'. #review-29605 @brent_schiestl @jason_gibson |
||
#50 | 28645 | Domenic |
Updates to upgrade.sh. 1. Move sourcing of p4_vars values before $Log definition so that the instance's log path is used rather than always writing to /tmp. This aligns with the help info for the -L flag. 2. Expose the path to $TmpFile_1 as part of the 'p4 upgrades' step so users easily know where to go look if the process is taking longer than they'd expect rather. 3. Correct some misspellings. |
||
#49 | 28494 | Robert Cowham | Fix indentation of -man comments. | ||
#48 | 28473 | C. Thomas Tyler |
Fixed typo in script docs for upgrade.sh. Non-functional change. |
||
#47 | 28228 | C. Thomas Tyler |
Tweak to avoid erroneous error message when a service such as p4broker is not running and its binary does not need to be updated. |
||
#46 | 28199 | C. Thomas Tyler |
Added hooks for executing custom pre- and post- upgrade scripts. This will enable Helix Management System (HMS) centrally orchestrated upgrades to be integrated into vanilla SDP upgrades. |
||
#45 | 28158 | C. Thomas Tyler |
Made former '-n' preview mode the default behavior. Added new '-y' flag to execute a real upgrade. Added a message in preview mode to clarify that no actual upgrade is performed. Removed the '-n' preview option, as preview mode is now the default behavior. #review-28159 |
||
#44 | 28139 | C. Thomas Tyler |
upgrade.sh v4.7.0: Added '-Od' option to override restriction on doing downgrades. It is needed to upgrade from internal PREP-TEST upgrades. |
||
#43 | 27750 | C. Thomas Tyler |
upgrade.sh v4.6.9: * Fixed issue where where patch-only upgrades of instances after the first in a multi-instance environment are skipped. * Corrected error message for scenario where downgrades are attempted; the logic was correct but error message was confusing. verify_sdp.sh v5.17.3: * Extended '-skip version' meaning to also skip new live binary version comparison checks. Related updates: * A call to verify_sdp.sh in the switch_db_files() function in backup_functions.sh now skips the version check. * A call to daily_checkpoint.sh now skips the version check. #review-27743 |
||
#42 | 27722 | C. Thomas Tyler |
Refinements to @27712: * Resolved one out-of-date file (verify_sdp.sh). * Added missing adoc file for which HTML file had a change (WorkflowEnforcementTriggers.adoc). * Updated revdate/revnumber in *.adoc files. * Additional content updates in Server/Unix/p4/common/etc/cron.d/ReadMe.md. * Bumped version numbers on scripts with Version= def'n. * Generated HTML, PDF, and doc/gen files: - Most HTML and all PDF are generated using Makefiles that call an AsciiDoc utility. - HTML for Perl scripts is generated with pod2html. - doc/gen/*.man.txt files are generated with .../tools/gen_script_man_pages.sh. #review-27712 |
||
#41 | 27708 | C. Thomas Tyler | Fixed typo in output; non-functional change. | ||
#40 | 27455 | C. Thomas Tyler |
Normalized usage of calls to verify_sdp.sh from other scripts. In some contexts, we may desire "squeaky clean," while in other contexts we may only need assurance that core functions are operating OK. Fixed typo in variable name used by verify_sdp.sh in call from upgrade.sh that prevented local VERIFY_SDP_SKIP_TEST_LIST def'n from having any effect. |
||
#39 | 27347 | C. Thomas Tyler |
upgrade.sh v4.6.5: Refined logic and doc for 'to-or-thru' 2019.1 upgrades. The logic to implicitly disable online upgrades for 'to-or-thru' P4D 2019.1 upgrades now only applies if not on the master server. The master server will still be started after unless the '-M' option is used to specifically request a manual upgrade option. Also added doc content re: planning for ugprades. |
||
#38 | 27346 | C. Thomas Tyler | Accounted for VERIFY_SDP_SKIP_TEST_LIST possibly being set. | ||
#37 | 27345 | C. Thomas Tyler | Fixed typo in message. | ||
#36 | 27344 | C. Thomas Tyler |
Tweak '-M' to skip online verify check. Fixed bug with version identification. |
||
#35 | 27343 | C. Thomas Tyler | Reset error count with -I. | ||
#34 | 27342 | C. Thomas Tyler | Added '-M' option for manual processing. | ||
#33 | 27341 | C. Thomas Tyler | Completed '-I' flag. | ||
#32 | 27340 | C. Thomas Tyler | Added -I flag. | ||
#31 | 27339 | C. Thomas Tyler |
New upgrade.sh able to handle outer-to-inner for upgrades starting from a pre-2019.1 start point going 'to-or-thru' 2019.1. |
||
#30 | 27216 | C. Thomas Tyler |
Non-functional change: Fixed a common doc type: paramter -> parameter |
||
#29 | 27210 | C. Thomas Tyler | upgrade.sh v4.3.2: Spellcheck and shellcheck. | ||
#28 | 27209 | C. Thomas Tyler | Refined message indicating why phases 3 and 5 might be skipped. | ||
#27 | 27207 | C. Thomas Tyler |
upgrade.sh v4.3.0: * Greatly enhanced documentation and examples. * Before doing second journal rotation: - Added wait for 'p4 storage -w' (for 'to or thru' P4D 2019.1). - Added wait for 'p4 upgrades|grep -v completed' (for P4D 2020.2+) * Added check for whether p4broker and p4p were online at the start of upgrade processing. Only start those services that were running at the beginning of processing are now started after the binaries and symlinks are updated. For the broker, only the broker with the default configuration is stopped and started; DFM brokers are ignored by this script (thus making this script compaitble with using DFM brokers). * Fixed bug where '-c' (Protections table comment conversion) would have failed due to 'p4d' addition of 'Update:' field to the Protections table. Also generally enhanced logic to convert Protections table comments. * Added support for operation on proxy-only and broker-only hosts. Processing of upgrades for p4d occur only if /p4/N/bin/p4d_N_init script exists on the machine. * Refined lexigraphical P4D version comparsion checks. verify_sdp.sh v5.12.0: * Added support for proxy-only and broker-only hosts. The existence of a *_init script in the instance bin dir for any of the Helix server binaries p4d/p4p/p4broker indicate they are configured, determining what tests are executed or skipped. * Added check_file_x() function to check for execute bit on files. In backup_functions.sh, fixed is_server_up() to avoid displaying output. #review-27208 |
||
#26 | 27022 | C. Thomas Tyler | Changed 'exes' to 'helix_binaries' in folder and script name, per review. | ||
#25 | 26989 | C. Thomas Tyler | Fixed issue where initial commnad line wasn't displayed correctly. | ||
#24 | 26982 | C. Thomas Tyler |
mkdirs.sh v4.1.0: * Accounted for directory structure change of Maintenance to Unsupported. * Added standard command line processing with '-h' and '-man' doc flags, and other flags (all documented). * Added in-code docs and updated AsciiDoc. * Enhanced '-test' mode to simulate /hx* mounts. * Enhanced preflight testing, and fixed '-test' mode installs. * Added support for installing to an alternate root directory. * Added '-s <ServerID>' option to override REPLICA_ID. * Added '-S <TargetServerID>' used for replicas of edge servers. * Added '-t <server_type>' option to override SERVER_TYPE. * Added '-M' option to override mount points. * Added '-f' fast option to skip big chown/chmod commands, and moved those commands near the end as well. verify_sdp.sh v5.9.0: * Added check for /p4/Version file, and checked that other legacy SDP methods of checking version * Added sanity check for crontab. * Added 'test skip' mechanism to skip certain tests: - crontab: Skip crontab check. Use this if you do not expect crontab to be configured, perhaps if a different scheduler is used. - license: Skip license related checks. - version: Skip version checks. - excess: Skip checks for excess copies of p4d/p4p/p4broker in PATH. * Added VERIFY_SDP_SKIP_TEST_LIST setting ton instance_vars.template, to define a standard way to have verify_sdp.sh always skip certain tests for a site. * Extended '-online' checks to check for bogus P4MASTERPORT, a common config error. Update test_SDP.py: * Adjusted test suite to account for various changes in mkdirs.sh. * Added 'dir' parameter to run_cmd() and sudo_cmd(), to run a command from a specified directory (as required to test new mkdirs.sh) * Added check_links() similar to existing check_dirs() function. === Upgrade Process Changes === Made /p4/common/bin/p4d/p4/p4broker/p4p shell script rather than binary. This changes the way SDP new binaries are staged for upgrade. For safety, exes are now staged to a director outside the PATH, the /p4/sdp/exes folder. A new 'get_latest_exes.sh' script simplifies the task of pulling executables from the Perforce FTP server. This can be used 'as is' for environments with outbound internet access, and is useful in any case to describe now to acquire binaries. This addresses an issue where a p4d binary staged for a future upgrade might be called before the actual upgrade is performed. upgrade.sh v4.0.0: * All preflight checks are now done first. Added '-p' to abort after preflight. * Added '-n' to show what would be done before anything is executed. * Minimalist logic to start/stop only servers that are upgrade, and apply upgrades only as needed. * Staging of exes for upgrade is now separate from /p4/common/bin * Improved in-code docs, added '-h' and '-man' options. * Retained pre/post P4D 2019.1 upgrade logic. |
||
#23 | 26810 | C. Thomas Tyler | Fixed typo in comment; non-user visible change that doesn't affect behavior. | ||
#22 | 26400 | C. Thomas Tyler |
Added refresh_P4ROOT_from_offline_db.sh. Updated backup_functions.sh to support functionality for db refresh. Upgrade start_p4d() and stop_p4d() to use systemd if available, else use the underlying SysV init scripts. Updated verify_sdp.sh to be called from other scripts (sans its own logging). Added many checks to verify_sdp.sh to support P4ROOT/offline_db swap. Logic in P4ROOT/offline_db swap is more careful about what gets swapped. Added start_p4broker() and stop_p4broker() that behave similarly. More shellcheck compliance. #review-26401 |
||
#21 | 25590 | Robert Cowham |
Avoid attempting to start p4broker if not configured. Tweak messaging |
||
#20 | 25575 | Robert Cowham |
Updates to SDP and tests for 19.1 upgrades #review @tom_tyler |
||
#19 | 25555 | Robert Cowham | Handle new 19.1 upgrade.sh requirements | ||
#18 | 24096 | C. Thomas Tyler |
Enhanced upgrade.sh to incorporate a call to: p4 protect --convert-p4admin-comments This upgrades the format of comments in the protections table to a version compatible with newer versions of P4Admin. |
||
#17 | 24092 | C. Thomas Tyler | Adjusted user message indicating how long the operation might take. | ||
#16 | 23297 | C. Thomas Tyler |
Added safety checks to avoid running commands that will certainly fail in upgrade.sh. Generally, /p4/common/bin will be the same on all hosts in a Helix topolgy. However, on any given machine, the /p4/<N>/bin/<EXE>_<N>_init scripts should exist only for executables that run on that machine. This change to upgrade.sh should work on machines even where only a proxy or broker runs. Also, it will not generate errors in cases where there is, say, a p4p_N_bin symlink in /p4/common/bin but no /p4/N/bin/p4p_N_init script, which will a common situation since /p4/common/bin will contain all executables used anywhere, while /p4/N/bin is host-specific. Also made cosmetic fixes and style convergence change. In dump_edge.sh and recover_edge_dump.sh, just fixed cosmetic typos. |
||
#15 | 23031 | C. Thomas Tyler |
Simplified stop_p4d() in backup functions to just call the init script. Previously stop_p4d() had 'wait' logic to wait for p4d to stop before trying to stop with a 'kill' signal, but this is no longer needed since the modern init script (with logic in p4d_base) now does a 'kill' anyway, and also has the 'wait' logic and will exit only when p4d is well and truly down. In upgrade.sh, fixed issue where start/stop of p4broker and p4p went directly to the screen instead of the log. Also changed to call start/stop init scripts for p4d directly, just as for other services. Also enhanced upgrade.sh logging: * Log file name to incorporate SDP instance (redundant but nice). * Remove pesky ':' characters from the datestamp in log file name, as ':' chars in file names wreak havoc with 'scp' commands and require escaping on the command line. * Added log comments indicating which databases are being upgraded ($P4ROOT and $OFFLINE_DB). Also added common explaining use of '-t' flag in 'p4d -xu' call for offline databases. |
||
#14 | 21433 | Russell C. Jackson (Rusty) | Fixed a bug in upgrade.sh introduced when truncate journal was changed to use p4 admin journal. | ||
#13 | 20749 | C. Thomas Tyler |
Approved and committed, but I believe that the shared data setting is always set to false on the master and we should look at fixing that in another change. Enhanced p4login again. Improvements: Default behavior with no arguments gives the desired results. For example, if run on a master, we login on the super user P4USER to P4PORT. If run on a replica/edge and auth.id is set, we login P4USER to the P4TARGET port of the replica. All other login functionality, such as logging in the replication service user on a replica, logging in supplemental automation users, is now accessed via new flags. A usage message is now available via '-h' and '-man' options. The new synopsys is: p4login [<instance>] [-p <port> | -service] [-automation] [-all] The <instance> parameter is the only non-flag positional parameter, and can be ommitted if SDP_INSTANCE is already defined (as is typical when called by scripts). With this change, several other scripts calling either the 'p4login' script or 'p4 login' commands were normalized to call p4login as appropriate given the new usage. Reviewer Note: Review p4login first, then other files. Most changes are in p4login. In other scripts callling p4login, calls similar to: $P4BIN -u $P4USER -p $P4PORT login < /path/to/pwd are replaced with: $P4CBIN/p4login In other scritps calling p4login, calls similar to: $P4BIN -p $P4MASTERPORT login < /path/to/pwd are replaced with: $P4CBIN/p4login -p $P4MASTERPORT Note that, if auth.id is set, calling 'p4login' actually has the same behavior as 'p4login -p $P4MASTERPORT', since p4login called on a replica with auth.id set will just login to the master port anyway. Depending on intent, sometimes $P4BIN/p4login -service is used. == Misc Cleanup == In doing the cleanup: * Fixed a hard-coding-to-instance-1 bug in broker_rotate.sh. * Fixed an inconsistency in recreate_db_sync_replica.sh, where it did just a regular login rather than a login -a as done in other places for (for compatibility with some multi-interface NIC card configs). == p4login Call Normalization == Code cleanup was done to normalize calls to p4login, such that: 1) the call starts with $P4CBIN/p4login (not the hard-coded path), and 2) logic to redirect sdtout/stderr to /dev/null was removed, since it's not necessary with p4login. (And if p4login ever does generate any unwanted output, we only fix it in one place). == Tweak to instance_vars.template == This change includes a tweak to set P4MASTERPORT dynamically on a replica to ensure the value precisely matches P4TARGET for the given replica. This will reduce a source of problems when SSL is used, as it is particularly sensitive to the precise P4PORT values used, and will also help for environments which have not yet set auth.id. If the port cannot be determined dynamically, we fall back to the old logic using the assigned value. == Tweak to SDP_ALWAYS_LOGIN behavior == This used to default to 1, now it defaults to 0. At this point we should no longer need to force logins, and in fact doing so can get into a 'p4 login' hang situation with auth.id set. Best to avoid unnecessary logins if we already have a valid ticket. (I think the need to force a login may have gone away with p4d patches). == Obsolete Script == With this change, svclogin.sh is now obsolete. All it was doing was a few redundant 'p4 login' commands followed by a call to p4login anyway. == Testing == Our test suite doesn't fully cover this change, so additional manual testing was done in the Battle School lab environment. |
||
#12 | 20460 | C. Thomas Tyler |
This files was supposed to go along for the ride when @20448 was submitted. This is part of that change, and also adds p4p support. |
||
#11 | 19406 | Russell C. Jackson (Rusty) | Add -t localhost:1666 to offline_db upgrade to avoid license check in 2016.1 | ||
#10 | 18587 | Russell C. Jackson (Rusty) |
Reworked the log rotation stuff in backup_functions.sh to make it cleaner and handle the new log from recreate_offline_db.sh. Modified recreate_offline_db.sh to add comments about a bad checkpoint. Also made it create its own log file since it isn't doing a checkpoint. Removed the log rotation for the same reason. Moved the LOGFILE setting out to all of scripts to make it more obvious for future scripts that you need to set that variable in your script so that it doesn't just default to checkpoint.log. Moved the functions in weekly_backup.sh and recreate_offline_db.sh into backup_functions.sh where they belong for consistency. Modified backup_functions.sh to use a consistent naming convention for all the rotated log files rather than checkpoint.log being unique. Replaced all back ticks with the newer bash $() method. Removed all of the line wrapping since I am pretty sure that none of us are working on an 80 character terminal these days and it is easier to read this way. |
||
#9 | 16563 | C. Thomas Tyler |
Routine Merge Down to dev from main using: p4 merge -b perforce_software-sdp-dev p4 resolve -as |
||
#8 | 16029 | C. Thomas Tyler |
Routine merge to dev from main using: p4 merge -b perforce_software-sdp-dev |
||
#7 | 15778 | C. Thomas Tyler | Routine Merge Down to dev from main. | ||
#6 | 15374 | adrian_waters |
- Ensure backup scripts are run as the OSUSER (to prevent accidental running as root); - in scripts where LOGFILE value is changed from the 'checkpoint.log' set by set_vars, ensure the new assignment is before check_dirs is called, otherwise errors could be written to the 'wrong' log - in 'die()' - detect if running from terminal & also send output to stderr |
||
#5 | 13906 | C. Thomas Tyler |
Normalized P4INSTANCE to SDP_INSTANCE to get Unix/Windows implementations in sync. Reasons: 1. Things that interact with SDP in both Unix and Windows environments shoudn't have to account for this obscure SDP difference between Unix and Windows. (I came across this doing CBD work). 2. The Windows and Unix scripts have different variable names for defining the same concept, the SDP instance. Unix uses P4INSTANCE, while Windows uses SDP_INSTANCE. 3. This instance tag, a data set identifier, is an SDP concept. I prefer the SDP_INSTANCE name over P4INSTANCE, so I prpose to normalize to SDP_INSTANCE. 4. The P4INSTANCE name makes it look like a setting that might be recognized by the p4d itself, which it is not. (There are other such things such as P4SERVER that could perhaps be renamed as a separate task; but I'm not sure we want to totally disallow the P4 prefix for variable names. It looks too right to be wrong in same cases, like P4BIN and P4DBIN. That's a discussion for another day, outside the scope of this task). Meanwhile: * Fixed a bug in the Windows 2013.3 upgrade script that was referencing undefined P4INSTANCE, as the Windows environment defined only SDP_INSTANCE. * Had P4INSTANCE been removed completely, this change would likely cause trouble for users doing updates for existing SDP installations. So, though it involves slight technical debt, I opted to keep a redundant definition of P4INSTANCE in p4_vars.template, with comments indicating SDP_INSTANCE should be used in favor of P4INSTANCE, with a warning that P4INSTANCE may go away in a future release. This should avoid unnecessary upgrade pain. * In mkdirs.sh, the varialbe name was INSTANCE rather than SDP_INSTANCE. I changed that as well. That required manual change rather than sub/replace to avoid corrupting other similar varialbe names (e.g. MASTERINSTANCE). This is a trivial change technically (a substitute/replace, plus tweaks in p4_vars.template), but impacts many files. |
||
#4 | 12169 | Russell C. Jackson (Rusty) |
Updated copyright date to 2015 Updated shell scripts to require an instance parameter to eliminate the need for calling p4master_run. Python and Perl still need it since you have to set the environment for them to run in. Incorporated comments from reviewers. Left the . instead of source as that seems more common in the field and has the same functionality. |
||
#3 | 11485 | Russell C. Jackson (Rusty) |
Brought over changes from RCJ sdp to properly handle Edge servers and to properly replicate shelves when replicating from Windows to Linux |
||
#2 | 11463 | Russell C. Jackson (Rusty) | Updated dev to prepare for Summit agreed changes. | ||
#1 | 10638 | C. Thomas Tyler | Populate perforce_software-sdp-dev. | ||
//guest/perforce_software/sdp/main/Server/Unix/p4/common/bin/upgrade.sh | |||||
#1 | 10148 | C. Thomas Tyler | Promoted the Perforce Server Deployment Package to The Workshop. |