U4-8497 - NuCache - prepare Core

Created by Stephan 23 May 2016, 12:11:20 Updated by Stephan 05 Dec 2016, 10:19:24

Relates to: U4-8523

Relates to: U4-8524

Import all work done in ContentCache branch in order to isolate the content cache (currently, XML) so that it is possible to plug another cache (NuCache).

Comments

Shannon Deminick 23 May 2016, 12:56:31

NOTE: Chat on Thursday with Shan about progress - then split tasks accordingly.


Stephan 27 May 2016, 11:05:51

Bam! PR: https://github.com/umbraco/Umbraco-CMS/pull/1288

Pretty massive I guess. Code review is advised. Then, the best way to test is to run Umbraco "as normal"... and it should just all work, everything.


Shannon Deminick 02 Jun 2016, 13:11:11

Test pass - Great!

But, upgrade instantly fails. I have a current v8 solution that doesn't have the migrations run yet, so I've changed my version to 7.4.3 in web.config to force the upgrade but on startup i get a YSOD because during startup and before the installer can run it tries to query the db.

Full stack trace/error:

Server Error in '/' Application.

Invalid column name 'rv'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'rv'.

Source Error: 


Line 191:        protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
Line 192:        {
Line 193:            return Execute(() => _inner.ExecuteReader(behavior));
Line 194:        }
Line 195:

Source File: X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Core\Persistence\FaultHandling\RetryDbConnection.cs    Line: 193 

Stack Trace: 


[SqlException (0x80131904): Invalid column name 'rv'.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +3278564
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +791
   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4927
   System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +92
   System.Data.SqlClient.SqlDataReader.get_MetaData() +102
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +552
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest) +3114
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +554
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +98
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +307
   Umbraco.Core.Persistence.FaultHandling.<>c__DisplayClass28_0.<ExecuteDbDataReader>b__0() in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Core\Persistence\FaultHandling\RetryDbConnection.cs:193
   Umbraco.Core.Persistence.FaultHandling.<>c__DisplayClass31_0`1.<Execute>b__0() in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Core\Persistence\FaultHandling\RetryDbConnection.cs:211
   Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction(Func`1 func) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Core\Persistence\FaultHandling\RetryPolicy.cs:174
   Umbraco.Core.Persistence.FaultHandling.FaultHandlingDbCommand.Execute(Func`1 f) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Core\Persistence\FaultHandling\RetryDbConnection.cs:208
   Umbraco.Core.Persistence.FaultHandling.FaultHandlingDbCommand.ExecuteDbDataReader(CommandBehavior behavior) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Core\Persistence\FaultHandling\RetryDbConnection.cs:193
   NPoco.Database.ExecuteReaderHelper(DbCommand cmd) +34
   NPoco.Database.ExecuteDataReader(DbCommand cmd) +67
   NPoco.<QueryImp>d__155`1.MoveNext() +319
   System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +118
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +153
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +106
   Umbraco.Web.PublishedCache.XmlPublishedCache.XmlStore.LoadXmlTreeDtoFromDatabaseLocked(XmlDocument xmlDoc) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Web\PublishedCache\XmlPublishedCache\XmlStore.cs:1029
   Umbraco.Web.PublishedCache.XmlPublishedCache.XmlStore.LoadXmlTreeFromDatabaseLocked(SafeXmlReaderWriter safeXml) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Web\PublishedCache\XmlPublishedCache\XmlStore.cs:992
   Umbraco.Web.PublishedCache.XmlPublishedCache.XmlStore.LoadXmlLocked(SafeXmlReaderWriter safeXml, Boolean& registerXmlChange) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Web\PublishedCache\XmlPublishedCache\XmlStore.cs:447
   Umbraco.Web.PublishedCache.XmlPublishedCache.XmlStore.InitializeContent() in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Web\PublishedCache\XmlPublishedCache\XmlStore.cs:240
   Umbraco.Web.PublishedCache.XmlPublishedCache.XmlStore.OnResolutionFrozen(Boolean testing, Boolean enableRepositoryEvents) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Web\PublishedCache\XmlPublishedCache\XmlStore.cs:178
   Umbraco.Web.PublishedCache.XmlPublishedCache.XmlStore..ctor(ServiceContext serviceContext, IDatabaseUnitOfWorkProvider uowProvider, RoutesCache routesCache, PublishedContentTypeCache contentTypeCache, IEnumerable`1 segmentProviders, Boolean testing, Boolean enableRepositoryEvents) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Web\PublishedCache\XmlPublishedCache\XmlStore.cs:96
   Umbraco.Web.PublishedCache.XmlPublishedCache.FacadeService..ctor(ServiceContext serviceContext, IDatabaseUnitOfWorkProvider uowProvider, ICacheProvider requestCache, IEnumerable`1 segmentProviders, PublishedContentTypeCache contentTypeCache, Boolean testing, Boolean enableRepositoryEvents) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Web\PublishedCache\XmlPublishedCache\FacadeService.cs:58
   Umbraco.Web.PublishedCache.XmlPublishedCache.FacadeService..ctor(ServiceContext serviceContext, IDatabaseUnitOfWorkProvider uowProvider, ICacheProvider requestCache, IEnumerable`1 segmentProviders, Boolean testing, Boolean enableRepositoryEvents) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Web\PublishedCache\XmlPublishedCache\FacadeService.cs:35
   Umbraco.Web.<>c.<ConfigureCoreServices>b__13_1(IServiceFactory factory) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Web\WebBootManager.cs:337
   LightInject.PerContainerLifetime.GetInstance(Func`1 createInstance, Scope scope) in C:\projects\lightinject\build\tmp\Net46\Binary\LightInject\LightInject.cs:5532
   LightInject.ServiceContainer.EmitLifetime(ServiceRegistration serviceRegistration, Action`1 emitMethod, IEmitter emitter) in C:\projects\lightinject\build\tmp\Net46\Binary\LightInject\LightInject.cs:3683
   LightInject.<>c__DisplayClass152_0.<CreateEmitMethodWrapper>b__0(IEmitter ms) in C:\projects\lightinject\build\tmp\Net46\Binary\LightInject\LightInject.cs:2973
   LightInject.ServiceContainer.CreateDynamicMethodDelegate(Action`1 serviceEmitter) in C:\projects\lightinject\build\tmp\Net46\Binary\LightInject\LightInject.cs:2895
   LightInject.ServiceContainer.CreateDelegate(Type serviceType, String serviceName, Boolean throwError) in C:\projects\lightinject\build\tmp\Net46\Binary\LightInject\LightInject.cs:3760
   LightInject.ServiceContainer.CreateDefaultDelegate(Type serviceType, Boolean throwError) in C:\projects\lightinject\build\tmp\Net46\Binary\LightInject\LightInject.cs:3723
   LightInject.ServiceContainer.GetInstance(Type serviceType) in C:\projects\lightinject\build\tmp\Net46\Binary\LightInject\LightInject.cs:2396
   LightInject.ServiceContainer.GetInstance() in C:\projects\lightinject\build\tmp\Net46\Binary\LightInject\LightInject.cs:2446
   Umbraco.Core.ObjectResolution.ContainerSingleObjectResolver`2.get_Value() in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Core\ObjectResolution\ContainerSingleObjectResolver.cs:92
   Umbraco.Web.PublishedCache.FacadeServiceResolver.get_Service() in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Web\PublishedCache\FacadeServiceResolver.cs:15
   Umbraco.Web.WebBootManager.FreezeResolution() in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Web\WebBootManager.cs:138
   Umbraco.Core.CoreBootManager.Complete(Action`1 afterComplete) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Core\CoreBootManager.cs:304
   Umbraco.Web.WebBootManager.Complete(Action`1 afterComplete) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Web\WebBootManager.cs:171
   Umbraco.Core.UmbracoApplicationBase.StartApplication(Object sender, EventArgs e) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Core\UmbracoApplicationBase.cs:76
   Umbraco.Core.UmbracoApplicationBase.Application_Start(Object sender, EventArgs e) in X:\Projects\Umbraco\Umbraco_8.0\src\Umbraco.Core\UmbracoApplicationBase.cs:90

[HttpException (0x80004005): Invalid column name 'rv'.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +544
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +186
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343

[HttpException (0x80004005): Invalid column name 'rv'.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +716


Stephan 06 Jun 2016, 15:40:29

Bah - will review


Jeroen Breuer 07 Jun 2016, 08:50:00

I've also had this error when doing an upgrade to NuCache. We've already discussed this on Skype. Maybe it's the same problem.

[3/18/2016 4:17:31 PM] Jeroen Breuer: Didn't get this error before [3/18/2016 4:18:19 PM] Stéphane Gay: dammit that's one of those migration errors where a row in some table has not been proprely created - we discussed me rebasing some migrations but I could not find the time [3/18/2016 4:18:57 PM] Jeroen Breuer: The migrations didn't run yet [3/18/2016 4:19:16 PM] Jeroen Breuer: Last migration is Umbraco 7.3.8 [3/18/2016 4:19:18 PM] Stéphane Gay: mmm so that would be before migrations run? [3/18/2016 4:19:20 PM] Jeroen Breuer: Yes [3/18/2016 4:19:35 PM] Jeroen Breuer: Doesn't go to the installer [3/18/2016 4:20:22 PM] Stéphane Gay: ah f*ck I can see it - when starting the application, the Xml cache (you're still using the Xml cache?) tries to boot - but it cannot boot because the migration has not run [3/18/2016 4:20:22 PM | Edited 4:20:36 PM] Jeroen Breuer: Maybe it's related to the bootmanager [3/18/2016 4:20:28 PM] Stéphane Gay: interesting situation [3/18/2016 4:20:52 PM] Stéphane Gay: guess if you create the column by hand it will work but it's a pity - I have created some sort of catch 22, it seems [3/18/2016 4:21:08 PM] Jeroen Breuer: I only upgraded my local install with the nuget packages and made some small changes to the code so it builds [3/18/2016 4:21:41 PM] Jeroen Breuer: But this didn't happen the previous time [3/18/2016 4:21:50 PM] Stéphane Gay: I think that the NuGet package does not activate the NuCache, still runs the XmlCache - oh my... could it be I've done a mistake? Then i'd need to ship you a new DLL asap [3/18/2016 4:22:13 PM] Jeroen Breuer: Previous time from 7.3.4 to 7.4.0-zb28 Now from 7.3.8 to 7.4.1-zb29 [3/18/2016 4:22:32 PM] Stéphane Gay: 'cos clearly the version you have wants Xml cache... yep, I've shipped the version with everything, only not enabled. STUPID! [3/18/2016 4:22:49 PM] Jeroen Breuer: Whoops ;) [3/18/2016 4:24:10 PM] Stéphane Gay: rebuilding now


Stephan 07 Jun 2016, 15:09:07

Have pushed a new commit to the PR that delays the loading of the Xml content cache until we really need it, and tested that I could upgrade from a 7.4 database to an 8.


Stephan 05 Dec 2016, 08:12:05

That branch has long been merged into dev-v8 and then then more things have been fixed, so I am not sure it makes any sense to keep the task open. We'll create new tasks when resuming team work on v8. Will kill the PR and the task.


Priority: Normal

Type: Task

State: Closed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: False

Fix Submitted:

Affected versions:

Due in version: 8.0.0

Sprint:

Story Points:

Cycle: