::----------------------------------------------------------------------------- :: 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 | |
---|---|---|---|---|---|
#5 | 20767 | C. Thomas Tyler |
Released SDP 2016.2.20755 (2016/09/29). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#4 | 15856 | C. Thomas Tyler |
Replaced the big license comment block with a shortened form referencing the LICENSE file included with the SDP package, and also by the URL for the license file in The Workshop. |
||
#3 | 15692 | Robert Cowham | Fix issues with upgrades scripts. | ||
#2 | 13908 | C. Thomas Tyler | Pushing SDP 2015.1.13906. | ||
#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. |