Jump to content

Unable to merge from a branch - SQL exception


marioo

Recommended Posts

We updated PlasticSCM from version 4 to 5.0.44.509 on Friday. Today we were unable to merge changes from a sub-branch to the main branch in one of our repos. Plastic SCM client displayed a message telling about an SQL exception suggesting an attempt to insert a duplicate key to a table named 'revisionmerge'. Please see the details below. It is an excerpt from the plastic.server.log file (server-side).

 

We tried to merge changes from two independent sub-branches of that repo and we were unable to do that in both cases (the same kind of error).

Then we tried the same in another repo, and the issue did not take place there, so it must have been a repository-related problem not affecting other repositories.

 

Eventually we restarted PlasticSCM server and the next attempt to merge sub-branch changes in the repository of interest succeeded. However, we are quite anxious and wonder why the problem took place, and if we can be sure it will not happen again.

 

I have to mention that some time before PlasticSCM server was eventually restarted, I ran the builditemmergeinfo tool for several repositories, including the one of interest, as suggested in the release notes of PlasticSCM 5.0.44.505. The tool did not report any errors.

 

Do you think that running this tool could be the reason of the issue? Can we be sure that the repository databases are in a consistent state? Why was there no such issue on the second tested repository if the tool was run for it as well?

 

Thank you for your assistance in advance.

 

--

2013-12-02 15:37:35,427 012be65f-af40-4d3a-a994-89d77c230e5c NT AUTHORITY\SYSTEM at WINDOWS-7-GD ERROR CmCommand - Error ExecuteNonQuery. SQL [iNSERT INTO revisionmerge  (iobjid, fidsourcerevision, fiddestinationrevision,  itype, fiddestinationchangeset, fidlinkrealization)  VALUES (@objid, @srcRevId, @dstRevId, @stype, @dstCsetId, @linkIdId) ]
2013-12-02 15:37:35,427 012be65f-af40-4d3a-a994-89d77c230e5c NT AUTHORITY\SYSTEM at WINDOWS-7-GD ERROR CmCommand - @objid = [4972]
2013-12-02 15:37:35,427 012be65f-af40-4d3a-a994-89d77c230e5c NT AUTHORITY\SYSTEM at WINDOWS-7-GD ERROR CmCommand - @srcRevId = [4750]
2013-12-02 15:37:35,427 012be65f-af40-4d3a-a994-89d77c230e5c NT AUTHORITY\SYSTEM at WINDOWS-7-GD ERROR CmCommand - @dstRevId = [4750]
2013-12-02 15:37:35,427 012be65f-af40-4d3a-a994-89d77c230e5c NT AUTHORITY\SYSTEM at WINDOWS-7-GD ERROR CmCommand - @stype = [2]
2013-12-02 15:37:35,427 012be65f-af40-4d3a-a994-89d77c230e5c NT AUTHORITY\SYSTEM at WINDOWS-7-GD ERROR CmCommand - @dstCsetId = [176]
2013-12-02 15:37:35,442 012be65f-af40-4d3a-a994-89d77c230e5c NT AUTHORITY\SYSTEM at WINDOWS-7-GD ERROR CmCommand - @linkIdId = [4971]
2013-12-02 15:37:35,489 012be65f-af40-4d3a-a994-89d77c230e5c NT AUTHORITY\SYSTEM at WINDOWS-7-GD ERROR CmCommand - Exception: Violation of PRIMARY KEY constraint 'PK_revisionmerge'. Cannot insert duplicate key in object 'dbo.revisionmerge'. The duplicate key value is (4972).
The statement has been terminated.    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   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)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Codice.CM.Data.CmCommand.ExecuteNonQuery()
2013-12-02 15:37:35,489 012be65f-af40-4d3a-a994-89d77c230e5c NT AUTHORITY\SYSTEM at WINDOWS-7-GD ERROR Operations - Plastic server version: 5.0.44.509
 
2013-12-02 15:37:35,489 012be65f-af40-4d3a-a994-89d77c230e5c NT AUTHORITY\SYSTEM at WINDOWS-7-GD ERROR Operations - OnError catching exception Violation of PRIMARY KEY constraint 'PK_revisionmerge'. Cannot insert duplicate key in object 'dbo.revisionmerge'. The duplicate key value is (4972).
The statement has been terminated.
 
2013-12-02 15:37:35,520  NT AUTHORITY\SYSTEM at  ERROR Codice.CM.Server.ExceptionTracerSink - Dumping in-transit exception:There has been an unexpected error "Violation of PRIMARY KEY constraint 'PK_revisionmerge'. Cannot insert duplicate key in object 'dbo.revisionmerge'. The duplicate key value is (4972).
The statement has been terminated.". For more information check the server log.
Link to comment
Share on other sites

Hi,

 

After running the builditemmergeinfo tool on your repositories,  ( http://codicesoftware.blogspot.com/2013/11/plastic-scm-release-5044505-including.html )

 

Notes:

  • If you are using a SQLite backend (or other embedded backend like Firebird) you will need to stop the server.
  • If you are using a backend that requires direct access to the data file (like SQLite or SQL Server CE) you’ll need to run the builditemmergeinfo program with enough privileges to write on the directory where the data files are.

 

I think this is your case, and after restarting the server, the merge error will never happen again. We have performed a lot of tests, and we only only have found issues before restarting the server.

If the issue happens again, please let us know and we will review it.

 

Regards,

Carlos

Link to comment
Share on other sites

Hello,

 

Thanks for the quick response.

 

The thing is that I didn't stop the server before running the tool. I didn't know it was necessary, because I read how to run the tool in the release notes. It is not mentioned there that the server needs to be stopped first. Pity I forgot about your blog post you mentioned. I must have viewed it once, but I forgot about it.

 

But if you think that restarting the server after running the tool is enough and the repo's database remains consistent, that convinces me. Please correct me if I'm wrong.

 

Thank you for your help.

 

Best regards,

Mariusz.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...