JeffDarchuk / SitecoreSidekick

Framework for angularjs based microservice architecture operations.
MIT License
48 stars 33 forks source link

Trouble with the Item Blaster in Content Migrator #42

Closed JosRaedts closed 4 years ago

JosRaedts commented 4 years ago

Hi,

I started using Sitecore Sidekick for a project that uses Sitecore 8.2 update 4. I successfully implemented Sidekick, but I'm having difficulty using the Item Blaster as no items are actually created when pulling content.

Weird thing about this is, that pulling content from the production environment works locally, but it doesn't work on our Test or Acceptance (UAT) environment. The pull completes, according to Sidekick and the logging is accurate, but when I look back at the content editor, I can't find the desired item that was "created" according to Sidekick.

If I disable the Item Blaster by unchecking the checkbox, it works fine on all environments, but ofcourse it's slower than it should be.

Is there anyone who can help me? Is it related to resource allocation, or is my configuration setup wrong?

Alternatively we could uncheck the checkbox for the usage of the Item Blaster by default, but then I would like to ask how to do just that in the configuration?

Thanks in advance.

tomunderhill commented 4 years ago

I am also facing the issue where Sidekick reports all the items as migrated successfully, but the vast majority have not actually been created/updated (or none have). It seems to be a bit random, sometimes creating/updating some items but not the whole, and sometimes disabling the bulk update context checkbox seems to help.

My hunch is that Sidekick is migrating some items then hits one it has a problem with, and the rest fail.

Is there any way to turn on detailed logging for the Migration actions?

JeffDarchuk commented 4 years ago

The way Item Blaster works is that it aggregates up all the new items into a temp table, then merges them all together once everything is gathered. This results in one large SQL operation instead of thousands of little ones. Generally it's going to be significantly faster however i have noticed that after Sitecore reports that the migration is complete it can take up to five minutes for the items to properly appear in Sitecore. I've received reports similar to this before, where the content simply doesn't show up ever, but i haven't been able to reproduce them myself. Is there anything about your setup that's unique or unusual? Vast quantities of items? Large media? There currently isn't a way to default the checkbox to unselected so as a work-around it would need to be unselected manually. By default it should log any errors that it comes across. If there is a problem and no data shows up, i'd suspect some issue with Item Blaster. I can review where the logging is lacking within item blaster and in the future attempt to make things more clear.

JosRaedts commented 4 years ago

I've been trying to pull 'dummy items' which have a file size of a few kb's, there are a lot of items in the CMS and that could be a blocker, but then it wouldn't happen on our Test environment, as this is almost a copy of my local environment.

I also checked the Sitecore logs if something went horribly wrong and if anything interesting was logged, but unfortunately there isn't a single line of log that caught my eye between all the other log lines.

JeffDarchuk commented 4 years ago

I'm going to try to reproduce this as well as i can, if anything jumps out that might be a clue, let me know please. It would be awesome to get this bug resolved once and for all.

tomunderhill commented 4 years ago

I'm working with a lot of media items, so it's hard to tell if it's just a (long) delay before things show up. I've tried multiple IIS resets though and that doesn't get them to show up either - but some stuff has appeared the next day!

JosRaedts commented 4 years ago

The most worrying thing about this is, that it doesn't really matter how many items I pull on develop, it always seems to work.

As an architecture we use VM's by the way, maybe this is another reason why it doesn't work. A colleague of mine uses Sidekick in combination with Azure Web Apps and I haven't heard any complaints from him that it doesn't work with the Item Blaster.

JeffDarchuk commented 4 years ago

Thanks for sharing this information, i'm going to keep trying to reproduce this locally. Once i do that should be fixed fairly quickly at which point i can push out a new version.

manishramanan15 commented 4 years ago

We are facing a similar issue, our sitecore version is 8.2 Updated 7. We have scheduled a Nightly Job which pulls the media item and content items. The job succeeds but there are no items updated.

When we manually pull after checking the option "ignore revision ids", it pulls all the content correctly. Is there a way to pass the same flag in Scheduled Jobs.

Thanks!

JeffDarchuk commented 4 years ago

Thanks for bringing this to my attention. Unfortunately as it stands the agent can't add that parameter as it's something i overlooked. You do have a couple options however, the powershell integration can handle it if you follow the instructions here. Additionally i updated the agent code to allow use of these newer parameters and cut a new minor release 1.5.4 if you upgrade your nuget package you can use it like this.

manishramanan15 commented 4 years ago

Thanks for bringing this to my attention. Unfortunately as it stands the agent can't add that parameter as it's something i overlooked. You do have a couple options however, the powershell integration can handle it if you follow the instructions here. Additionally i updated the agent code to allow use of these newer parameters and cut a new minor release 1.5.4 if you upgrade your nuget package you can use it like this.

Thanks! you are a champ. Will run some test and let you know how it looks.

JosRaedts commented 4 years ago

@JeffDarchuk Do you have a status update on this issue? Is it fixed by using a newer version of the Nuget package or is it something that's still being worked on?

Thanks in advance. The tool is great!

JeffDarchuk commented 4 years ago

It depends on what you're referring to. The agent lacking the item blaster functionality has been fixed in the latest. However i lack the ability to reproduce the main issue here as it seems transient. If someone can reliably reproduce this issue, please let me know. I'd love to get it fixed up.

markgibbons25 commented 4 years ago

I can reproduce the issue in 2 scenarios.

1. You are pulling items to a path that is controlled by unicorn

I think that in this case there is definitely a conflict - perhaps the items are getting lost down a pipeline somewhere. It will probably take some debugging to figure out if this is a sidekick issue or a unicorn issue or a rainbow issue.

2. No unicorn involved - workaround available

After the sync is finished, I can pretty reliably get the items to appear by going to /sitecore/admin/cache.aspx and clear all caches.

JeffDarchuk commented 4 years ago

Thanks for this, i'll work on testing these cases

vtml commented 4 years ago

In Publishing Service, there is a block of code to clear all sorts of caches, which should mimick exactly the same as cache.aspx Looks something like this.

    private void ClearCaches(Database database)
    {
      database.Caches.DataCache.Clear();
      database.Caches.ItemCache.Clear();
      database.Caches.ItemPathsCache.Clear();
      database.Caches.IsFallbackValidCache.Clear();
      if (database.Caches.FallbackFieldValuesCache is CustomCache<LanguageFallbackFieldValuesCacheKey> fieldValuesCache)
        fieldValuesCache.Clear();
      database.Caches.PathCache.Clear();
      database.Caches.StandardValuesCache.Clear();
      if (this._prefetchCacheInfo != (PropertyInfo) null)
      {
        foreach (ICacheInfo cacheInfo in ((IEnumerable<DataProvider>) database.GetDataProviders()).Where<DataProvider>((Func<DataProvider, bool>) (p => p is SqlDataProvider)).Select<DataProvider, object>((Func<DataProvider, object>) (p => this._prefetchCacheInfo.GetValue((object) p))).Where<object>((Func<object, bool>) (c => c is ICacheInfo)))
          cacheInfo.Clear();
      }
      BaseCacheManager requiredService = ServiceLocator.ServiceProvider.GetRequiredService<BaseCacheManager>();
      requiredService.ClearAccessResultCache();
      requiredService.GetDeviceItemsCache().Clear();
      ServiceLocator.ServiceProvider.GetRequiredService<BasePlaceholderCacheManager>().GetPlaceholderCache(database.Name).Reload();
      ServiceLocator.ServiceProvider.GetRequiredService<BaseRuleFactory>().InvalidateCache();
      if (this._languageCacheInfo != (FieldInfo) null)
        ((ICacheInfo) this._languageCacheInfo.GetValue((object) this.GetLanguageProvider())).Clear();
      database.Engines.TemplateEngine.Reset();
      this._translate.ResetCache();
    }
fluxdigital commented 4 years ago

Hi @JeffDarchuk , I've been experiencing this same issue with not all content coming down. We are using Unicorn too, mostly to sync the parent folders above the content which we want to pull down. I've also noticed if I don't use the item blaster then it seems to pull the content down more successfully in most cases too. Was any progress made on replicating and resolving this?

JeffDarchuk commented 4 years ago

not currently, I've still been unable to reliably reproduce this issue locally.

fluxdigital commented 4 years ago

Ok Thanks @JeffDarchuk. I'll keep an eye on this issue and provide some further information if I can.

coreyasmith commented 4 years ago

I've been able to reproduce this reliably on Sitecore 8.2 Update-7 (haven't tried on newer versions). A user reported this issue with buckets, so I created a content tree that resembles buckets, but does not use them. These test instances only have Sitecore 8.2 Update-7 and Sidekick installed--no other modules. This content was created using the default Sample Item.

image

Add missing parents

In the following GIF, I select a nested item expecting the Add missing parent items if an item's parent(s) do not exist locally option to handle creating its parent items with the Use Item Blaster option selected. Notice that after the first run the log shows that all items were created, but only the 2020 item was actually created. Then after the second run, again the log shows that all items were created, but only the 07 item was created; however, it can't show up in the content tree because its parent 09 wasn't created.

I tried clearing the cache between each run as @markgibbons25 suggested but it didn't seem to make a difference.

I have observed similar behavior with Use Item Blaster unchecked, too, so I'm not sure that this is purely an Item Blaster issue. With Use Item Blaster unchecked, I've occasionally seen all parents migrated whereas I've never seen all parents migrated with it checked.

parents

Include subitems

In the following GIF, I select an item expecting the Include subitems of selected item option to handle migrating all subitems with the Use Item Blaster option selected. Notice how I try to pull the 2020 item 3 times with Use Item Blaster checked and none of them are migrated. They only import when I uncheck Use Item Blaster.

Again I tried clearing the cache between each run to no avail.

This function seems to work reliably when Use Item Blaster is unchecked. I haven't reproduced any strange behavior with it unchecked.

children

JeffDarchuk commented 4 years ago

hey Corey, thanks for doing a bit of debugging. Your tests look very similar to tests i did a few months back, i'm going to try to repro this.

coreyasmith commented 4 years ago

I tested with Rainbow 2.1.2 this morning and I'm still seeing all the same behavior above.

JeffDarchuk commented 4 years ago

Tracked this down to be a threading issue. The thread executing the item blaster merge ran into a race condition that would result in an unpredictable amount of items missing, some cases no items were missing, some cases they were all missing. By correctly handling the threading the issue appears to be resolved and has been released in 1.5.8

markgibbons25 commented 4 years ago

I'm still having the same issue on 1.5.9

  1. Many fields not getting values copied across - both versioned and shared fields have this issue
  2. If there is any missing template or missing field on the template then the whole thing fails silently. No errors anywhere and content does not show up in the tree.
  3. Could be a separate issue but 1.5.9 does not detect missing items after about 5 (?) or more levels deep of children, 1.5.7 does. I dont have time to do exact steps to repro yet

Actually, I am using PackageReference and I just saw that it's pulling in Rainbow 2.0.0 instead of Rainbow 2.1.2 so that could be it, retesting now...

Update

  1. I've opened a PR #57 to force Rainbow 2.1.2 as it has helped with field values not coming across.
  2. I havent had time to check if this was a result of 1. or not
  3. I've opened an issue #58
JeffDarchuk commented 4 years ago

I don't want Sidekick to be dependent on a specific version of Rainbow. It should work with whatever version you have, assuming you use Unicorn.
Are these problems in reference to using Item Blaster? You don't directly mention it and I want to be sure I can't think of why checksum would not work after a certain depth. The compare process starts at the leaf nodes and works it's way back to the root. Is this problem consistent?

I've had some further reports that using Item Blaster gives odd results until caches are reset, have you tried that?

markgibbons25 commented 4 years ago

Yes, this is using Item Blaster. This install doesn't use Unicorn. I'm not trying to lock into a specific version of Rainbow but rather that we need at least 2.1 for Sitecore 9.2+ https://github.com/SitecoreUnicorn/Rainbow/releases and it's backwards compatible of course. I've tried clearing caches, no improvement. I'll put this one down for now as a Rainbow 2.0 issue but will comment if it happens again, cheers.