How The Upload Stream Is Processed
Filtering download rows
- The most common technique for determining
rows to download is to download rows that have been modified since the
previous download. When synchronizing, the upload precedes the
download. Any rows inserted or updated during the upload will be rows
that have been modified since the previous download.
The SkyWire™ SkySync synchronization server automatically removes these
rows from the download stream. When a row is being added to the
download stream, the SkyWire™ SkySync synchronization server locates the
row in the upload stream and omits the row from the download stream
when it is found to be the same.
Processing deletes after inserts and updates
The upload stream is
applied to the consolidated database in an order that avoids
referential integrity violations. The upload stream is formatted so
all operations (inserts, updates, and deletes) for a single table are
grouped together. The tables in the upload stream are ordered based on
foreign key relationships. All tables in the remote database that are
referenced by another table in the remote database will be in the
upload stream before the referencing table.
For example, if table A and table C both have foreign
keys that reference a primary key column in B, then table B rows are
uploaded first.
When the upload stream is applied to the consolidated database, the
inserts and updates are applied in the order they appear in the upload
stream. When an inserted or updated row references a newly inserted
row, this ensures the referenced row will be inserted before the
referencing row. Deletes are applied in the opposite order after all
inserts and updates have been applied. When a row being deleted
references another row that is also being deleted, this order of
operations ensures the referencing row is deleted before the referenced
row is deleted.
|