KevinJump/uSync-Legacy

Content not importing when upgrading to the latest 4.0.10

Closed this issue · 15 comments

Hey Kevin,

I've just upgraded all my uSync V7 packages and content doesnt seem to import, but without error. Log files say that the content was imported (e.g. Handler Import Complete: 0 Items 0 changes 0 failures), however no content imports.

Somone else seems to have the same problem here - https://our.umbraco.com/forum/using-umbraco-and-getting-started/98953-does-usync-work-with-umbraco-version-7151

Versions Upgades:
Umbraco 7.15.3
uSync: 4.0.10 -> 4.0.14
uSync.ContentEdition: 4.1.5 -> 4.1.8
uSyncContentMappers: 4.1.4 -> 4.1.8
uSync.Core: 6.0.11 -> 6.0.14

I downgraded the packages and everything imported successfully, so all good, but probably tripping people up.

Let me know if you want any further info.

Hi,

certainly looks like there is a bug with the reporting line :(

at the moment trying to replicate, with the same versions I do get content imports, but I need to check the upgrade path too.

The Content Checker uses an 'IsNewer' check, so it only imports content when the date in the uSync file is newer than the date of the content item, this is configurable in the uSyncCore.Config but it can throw you off when debugging as you can change the file to see if the change happens and it won't because the updated value is older than the published content one.

<!-- content Match used by core: 
        Newer: we use the date, so only newer content is updated (this is the historical default)
        Mismatch : updates happen if the content is diffrent (so irespective of update dates)
  -->
  <ContentMatch>Newer</ContentMatch>

I am going to follow your upgrade path and check to see what that does,

and we will fix the logging too so it at least makes sense and actually shows you what it's updating if anything.

Hi,

yeah for me it still works after an upgrade (i mean it reports 0 changes, but i think this is because the report line is missing in the content handler and its actually the domains line that is reporting :( )

I suspect it's the updated date thing, but if you can still reproduce, it might be worth you adding debug logging to the log4net.config file

  <logger name="Jumoo.uSync">
    <level value="DEBUG" />
  </logger>

and we can get a lot more info, and maybe track it down for you.

Thanks Kevin,

I'm actually starting with a blank DB, so not sure if its related to Content Matching.

I'm using Chauffeur to create the database and then uSync on import on startup. Attached is a log file from a brand new DB with the uSync import on the first run.

Attached is a log file with debug turned on. Hope it helps!
UmbracoTraceLog.Yoga.txt

Hi,

That log does look like uSync is updating the content.?

you can see inside the bits where it is reading and updating the content
2019-09-20 19:03:28,245 [P17020/D4/T39] INFO Umbraco.Core.Publishing.PublishingStrategy

which means its firing the save/publish at the end of the processing, there is nothing in the log that looks like its erroring :( - do you have any changes you can point to not happening?

Kevin

Thanks Kevin, so I'm not going crazy then. Yes, everything seems to say all is good from what I can see in the logs.

The project that I'm testing on is a solution that is setup as a starting point for all my sites, so reasonably straight forward, but plenty of custom code. There have only been small changes recently that wouldn't think should affect content. The main changes were that I had upgraded to 7.15.0 but then saw that there was a breaking change with that version, so then upgraded further to 7.15.3 and then upgraded uSync.

So I've just now tried:

  1. Installing a brand new Umbraco 7.15.3 instance without a starter kit and boot up
  2. Install the latest Usync.contentEdition for Umbraco 7 without any config changes
  3. Copy my uSync directory and run a full import. Still no error and cant see the content.

When I get a chance this week, I'll try and debug further. I have attached my uSync folder in case it helps.
uSync.zip

My only thought is that the uSync files are probably from the older Content Edition V4.1.5, so there might be some incompatibility?

I'll let you know what I find once I get a chance to look into it further!

Hey @KevinJump ,

Sorry for the delay in getting back to you on this!

I've pulled down the v4_master branch (Is this the correct branch to be working on?) and run the Jumoo.uSync.Site with the default uSync/data/ folder thats part of the branch. The only changes that I made was to the connection string in the web.config. Its having the same results as my other project. No content showing up, but reporting in the logs that it is.

I've stepped through the code and its getting to ContentSerializer.PublishOrSave() and successfully calling _contentService.SaveAndPublishWithStatus(). As its calling SaveAndPublishWithStatus, I'm at a bit of a loss as to why its not showing up.

I've also checked the cmsContent and cmsDocument tables and they are empty too.

Seems to import everything except for Content and Media.

Any ideas, and are you able to reproduce on a blank DB?

Furthermore, I've tracked it down to commit 144e0a4 where it seems to be the earliest commit to show the same issue.

Previous commit 3be5ca9 does import the content / media correctly.

HI i am on holiday this week, so won't really get a chance to look properly till next week.
but the commit KevinJump/uSync@144e0a4 doesn't actually change any of the distributed uSync code (it updates the test site in the project but not any of the files in the projects that make up the distributed packages).

When i had a look at this last week on a new install the latest uSync and Umbraco (7.15.2 i think i did it on) imported content into a new site :(

but I will have another go next week.

All good @KevinJump , I'm in no rush... and you are probably well deserving of your holiday. Enjoy!

Hi, i am revisiting this, because well its still an issue, just an increadibly hard one to diagnose

related post on our.umbraco.com

Its really hard to identify the change, because even with a broken version it can just start working after a few restarts, so replacing DLL's on a broken site and trying again, then it works, doesn't actually mean the issue is fixed, it requires a new blank Umbraco install for each fix (which might be why we identified commit KevinJump/uSync@144e0a4 as fixing it when it changes nothing)

There are very few fixes between 4.1.5 and 4.1.9 most of the releases between were dealing with a breaking change that was introduced in Umbraco 7.15.0 (but then rolled back in 7.15.1)

Most of the changes between these versions were to combat the entity service lookups, and don't have a direct impact on how the content is stored - so it might be that something else (like a doctype) isn't quite going in right and having a knock-on effect (although they all look like they have gone in correctly every time)

Frustratingly (again) Umbraco reports the publish succeeded when it didn't so something is breaking but not being reported.

I think its a question of me reverting back to the working state - applying each change one at a time, installing a new umbraco and seeing if that one is the issue.

Strange things afoot at the circle k

I have tested this a few times because I can't see how this can be true, but it would appear it is how the macros are retrieved.

Specifically the call to macroService.GetAll(key); is somehow causing content imports to fail (even though content and especially media serializer never call this function).

this change was a made in commit KevinJump/uSync@3be5ca9#diff-68e428f43de3515e5f04d7180a8f3609 because the call to GetAll via the entity service doesn't work.

reverting this change and just calling get(key) - (which works on all versions of Umbraco except 7.15.0) works and content gets imported

var entity = _entityService.GetByKey(key);
if (entity != null) ...

so @dinc5150 this is incredibly close to what you were saying the first time, but It makes no sense as changing macros doesn't (read shouldn't) break a content import, in fact you can import content when the macros are missing, so it's much more likely that this is internal caching.

I am doing more testing because I still don't quite believe this can be the issue.

Thanks @KevinJump , I've moved onto different things, but will be back to that project in the next month, so I'll revisit as well.

Would it help you if I shared my code with you so that you can replicate the issue?

Hi @dinc5150,

yeah I have a 'release' ready which fixes this now (KevinJump/uSync@a9ddc5f), I just want to do way more testing, because in my brain I want to understand why it fixes it - although I have a little voice that says, " this is v7.x issue - ship the fix and move on..." We shall see which side wins.

release uSync 4.0.15 (content 4.1.9) which 'fixes' this issue .🤞

Thanks Kevin.

Just tested again with a new database with Content Edition 4.1.8 and as expected, no luck,
Then upgraded to 4.1.9 and worked like a charm!

I would not have found that myself. Thanks for all your help! #H5YR