This article discusses synchronization between any Fabric session and the external source from where the Reference table is populated. For information about the Cross-nodes Synchronization process within a Fabric Cluster, refer to this article.
Case 1 - Background Sync
In this scenario a Fabric Session requests to update a Reference table from an external source according to a predefined interval. The ref_sync and ref_sync_wait commands are triggered automatically in the background according to the method selected in Fabric Studio (Time Interval or Decision Function).
Case 2 - Pro-Active Sync
In this scenario, for example, a customer service operative needs to get the most updated list of new services subscribed by a customer in real-time. The Web Service or Job request triggers the ref_sync and ref_sync_wait commands.
Case 3 - Scheduled Sync
In this scenario a system needs to operate a synchronization process every day at 2 AM as a result of a maintenance task - i.e. get all new customers, or new transactions created over the last 24 hours. A recurring background sync can be scheduled for a specific day and time.
The following commands are available from the Fabric Command Line.
fabric>REF_STATUS TABLES='ALL' SCOPE='table';```
|table_name|status |backlog|node |current_session_transaction|sync_error|notes|
+----------+----------------+-------+------------------------------------+---------------------------+----------+-----+
|REF_USAGE |WAITING_FOR_SYNC|0 |b028b082-4ad3-477a-8188-c07bbeecc6e1| | | |
|REF_USAGE |WAITING_FOR_SYNC|0 |cde47595-5222-4642-8d37-1757d6719693| | | |
|REF_USAGE |WAITING_FOR_SYNC|0 |809f729c-9334-4565-825b-3daf026ba34d| | | |
|REF_USAGE |WAITING_FOR_SYNC|0 |13dfb26f-f6d7-42f7-96d6-6d45742964be| | | |
|REF_USAGE |WAITING_FOR_SYNC|0 |f550f905-777f-43e5-a96a-ea8a673a5a81| | | |
|REF_USAGE |WAITING_FOR_SYNC|0 |80ca785a-82c5-4cbf-9fce-b9d27b3c1f63| | | |
Note that, in this example six different nodes are waiting to sync the same REF_USAGE table
fabric>REF_STATUS TABLES=’ALL’ SCOPE=’population’
|table_name |population |verified_time |start_sync_time |end_sync_time |start_write_time |last_write_time |next_planned_sync |sync_error |node |notes|
+-----------+----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+------------+------------------------------------+-----+
|REFNUMBERS |refpop1 |2020-09-10 17:23:52.204|2020-09-10 17:23:52.204|2020-09-10 17:25:32.212|2020-09-10 17:25:32.275|2020-09-10 17:25:32.276|1970-01-01 02:00:00.000|null |bac20345-74b0-4d45-baea-746bef4af388| |
|REFSIMPLE |refpop2 |2020-09-10 17:23:52.199|2020-09-10 17:23:52.199|1970-01-01 02:00:00.000|2020-09-10 17:25:32.262|1970-01-01 02:00:00.000|1970-01-01 02:00:00.000|null |bac20345-74b0-4d45-baea-746bef4af388| |
fabric>REF_SYNC_WAIT TABLES='ALL';
|Table name|Required sync time|Current session transaction|
+----------+------------------+---------------------------+
|REF_USAGE |null | |
|T1 |null | |
|T2 |null | |
To select and modify data in Reference Tables set the common_local_trx
flag to TRUE, before running a commit.
fabric>set COMMON_LOCAL_TRX=true;
fabric>set COMMON_LOCAL_TRX=true;
select
command to view the row to be modified:fabric>select TAC, BRANDMODEL from DEVICESTABLE2017 where TAC=35156209;
|TAC |BRANDMODEL |
+--------+-----------------------+
|35156209|GALAXY J3 2016 SM-J320F|
fabric>begin;
update
command, operate a change in the table: fabric>update DEVICESTABLE2017 set BRANDMODEL='GALAXY J3--2016 SM-J320F' where TAC=35156209;
fabric>select TAC, BRANDMODEL from DEVICESTABLE2017 where TAC=35156209;
|TAC |BRANDMODEL |
+--------+------------------------+
|35156209|GALAXY J3--2016 SM-J320F|
fabric>end;
This article discusses synchronization between any Fabric session and the external source from where the Reference table is populated. For information about the Cross-nodes Synchronization process within a Fabric Cluster, refer to this article.
Case 1 - Background Sync
In this scenario a Fabric Session requests to update a Reference table from an external source according to a predefined interval. The ref_sync and ref_sync_wait commands are triggered automatically in the background according to the method selected in Fabric Studio (Time Interval or Decision Function).
Case 2 - Pro-Active Sync
In this scenario, for example, a customer service operative needs to get the most updated list of new services subscribed by a customer in real-time. The Web Service or Job request triggers the ref_sync and ref_sync_wait commands.
Case 3 - Scheduled Sync
In this scenario a system needs to operate a synchronization process every day at 2 AM as a result of a maintenance task - i.e. get all new customers, or new transactions created over the last 24 hours. A recurring background sync can be scheduled for a specific day and time.
The following commands are available from the Fabric Command Line.
fabric>REF_STATUS TABLES='ALL' SCOPE='table';```
|table_name|status |backlog|node |current_session_transaction|sync_error|notes|
+----------+----------------+-------+------------------------------------+---------------------------+----------+-----+
|REF_USAGE |WAITING_FOR_SYNC|0 |b028b082-4ad3-477a-8188-c07bbeecc6e1| | | |
|REF_USAGE |WAITING_FOR_SYNC|0 |cde47595-5222-4642-8d37-1757d6719693| | | |
|REF_USAGE |WAITING_FOR_SYNC|0 |809f729c-9334-4565-825b-3daf026ba34d| | | |
|REF_USAGE |WAITING_FOR_SYNC|0 |13dfb26f-f6d7-42f7-96d6-6d45742964be| | | |
|REF_USAGE |WAITING_FOR_SYNC|0 |f550f905-777f-43e5-a96a-ea8a673a5a81| | | |
|REF_USAGE |WAITING_FOR_SYNC|0 |80ca785a-82c5-4cbf-9fce-b9d27b3c1f63| | | |
Note that, in this example six different nodes are waiting to sync the same REF_USAGE table
fabric>REF_STATUS TABLES=’ALL’ SCOPE=’population’
|table_name |population |verified_time |start_sync_time |end_sync_time |start_write_time |last_write_time |next_planned_sync |sync_error |node |notes|
+-----------+----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+------------+------------------------------------+-----+
|REFNUMBERS |refpop1 |2020-09-10 17:23:52.204|2020-09-10 17:23:52.204|2020-09-10 17:25:32.212|2020-09-10 17:25:32.275|2020-09-10 17:25:32.276|1970-01-01 02:00:00.000|null |bac20345-74b0-4d45-baea-746bef4af388| |
|REFSIMPLE |refpop2 |2020-09-10 17:23:52.199|2020-09-10 17:23:52.199|1970-01-01 02:00:00.000|2020-09-10 17:25:32.262|1970-01-01 02:00:00.000|1970-01-01 02:00:00.000|null |bac20345-74b0-4d45-baea-746bef4af388| |
fabric>REF_SYNC_WAIT TABLES='ALL';
|Table name|Required sync time|Current session transaction|
+----------+------------------+---------------------------+
|REF_USAGE |null | |
|T1 |null | |
|T2 |null | |
To select and modify data in Reference Tables set the common_local_trx
flag to TRUE, before running a commit.
fabric>set COMMON_LOCAL_TRX=true;
fabric>set COMMON_LOCAL_TRX=true;
select
command to view the row to be modified:fabric>select TAC, BRANDMODEL from DEVICESTABLE2017 where TAC=35156209;
|TAC |BRANDMODEL |
+--------+-----------------------+
|35156209|GALAXY J3 2016 SM-J320F|
fabric>begin;
update
command, operate a change in the table: fabric>update DEVICESTABLE2017 set BRANDMODEL='GALAXY J3--2016 SM-J320F' where TAC=35156209;
fabric>select TAC, BRANDMODEL from DEVICESTABLE2017 where TAC=35156209;
|TAC |BRANDMODEL |
+--------+------------------------+
|35156209|GALAXY J3--2016 SM-J320F|
fabric>end;