Database Change Management
Database Change Management
Home | Profile | Register | Active Topics | Active Polls | Members | Private Messages | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?




 All Forums
 Support
 DB Ghost Support Forum
 Source Database / Sync Log file names not unique
 New Topic  New Poll New Poll
 Reply to Topic
 Printer Friendly
Author  Topic Next Topic  

rpotter


5 Posts

Posted - 12/09/2014 :  18:51:24  Show Profile Send rpotter a Private Message  Reply with Quote
We're running into a concurrency issue trying to build/deploy multiple databases at the same time. The root of the problem is that source database names and the sync log files are based on the current time ticks. As a 'work-around' we've tried to offset our build script to invoke these with slight delays but we run into a number of random build failures because the files can still generate the same names. Here's a few snippets from the logs:

12/4/2014 7:59:46 PM...Error: The process cannot access the file 'E:\work\f65d839da7428230\Artifacts\DB\SyncReport635533199851669628.txt' because it is being used by another process.



[PARALLEL DeployDb1] **   12/8/2014 4:25:57 PM...Building Source Database from Build Script
[PARALLEL DeployDb1] **   12/8/2014 4:26:04 PM...Error: User does not have permission to alter database 'SourceDB_635536527570028799', the database does not exist, or the database is not in a state that allows access checks.
[PARALLEL DeployDb1] **   ALTER DATABASE statement failed.
[PARALLEL DeployDb1] **   User does not have permission to alter database 'SourceDB_635536527570028799', the database does not exist, or the database is not in a state that allows access checks.
[PARALLEL DeployDb1] **   ALTER DATABASE statement failed.
[PARALLEL DeployDb2] **   12/8/2014 4:26:04 PM...Error: Transaction (Process ID 298) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
[PARALLEL DeployDb1] **   User does not have permission to alter database 'SourceDB_635536527570028799', the database does not exist, or the database is not in a state that allows access checks.
[PARALLEL DeployDb1] **   ALTER DATABASE statement failed.
[PARALLEL DeployDb1] **   User does not have permission to alter database 'SourceDB_635536527570028799', the database does not exist, or the database is not in a state that allows access checks.
[PARALLEL DeployDb1] **   ALTER DATABASE statement failed.
[PARALLEL DeployDb1] **   Changed database context to 'master'.
[PARALLEL DeployDb2] **   ALTER DATABASE statement failed.
[PARALLEL DeployDb2] **   Transaction (Process ID 298) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
[PARALLEL DeployDb2] **   ALTER DATABASE statement failed.
[PARALLEL DeployDb2] **   Changed database context to 'master'.


Is it possible to use another RNG rather than ticks to make the names 100% unique (such a ticks + processId, or a GUID)?

Google AdSense

USA
Mountain View


dbghost



66 Posts

Posted - 12/10/2014 :  06:13:42  Show Profile  Visit dbghost's Homepage Send dbghost a Private Message  Reply with Quote
Those ticks are very small. But I experimented and found that the actual value of ticks is only updated in the order of every 10 milliseconds or so even for consecutive calls in the same process. But that is still quite a small interval... So interestingly if those issues really are caused by two processes getting the same result from DateTime.Now.Ticks.ToString even though they were started at different times (presumably several seconds apart)... then events have managed to synchronise the processes and bring them to within a few milliseconds of each other. Perhaps process A is held up by waiting for something long enough for B to catch up reach the same point and join the same queue waiting for the same resource then both are quickly served by similar interrupt request such as the OS or disk being ready to make a file.

In short yes we should change ticks to GUIDs to eliminate this possibility, it will need to be documented as I know customers have code that reads log files that could be sensitive to a change in the name format. Thanks for the evidence, we will get it done soon.
Go to Top of Page

rpotter



5 Posts

Posted - 09/08/2016 :  10:50:34  Show Profile Send rpotter a Private Message  Reply with Quote
Been a while since I checked in on this - just curious if this is going to make it into a release at some point? Thanks!
Go to Top of Page

dbghost



66 Posts

Posted - 09/09/2016 :  06:06:38  Show Profile  Visit dbghost's Homepage Send dbghost a Private Message  Reply with Quote
Yes I believe this was addressed in December that year, version 5.1.90

The latest version is now 5.2.15 which is a free upgrade if you have current maintenance.
Go to Top of Page
   Topic Next Topic  
 New Topic  New Poll New Poll
 Reply to Topic
 Printer Friendly
Jump To:
Database Change Management © Copyright 2005 Innovartis Ltd. Go To Top Of Page
Snitz Forums 2000
RSS Feed 1 RSS Feed 2
Powered by ForumCo 2000-2008
TOS - AUP - URA - Privacy Policy
ForumCo Free Blogs and Galleries
Signup for a free forum or Go Banner Free