Thursday, April 24, 2014

NAV 2013 R2 Synchronization Paradigm.

Dear All,

Below are some extracts of the article published in Microsoft Team Blog about

"The New Table Synchronization Paradigm in Microsoft Dynamics NAV 2013 R2".

It start's explaining the History, how it used to happen in NAV 2009 /  NAV 2013-

Microsoft Dynamics NAV 2009 / Microsoft Dynamics NAV 2013 


When we import/compile an object in C/SIDE, system checks the object Metadata Version and Compare with Current Version. If the Current Version is New it updates the Object Metadata in Navision and Schema changes are directly applied to SQL Server.

So before NAV 2013 R2, everything used to get updated directly from Classic Client and at the time when we used to process.

At most the only issue we used to have was “The Object Metadata does not exist. Identification and values … “ when running the Microsoft Dynamics NAV Windows client.

Which used to be resolved just by recompiling the Objects specified in error or all the objects or deleting the metadata of that object and re-creating it.



With NAV 2013 R2 a new concept have been coined by Microsoft (i.e Multitenancy) which change the above approach of synchronize changes to SQL.

From a development perspective, this means that any modification that are made to a table object in C/SIDE are NOT DIRECTLY applied to the SQL Server structure but there is a need of performing a secondary action to apply and made persistent these modification at SQL Server side: this process is called Synchronization.

Microsoft Dynamics NAV 2013 R2

SCENARIO 1: 
Single-tenancy / Legacy mode 
“Prevent data loss from table changes” = Yes (default):

1. At object import/compile, C/SIDE checks the Object Metadata version in working memory and compares it to the version in Object Metadata table to decide if and what kind of change is made. 
(Same as in Microsoft Dynamics NAV 2009 and Microsoft Dynamics NAV 2013)

2. C/SIDE then CALLS THE Microsoft Dynamics NAV Server to check for breaking schema changes in SQL Server structure.
If C/SIDE is unable to call the Microsoft Dynamics NAV Server or if a breaking schema change is attempted (action that cannot performed due to the current SQL Server structure such as deleting a field containing data): a C/SIDE error is reported accordingly and changes to Object Metadata table will not be committed.

If it is evaluated as not attempting a breaking schema change in SQL Server then metadata from C/SIDE working memory is saved and committed to Object Metadata table.

PLEASE NOTE: At this stage NO CHANGES ARE MADE TO THE SQL SERVER DATA STRUCTURE.

3. When prompting for SYNCHRONIZATION, Microsoft Dynamics NAV Server then compares Object Metadata table with Object Metadata Snapshot table content. Any difference in the value for the “Hash” field is a flag to Microsoft Dynamics NAV Server that a change exists and should be subsequently applied physically SQL Server side as structural changes.

So with NAV 2013 R2, when we import objects or compile objects the changes are still in temporary database, no changes are done on SQL Server Till now. For having those changes we require Synchronization.

Prompting for Synchronization happens when

1. Performing ANY Microsoft Dynamics NAV client action.

OR

2. Running the Sync-NAVTenant Windows PowerShell cmdlet.

In Next Post we will see what other scenarios are there with NAV 2013 R2 and discuss how to run Sync Tenant.

Regards,
Saurav Dhyani