Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Include Pageshared:WSO2 Patch Application Processshared:WSO2 Patch Application ProcessAccording to the WSO2 patch application process, once the patches are created, you can apply them either as individual patches or through a service pack. However, when the number of patches increase, it is more convenient to apply patches through service packs.

What is a service pack?

Carbon 4.2.0 kernel supports service packs. A service pack is a collection of patches in a single pack. It contains two elements: the lib directory and the servicepack_patches.txt text file. The lib directory contains all the patching JARs relevant to the service pack, and the metadata file contains the list of patches applied by the service pack. 

The following sections explains the patch application procedure:

Table of Contents
maxLevel3
minLevel3

Applying patches to the Kernel

  1. Copy the required patches and service packs to the relevant locations in your product directory as explained below.
    • To apply patches individually, copy the patches to <PRODUCT_HOME>/repository/components/patches.
    • To apply a service pack, copy the service pack file to <PRODUCT_HOME>/repository/components/servicepacks. For example, the image below shows how a new service pack, named "servicepack001", is added to this directory. 
      The servicepacks directory with the new servicepack001 subdirectory, which contains servicepack_patches.txt and the lib subdirectory with the patch JAR files.Image Added

  2. Start the Carbon server. If any patch changes exist, the following steps will be executed:

    1. Before applying any patches, the process first creates a backup folder named patch0000 inside the <PRODUCT_HOME>/repository/components/patches directory, which will contain the original content of the plugins folder that is in the <PRODUCT_HOME>/repository/components directory. This step enables you to revert back to the previous state if something goes wrong during operations.
    2. If any service packs are copied to the servicepacks directory, the latest service pack will be applied. That is, the patches in the service pack will be applied to the <PRODUCT_HOME>/repository/components/plugins directory.

    3. After the service pack is applied, any other patches that were not included in the service pack will be incrementally applied to the plugins directory. The metadata file available in the service pack will maintain a list of the applied patches by service pack. Therefore, the metadata file information will be compared against the <PRODUCT_HOME>/repository/components/patches directory, and only the patches that were not applied by the service pack will be incrementally applied to the plugins directory. The diagram below shows how the patch application is implemented when you start the server.
      Flow chart of patch application process. After server startup, if there are service packs or patch changes, they are applied. Next, MD5 verification is performed on the latest patched JARs against the JARs in plugin. Any warnings during this process are logged.  Image Added
    Info

    Prior to the Carbon 4.2.0 release, to apply patches in the Carbon server, the users were expected to start the server as follows:  wso2server.sh -DapplyPatches. Now, you do not have to issue a special command to trigger the patch process. It starts automatically if there are changes in either the  <PRODUCT_HOME>/repository/components/servicepacks directory or the <PRODUCT_HOME>/repository/components/patches directory. It verifies all the latest JARs in the servicepacks and patches directories against JARs in the plugins directory by comparing MD5s of JARs.

Verifying the patch application

After the patch application process is completed, the patch verification process ensures that the latest service pack and other existing patches are correctly applied to the <PRODUCT_HOME>/repository/components/plugins folder.

  • All patch related logs are recorded in the <PRODUCT_HOME>repository/logs/patches.log file.
  • The <PRODUCT_HOME>/repository/components/patches/.metadata/prePatchedJARs.txt meta file contains the list of patched JARs and their md5 values.
  • A list of all the applied service packs and patches are in the <PRODUCT_HOME>/repository/components/default/configuration/prePatched.txt file.
Warning

Do not change the data in the <PRODUCT_HOME>/repository/components/default/configuration/prePatched.txt file. The patch application process gets the pre-patched list from this file and compares the list with the patches available in the servicepack and patches directories. If you change the data in this file, you will get a startup error when applying patches.