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

Performing a sync on a configuration with Transparant Sync breaks stuff?? #426

Open
Luuk1983 opened this issue Mar 14, 2022 · 3 comments
Open

Comments

@Luuk1983
Copy link

Do you want to request a feature or report a bug?
Is a question OK too? ;)

I'm in the process of tracking down an issue we're having with transparent sync. For that, I need to understand what happends under the hood a little bit better. I hope you can provide me with some information :)

Ok I have a Unicorn configuration on some templates (Unicorn 4.0.4), nothing too fancy. This configuration has Transparant Sync enabled. Now someone has performed a sync on that configuration and after that we've los some content. From the sync logs I can see that:
Some template fields were deleted and added at another place. Because it deleted the fields first before adding them again, this caused all underlying data on all items that use that template to be deleted. Why it didn't do a 'move' operation is beyond me (because the id's are exactly the same), but that's not my question.

My question is: if the configuration has transparent sync enabled, a sync operation shouldn't do anything right? Sure it would update the data in database, but because transparent sync is enabled, it wouldn't do anything with that data in the database, right? Or am I missing some logic here?

Thanks in advance for any insight you might have :)

@cassidydotdk
Copy link
Member

Sync will peform what a sync always does, when triggered. It is possible to trigger a sync that skips transparent syncs, but I cannot determine from your post if this has been used or not. Likely not.

var skipTransparent = HttpContext.Current.Request.QueryString["skipTransparentConfigs"] ?? "0";

So to answer your question; without being told otherwise, running "sync" will do what one would always expect - puts the current database in the same state as found in the source of truth (files on disk).

As for the other problem you are referring to; you should really try and avoid having Unicorn configs so granular, so as to templates and fields being split across too many configurations. Especially so if you have a mix of regular and transparent sync configurations in place.

@Luuk1983
Copy link
Author

Thanks for the reply!

The changes were all part of the same configuration, I fortunately don't have that many configurations :)

But to come back to my original question:
when running a sync on a configuration with transparant sync, it will obviously update the database. But in the end it shoudn't do anything, right? Yes, I have an updated database, but because the configuration is transparent sync, the database is not used and bypassed. So in the end, what's in the database isn't important. I'm still puzzled how a sync on a configuration with transparent sync would make any difference, because as far as I know it shouldn't...

@cassidydotdk
Copy link
Member

cassidydotdk commented Mar 14, 2022

It will. You are making the assumption that because the configuration is transparent sync, a sync operation will not do anything. It absolutely will - it will do everything that a sync operation normally does. Which is why there is an option to skip transparent sync configurations - in case you do not want these configurations to influence your database.

The flipside of this is; you do not need to sync these transparent sync configurations. The key word here is need. You absolutely can and, if you do, it will be like performing a sync on any other configuration.

Transparent sync relies on the DataProvider being active. This would generally only be the case on your local environment, not upstream CI and QA environments. You can and must sync in your content upstream even with no DataProvider.

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

No branches or pull requests

2 participants