I have a script to synchronize files in a server folder with documents in a ProjectWise folder. I have several thousands of documents to sync so I have 'powershelled' the task.
One of my commands is to create a new document version:
Get-PWDocumentsBySearch -FolderPath $pwfolder -FileName $theFile | New-PWDocumentVersion -VersionString $verString | Out-Null
This will happily run for long periods of time, and then fall over for no apparent reason:
New-PWDocumentVersion : Error changing document 'FILENAME' to new version. Error creating new version of document.At SCRIPTNAME1:548 char:97+ ... e $theFile | New-PWDocumentVersion -VersionString $verString | Out-N ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (Version:String) [New-PWDocumentVersion], Exception + FullyQualifiedErrorId : ErrorID: Database transaction deadlock error.,PWPS_DAB.NewPWDocumentVersion
What is a database transaction deadlock error and how to prevent it? For the record, the $verString is set to "P02" and the previous version is "P01".
Thanks for any help.
No - it's at revised status and not checked out. See the audit trail:
I like this - thank you - seems the best way forward.
Since we have blocking issues (very similar) with a quite performant VM hosting MSSQL and the Integration server, I would love to know if you chased this one down for support from the Bentley database side. Sure they can say they don't support PWPS_DAB but they should be able to answer what the DB is doing. Since ours is hosted by us for now, it's on us to find the issue which we suspect is our Isilon disk array system yet cannot prove thus far.
An alternate to Kevin's solution is to build constant "kindness" AKA delays into your code in case the code is overtaxing the design/servers. Kevin's just retries once. PW also has Jobs (or similar - not scheduled tasks) that you could explore to enqueue failed files which are reprocessed until done. That concept/object suite is on my to-do list to learn.