::----------------------------------------------------------------------------- :: Copyright (c) Perforce Software, Inc., 2007-2014. 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. ::----------------------------------------------------------------------------- :: Place the new p4.exe and p4d.exe binaries into the <depotdata>:\p4\common\bin :: folder prior to running this script. :: :: Run <depotdata>:\p4\common\bin\p4env.bat <instance> before running this script. :: :: Then, just run this script. @echo off setlocal enableextensions if "%DEPOTDATA%x" == "x" goto P4ENVERR set LOG=%LOGDATA%\p4\%P4INSTANCE%\logs\upgrade.log p4 login < %DEPOTDATA%\p4\common\bin\adminpass.txt >> %LOG% 2>&1 if NOT ERRORLEVEL 0 goto ERROR echo Get the journal counter >> %LOG% 2>&1 for /f "tokens=*" %%a in ( 'p4 counter journal' ) do ( set jnlnum=%%a ) echo Remove the trailing space from the journal counter >> %LOG% 2>&1 set /a jnlnum=%jnlnum% echo Set ckpnum to the journal counter value + 1 >> %LOG% 2>&1 set /a ckpnum=%jnlnum% + 1 echo Recover current checkpoint using new p4d >> %LOG% del %METADATA%\p4\%P4INSTANCE%\offline_db\db.* %DEPOTDATA%\p4\common\bin\p4d.exe -r %METADATA%\p4\%P4INSTANCE%\offline_db -jr -z %DEPOTDATA%\p4\%P4INSTANCE%\checkpoints\p4_%P4INSTANCE%.ckp.%jnlnum%.gz >> %LOG% 2>&1 if NOT ERRORLEVEL 0 goto ERROR echo Upgrade the offline database >> %LOG% %DEPOTDATA%\p4\common\bin\p4d.exe -r %METADATA%\p4\%P4INSTANCE%\offline_db -J off -xu >> %LOG% 2>&1 if NOT ERRORLEVEL 0 goto ERROR echo Stop the server >> %LOG% 2>&1 sc stop %P4SERVICE% >> %LOG% 2>&1 REM Wait for service to stop. :RETRY delay 30 sc query %P4SERVICE% | find /I "stopped" if not %ERRORLEVEL% == 0 goto RETRY echo Rotate the journal >> %LOG% 2>&1 %DEPOTDATA%\p4\%P4INSTANCE%\bin\p4d -r %METADATA%\p4\%P4INSTANCE%\root -J %LOGDATA%\p4\%P4INSTANCE%\logs\journal -jj %DEPOTDATA%\p4\%P4INSTANCE%\checkpoints\p4_%P4INSTANCE% >> %LOG% 2>&1 if NOT ERRORLEVEL 0 goto ERROR echo Replay the journal to the offline_db directory >> %LOG% 2>&1 %DEPOTDATA%\p4\common\bin\p4d -r %METADATA%\p4\%P4INSTANCE%\offline_db -jr %DEPOTDATA%\p4\%P4INSTANCE%\checkpoints\p4_%P4INSTANCE%.jnl.%jnlnum% >> %LOG% 2>&1 if NOT ERRORLEVEL 0 goto ERROR echo Copy in the new binaries >> %LOG% 2>&1 copy %DEPOTDATA%\p4\common\bin\p4.exe %DEPOTDATA%\p4\%P4INSTANCE%\bin >> %LOG% 2>&1 if NOT ERRORLEVEL 0 goto ERROR copy %DEPOTDATA%\p4\common\bin\p4d.exe %DEPOTDATA%\p4\%P4INSTANCE%\bin >> %LOG% 2>&1 if NOT ERRORLEVEL 0 goto ERROR copy %DEPOTDATA%\p4\common\bin\p4d.exe %DEPOTDATA%\p4\%P4INSTANCE%\bin\p4s.exe >> %LOG% 2>&1 if NOT ERRORLEVEL 0 goto ERROR echo Move recovered db files from offline_db to root >> %LOG% del %METADATA%\p4\%P4INSTANCE%\root\save move %METADATA%\p4\%P4INSTANCE%\root\db.* %METADATA%\p4\%P4INSTANCE%\root\save move %METADATA%\p4\%P4INSTANCE%\offline_db\db.* %METADATA%\p4\%P4INSTANCE%\root echo Restart the server >> %LOG% net start p4_%P4INSTANCE% if NOT ERRORLEVEL 0 goto ERROR echo Remove old db files from save directory >> %LOG% del %METADATA%\p4\%P4INSTANCE%\root\save\db.* echo Recover current checkpoint using new p4d >> %LOG% del %METADATA%\p4\%P4INSTANCE%\offline_db\db.* %DEPOTDATA%\p4\common\bin\p4d.exe -r %METADATA%\p4\%P4INSTANCE%\offline_db -jr -z %DEPOTDATA%\p4\%P4INSTANCE%\checkpoints\p4_%P4INSTANCE%.ckp.%jnlnum%.gz >> %LOG% 2>&1 if NOT ERRORLEVEL 0 goto ERROR echo Upgrade the offline database >> %LOG% %DEPOTDATA%\p4\common\bin\p4d.exe -r %METADATA%\p4\%P4INSTANCE%\offline_db -J off -xu >> %LOG% 2>&1 if NOT ERRORLEVEL 0 goto ERROR echo Replay the journal to the offline_db directory >> %LOG% 2>&1 %DEPOTDATA%\p4\common\bin\p4d -r %METADATA%\p4\%P4INSTANCE%\offline_db -jr %DEPOTDATA%\p4\%P4INSTANCE%\checkpoints\p4_%P4INSTANCE%.jnl.%jnlnum% >> %LOG% 2>&1 if NOT ERRORLEVEL 0 goto ERROR echo Dump out a new checkpoint >> %LOG% %DEPOTDATA%\p4\%P4INSTANCE%\bin\p4d -r %METADATA%\p4\%P4INSTANCE%\offline_db -jd -z %DEPOTDATA%\p4\%P4INSTANCE%\checkpoints\p4_%P4INSTANCE%.ckp.%ckpnum%.gz >> %LOG% 2>&1 if NOT ERRORLEVEL 0 goto ERROR goto END :ERROR echo An ERROR occured in the upgrade process, please check %LOG% for the errors. goto END :P4ENVERR echo "You must run \p4\common\bin\p4env.bat <instance> before running this script." :END endlocal
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#7 | 20536 | Robert Cowham | Remove .bat files now replaced by .ps1 equivalents | ||
#6 | 16029 | C. Thomas Tyler |
Routine merge to dev from main using: p4 merge -b perforce_software-sdp-dev |
||
#5 | 15701 | C. Thomas Tyler | Routine merge down using 'p4 merge -b perforce_software-sdp-dev'. | ||
#4 | 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. |
||
#3 | 11463 | Russell C. Jackson (Rusty) | Updated dev to prepare for Summit agreed changes. | ||
#2 | 11010 | Robert Cowham | Bring this into line with new upgrade.bat | ||
#1 | 10961 | C. Thomas Tyler | Merge down from main. | ||
//guest/perforce_software/sdp/main/Server/Windows/p4/common/bin/2013.3_upgrade.bat | |||||
#1 | 10872 | C. Thomas Tyler |
Added Windows SDP into The Workshop: * Combined (back) into Unix SDP structure. * Avoided adding duplicate files p4verify.pl, p4review.(py,cfg). * Upgraded 'dist.sh' utility to produce both Unix and Windows packages (*.tgz and *.zip), adjusting line endings on text files to be appropriate for Windows prior to packaging. To Do: * Resolve duplication of [template_]configure_new_server.bat. * Merge test suites for Windows and Unix into a cohesive set. |