Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Sync receipt #48

Closed
gentledepp opened this issue Mar 19, 2018 · 2 comments
Closed

[Enhancement] Sync receipt #48

gentledepp opened this issue Mar 19, 2018 · 2 comments

Comments

@gentledepp
Copy link
Contributor

We have the following scenario in our application:

  1. an administrator creates tasks for several users
  2. those tasks are to be synchronized to the users devices
  3. the administrator wants to know, if the tasks have already been transmitted.

Would it be possible to add a "Transmitted" bit column onto the tracking tables?
This would need to be updated in the same transaction that selects the changes to transmit to the client during a sync session.
It seems to me that this would already do the trick on the server side.

As far as I understand, for each user/device dotmim.sync creates a new scopeid.
That scopeid then can be correlated (by application logic outside of the sync framework) to correlate a user and his/her device(s)

What do you think?

@Mimetis
Copy link
Owner

Mimetis commented May 4, 2018

I don't think we can add a bit on the tracking tables.
A row in the tracking table is not related to one client.

You can have this information, at least, an approximation.
If you take the [scope_infog].[scope_timestamp] related to your client, you can compare with the table_tracking.[timestamp] value and determine if the row has been sent to the client.

Actually, this is how the selectchanges stored procedure is working.
Here is an extract:

([side] represents the tracking table)

WHERE (
	-- Update made by the local instance
	[side].[update_scope_id] IS NULL
	-- Or Update different from remote
	OR [side].[update_scope_id] <> @sync_scope_id
	-- Or we are in reinit mode so we take rows even thoses updated by the scope
	OR @sync_scope_is_reinit = 1
    )
AND (
	-- And Timestamp is > from remote timestamp
	[side].[timestamp] > @sync_min_timestamp
	OR
	-- remote instance is new, so we don't take the last timestamp
	@sync_scope_is_new = 1
	)
AND (
	[side].[sync_row_is_tombstone] = 1 
	OR
	([side].[sync_row_is_tombstone] = 0 AND [base].[CustomerID] is not null	)
)

Is that make senses ?

@gentledepp
Copy link
Contributor Author

Yeah that perfectly makes sense. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants