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

Possible bug in the moment of synchronization #54

Closed
marjanoh2 opened this issue May 7, 2018 · 5 comments
Closed

Possible bug in the moment of synchronization #54

marjanoh2 opened this issue May 7, 2018 · 5 comments

Comments

@marjanoh2
Copy link

marjanoh2 commented May 7, 2018

I test database synchronization with 50 tables. Synchronization interval 30 seconds. I noticed that the changes that are made at the time of synchronization (1 -3 seconds) do not register as changes and then do not synchronize.
I made two videos to better understand the situation.

https://drive.google.com/open?id=1Gb4e9qjVwm5yzu_kv_n1oAFSv24QTN0m

https://drive.google.com/open?id=1yZ7dP10c968cXyucr5tCteRTB4ti0ksX

This is the code I use

private async Task DbSync()

{

        SqlSyncProvider serverProvider = new SqlSyncProvider(db1.ServerConnectionString);
        SqlSyncProvider clientProvider = new SqlSyncProvider(db1.ClientConnectionString);

        string[] tables = new DbAccess().GetTablesForSync(db1.ServerConnectionString);

        SyncAgent agent = new SyncAgent(clientProvider, serverProvider, tables);

        var s = await agent.SynchronizeAsync();


        GlobalVariables.syncLog += $"Total Changes DO : {s.TotalChangesDownloaded}, UP : {s.TotalChangesUploaded }, conflicts : {s.TotalSyncConflicts  }, errors : {s.TotalSyncErrors   }, Start: {s.StartTime  } Duration : {s.CompleteTime - s.StartTime  } \n";

    }
@Mimetis
Copy link
Owner

Mimetis commented May 9, 2018

Thanks for this feedback.
I can reproduce this behavior and the bug is identified.
When the sync is over, a timestamp is updated in the master database.
This Timestamp contains the end of the sync process, and the next rows will be selected based on this timestamp, so far.

To resolve it, I will introduce a breaking changes for the next version:
Instead of updating the master database with the end of sync timestamp, I will update the master database with the begin of sync timestamp and then I will add a new column showing the total duration for the sync.

Why I didn't use this technic before ?

Because I used this end of sync timestamp as a kind of checkpoint: If we have such timestamp, we are sure the sync was finished, with no errors.

In the next version, having two columns (begin / end of sync) will be a little be more tricky, but I think it will be enough to guarantee the sync involved is finished (or not) without (or with) errors.

I'm actually work on this new behavior, expect a new version, very soon. But since it's a breaking changes, you will need to re-implement your whole sync architecture.

Is it making sense ? Are you just testing (in this case, breaking changes are not an issue) ?

Sebastien

@marjanoh2
Copy link
Author

The most important thing is accurate synchronization. Anything to do in order to achieve this is accepted. At the moment, I'm just testing different situations to ensure it works smoothly before I use it in production.

@marjanoh2
Copy link
Author

Is there any progress?

@Mimetis
Copy link
Owner

Mimetis commented May 17, 2018

Yep, i'm actually working on it :)

@Mimetis
Copy link
Owner

Mimetis commented Jun 26, 2018

hey @marjanoh2
Can you make a test with the last version 0.2.1 ?
Be careful, I changed a lot of things in the architecture of the sync process. Even the sync_scope table has changed.
You will have to make a test on a new database (Unprovision everything to be sure)

@Mimetis Mimetis closed this as completed Jul 16, 2018
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