Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Veronica Burd 76 posts 201 karma points
    Mar 02, 2016 @ 07:34
    Veronica Burd
    0

    Violation of PRIMARY KEY constraint 'PK_umbracoLog'

    Hi,

    I'm currently testing an import process that inserts/updates a lot of data via the ContentService. Currently running on Umbraco 7.4.1 though I had the same problem with 7.4.0.

    Occasionally I get the following error:

     2016-03-01 18:18:32,199 [P9468/D18/T116] ERROR Umbraco.Core.Persistence.UmbracoDatabase - Database exception occurred
    System.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_umbracoLog'. Cannot insert duplicate key in object 'dbo.umbracoLog'. The duplicate key value is (15542).
    The statement has been terminated.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
       at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteScalar()
       at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteScalar() in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\Data\ProfiledDbCommand.cs:line 311
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClassa.<ExecuteScalarWithRetry>b__9()
       at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command, RetryPolicy cmdRetryPolicy, RetryPolicy conRetryPolicy)
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command, RetryPolicy retryPolicy)
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command)
       at Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco)
    ClientConnectionId:2bbddb74-c56a-4b1a-9438-5948f5251575
    Error Number:2627,State:1,Class:14
    

    In this case the last entry in the umbracoLog file is:

    id         15542
    userId     0
    NodeId     0 
    Datestamp  2016-03-01 18:18:26.830
    logHeader  New      
    logComment Content 'PS 086 - 07.07.1997 06:00 PM' was created
    

    I have also encountered this when emptying large amounts of rows from the Recycle bin. Unfortunately I don't have a log record for that.

    Problem is, I haven't been able to determine a pattern as to when\why this will happen, apart from the fact that it has always occurred when I've had lots of data to save/delete.

    Anyone have any ideas?

    Thanks

    Ver

  • Kasper Holm 47 posts 180 karma points
    Mar 02, 2016 @ 07:48
    Kasper Holm
    0

    Hello Veronica

    Have you looked in the umbracoLog table in your database ?

    I believe this tabel still runs on a integer as an id and maybe you have hit int max ?

  • Veronica Burd 76 posts 201 karma points
    Mar 02, 2016 @ 07:56
    Veronica Burd
    0

    Hi Kasper,

    Thanks for the reply. I'm nowhere near the max. as I regularly truncate the table while I'm testing the import process. Currently, the last id is the one as per my original post, i.e. 15542.

    Regards

    Ver

Please Sign in or register to post replies

Write your reply to:

Draft