Label error: A database error has occured (FailDBInsert)

This forum is now locked, since Gold Support is no longer offered.

Moderator: SourceGear

Locked
Addie Gisser
Posts: 5
Joined: Wed Aug 11, 2004 8:57 am
Location: Austin

Label error: A database error has occured (FailDBInsert)

Post by Addie Gisser » Tue Sep 06, 2005 4:51 pm

We are currently using Version 3.1.1 (3506) but we had the same problem with version 3.0.7.

Whenever any of us using vault client attempt to label a folder in Vault we get the above error. This happens only on a folder within vault that has files shared with other another folder. Subfolders between the two folders are named identically. However the top level folders containing the folders containing the shared files are uniquely named. We shared the files between the folders indivicually, we did not share the folders.

Note that even after we setup up this structure we were able to label, it is only recently that we are not able to label. Also, other folders which do not have shared files we are able to label.

Please let me know what we need to do to fix this problem. It is very important that we be able to label are internal, alpha, beta, and actual releases.

The sgvault.log file had the following information on a failed label attempt:

----9/6/2005 5:17:32 PM Agisser--EESH(192.168.1.179)--SSL Disabled System.Data.SqlClient.SqlException: Violation of UNIQUE KEY constraint 'unique_tblfsobjectlabelviews_names'. Cannot insert duplicate key in object 'tblfsobjectlabelviews'.
The statement has been terminated.
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at VaultServiceSQL.VaultSqlSCC.AddLabel(VaultSqlConn conn, Int32 nRepID, Int32 nUserID, VaultLabelItem vLabel, Int64& nLabelID, Int64& nObjID, String& strExistingRootPath) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at VaultServiceSQL.VaultSqlSCC.AddLabel(VaultSqlConn conn, Int32 nRepID, Int32 nUserID, VaultLabelItem vLabel, Int64& nLabelID, Int64& nObjID, String& strExistingRootPath)
----9/6/2005 5:17:32 PM Agisser--EESH(192.168.1.179)--SSL Disabled AddLabel returned: FailDBInsert

Tri
Posts: 288
Joined: Wed Dec 22, 2004 11:10 am

Post by Tri » Wed Sep 07, 2005 8:58 am

On the Vault Server, issue an IISReset. Then redo the operation again on Vault Client. Hope that will work.

Addie Gisser
Posts: 5
Joined: Wed Aug 11, 2004 8:57 am
Location: Austin

Post by Addie Gisser » Wed Sep 07, 2005 11:33 am

That didn't work. I am still unable to label the folder. I have narrowed down the problem to a single folder that has one label that is inherited from a higher level folder. The higher level folder and other subfolders do not exhibit this problem. Files within the folder that has the labeling problem do not exhibit the problem.

Furthermore, I cannot delete the higher level label as it is needed by another engineer. However we absolutely need to be able to label this folder. Please respond soon and tell me how to resolve this.

I have been looking at the SQLtables and used profiling to isolate the label that had the unique key violation (i.e. what label it thinks it has the same unique id as the one I am trying to create ).

jclausius
Posts: 3706
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Post by jclausius » Wed Sep 07, 2005 12:41 pm

Can you gather some information about your repository in a Query Tool, save the results in Tab Delimited format, and send the results in for inspection? (Click the email button below to contact me directly).

1) We'll need to determine the repository causing the issue. From a Query Tool, run

Code: Select all

SELECT repid, name FROM sgvault.dbo.tblrepositories
. Make note of the repid for the repository where you are applying the label.

2) Next using the repid from above, run t7he following query:

Code: Select all

DECLARE @repid [int];
SELECT @repid = <INT_FROM_STEP_1>

DECLARE @@t TABLE
( treelevel int not null,
pph int not null,
objverid bigint not null,
objid bigint not null,
objversion bigint not null,
name nvarchar(256) not null,
objprops smallint not null,
pinnedfromobjverid bigint not null,
fph int not null,
fullpath nvarchar(1024) null,
primary key (treelevel, pph, fph, objverid)
)

INSERT INTO @@t (treelevel, pph, objverid, objid, objversion, name,
objprops, pinnedfromobjverid, fph) SELECT treelevel, parentpathhash,
objverid, objid, objversion, LOWER(name), objprops, pinnedfromobjverid,
fullpathhash FROM sgvault.dbo.ufngettreestructure(@repid, -1, default)

DECLARE @@treelevel int, @@rowsaffected int

SET @@treelevel = 0
UPDATE @@t SET fullpath = name WHERE treelevel = @@treelevel SET
@@rowsaffected = @@ROWCOUNT WHILE ( @@rowsaffected > 0 ) BEGIN
UPDATE t SET t.fullpath = prev.fullpath + N'/' + t.name
FROM @@t t INNER JOIN
@@t prev ON (prev.treelevel = @@treelevel) AND
(prev.fph = t.pph)
WHERE (t.treelevel = (@@treelevel + 1))

SELECT @@rowsaffected = @@ROWCOUNT, @@treelevel = @@treelevel +
1 END -- WHILE

SELECT * FROM @@t ORDER BY treelevel, pph, name;
Jeff Clausius
SourceGear

jclausius
Posts: 3706
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Post by jclausius » Wed Sep 07, 2005 7:36 pm

UPDATE - Addie Gisser solved the problem by moving the files to a new folder, deleting the folder, and then renaming the new folder.
Jeff Clausius
SourceGear

Locked