This discussion is archived
4 Replies Latest reply: Nov 2, 2012 2:14 AM by DKAP RSS

Synchronization in Switching DataSources

DKAP Newbie
Currently Being Moderated
Hi All,

Please some one explain on the below scenario using switching data sources.

Step 1: For example, My current Production website is using Catalog A+ and I have done some modifications on Catalog B.+
Step 2: Now I am deploying with Catalog B+ on the Production.So, my Production website is using Catalog B.
Step: 3: If again I want to switch back to Catalog A+, Will my Catalog A+ has the latest changes of Catalog B+ also?
Step 4: If yes, then please let me know how that Synchronization is happening between these Catalogs and Is there any Service/Component in ATG that takes of this and how this will happen.

Thanks in Advance!!!!

Dinesh
  • 1. Re: Synchronization in Switching DataSources
    Gurvinder Pro
    Currently Being Moderated
    So here is how ATG deployment will work.
    if you are using switching datasource, then the deployment will deploy the content on your passive schema first, and if the deployment is successful then it will switch the passive to active and active to passive and deploy on the second schema.

    So if you are having catalogA and catalogB, and catalogA is active and B is passive, so deployement will first happen on B and then after switching B will become active and A will become passive and then content will be deployed on A.

    ATG switching datasource will take care of deploying and synchronizing each datasource.
    So after deployment is successful each datasource will have the updated content.

    But if you are using any custom code to deploy some changes manually then you might need to use switching datasource in your code and deploy and switch datasources.

    ~Gurvinder
  • 2. Re: Synchronization in Switching DataSources
    Nitin Khare Expert
    Currently Being Moderated
    Yes, both datasources will be in synch. A switch deployment setup has two databases - one is active (or online) whose data is being used by the target site (i.e. production site) e.g. CatalogA* and another that is inactive (offline) with respect to a deployment target e.g. CatalogB*.

    During the CA deployment for Repository assets, they are first updated on the site's inactive database (*CatalogB*) while the site's live database (*CatalogA*) continues to run undisturbed. When updates to the inactive database CatalogB* are completed, the site's SwitchingDataSource component switches its underlying data source to the updated database CatalogB* and the newly inactive database CatalogA* is updated to reflect the same deployment. This way both remain in synch.

    Similarly for file assets, they are first updated on the target site's inactive directory while the site's live directory is being used. When updates to the inactive directory are complete, then the site switches to it and the inactive directory becomes the live directory and vice-versa. The newly inactive directory is then updated to reflect the same deployment.

    Your ProductCatalog repository would be configured to use the SwitchingDataSource via some config layer overriding its default datasource:
    #/atg/commerce/catalog/ProductCatalog.properties
    dataSource=/atg/commerce/jdbc/SwitchingDataSource
    Now the SwitchingDataSource component has following typical configuration:
    $class=atg.service.jdbc.SwitchingDataSource
    
    # Map of switching data source names to data sources components
    dataSources=\
         DataSourceA=/atg/commerce/jdbc/ProductCatalogDataSourceA,\
         DataSourceB=/atg/commerce/jdbc/ProductCatalogDataSourceB
    
    # Name of the data source that should be used on startup
    initialDataSourceName=DataSourceA
    
    # Repository used by the switching data source to store current datasource. 
    # SDSRepository is Switch Data Source repository having just a single item with properties like currentDataSourceName, server and lastModified timestamp.
    repository=/atg/dynamo/service/jdbc/SDSRepository
    Then within each of the datasources component ProductCatalogDataSourceA and ProductCatalogDataSourceB you actually specify to what database each datasource points:
    #/atg/commerce/jdbc/ProductCatalogDataSourceA
    $class=atg.nucleus.JNDIReference
    JNDIName=java:/ATGSwitchingDS_A
    #/atg/commerce/jdbc/ProductCatalogDataSourceB
    $class=atg.nucleus.JNDIReference
    JNDIName=java:/ATGSwitchingDS_B
    SwitchingDataSource is configured on both CA and target server instances but the initialDataSourceName is not same on both the configurations. It ensures that first deployment is made to the inactive database on the target server. For every subsequent deployments, the currentDataSource is obtained from the state recorded in the SDSRepository.
  • 3. Re: Synchronization in Switching DataSources
    DKAP Newbie
    Currently Being Moderated
    Thanks Gurvinder and Nitin for your Explanation!!!!!
  • 4. Re: Synchronization in Switching DataSources
    DKAP Newbie
    Currently Being Moderated
    Thanks Gurvinder and Nitin for your Explanation!!!!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points