dbo.QBM_PDBQCS_SlotRunner
Stored ProcedureSQL_STORED_PROCEDURESandbox DB
Interpretation
- Database routine. Review parameters, called procedures, DBQueue inserts, and QBM_PJobCreate helper calls before assuming side effects.
- DBQueue relation detected. Follow the task procedure and referenced-by list for async processing.
Verified DBQueue Slot Runner Notes
- Source catalog entry
dbo.QBM_PDBQCS_SlotRunneris a non-generated SQL stored procedure fromsandbox-db sys.sql_modules. - The source definition calls
QBM_PDBQueueInsert_Bulkfor child/follow-up task work according to the extracted DBQueue relation. - The source definition inserts from a temporary job set into
JobQueueand includesMaxInstancein both the target column list and selected source columns. - The generated source-index flags show
HasDBQueueInsertBulk=1,HasDBQueueInsertSingle=0,HasChangeLimit=0, andHasQbmPJobCreate=0for this procedure.
Operational meaning: This routine connects DBQueue slot execution with follow-up DBQueue bulk insertion and JobQueue materialization; `MaxInstance` is carried as job execution metadata, not inferred from UI behavior.
Relations
- Bulk DBQueue insert -> ( at line 57
- References QBM_PDBQueueInsert_Bulk
Typed Edges
- queues DBQueue task ( at line 57 Bulk DBQueue insert -> ( at line 57
- references source dbo.QBM_FCVFloatToString source text reference
- references source dbo.QBM_FCVStringToFloat source text reference
- references source dbo.QBM_FGIConfigparmValue source text reference
- references source dbo.QBM_FGISessionContext source text reference
- references source dbo.QBM_FGISessionErrorForLog source text reference
- references source dbo.QBM_FGISessionErrorIsDeadlock source text reference
- references source dbo.QBM_PDBQCS_CurrentMoveSlot source text reference
- references source dbo.QBM_PDBQueueInsert_Bulk source text reference
- references source dbo.QBM_PJournal source text reference
- references source dbo.QBM_PSessionContextSet source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- references source dbo.QBM_PTempQueueEnd source text reference
- references source dbo.QBM_PTransactionLevelCheck source text reference
- references source dbo.QBM_PWaitForSeconds source text reference
- queues DBQueue task ( -> unresolved procedure QBM_PDBQueueInsert_Bulk @childtask, @DBQueueElements_01 select @ElementIndex += 1 end end select @CountReallyProcessed = 0 while @Set0Retries > 0 begin BEGIN TRY delete @DBQueueToMove insert into @DBQueueToMove(UID_DialogDBQueue) select cu…
References
- dbo.QBM_FCVFloatToString
- dbo.QBM_FCVStringToFloat
- dbo.QBM_FGIConfigparmValue
- dbo.QBM_FGISessionContext
- dbo.QBM_FGISessionErrorForLog
- dbo.QBM_FGISessionErrorIsDeadlock
- dbo.QBM_PDBQCS_CurrentMoveSlot
- dbo.QBM_PDBQueueInsert_Bulk
- dbo.QBM_PJournal
- dbo.QBM_PSessionContextSet
- dbo.QBM_PSessionErrorAdd
- dbo.QBM_PTempQueueEnd
- dbo.QBM_PTransactionLevelCheck
- dbo.QBM_PWaitForSeconds
Referenced By
Complete Source
1CREATE PROCEDURE QBM_PDBQCS_SlotRunner(2 @SlotNumber int,3 @UID_Task varchar(38),4 @ProcedureToCall varchar(30),5 @IsWithoutTransaction BIT,6 @isBulkenabled int,7 @CountReallyProcessed int OUTPUT8)9AS10BEGIN11 DECLARE @RunnerResult int = 212 DECLARE @ErrorMessage nvarchar(4000) = ''13 DECLARE @ErrorSource nvarchar(64) = ''14 DECLARE @object varchar(38)15 DECLARE @subObject varchar(38)16 DECLARE @GenProcID varchar(38)17 DECLARE @StartTime datetime = getutcdate()18 DECLARE @TotalRuntime_ms float19 DECLARE @ProcedureToPrepare varchar(30)20 DECLARE @ProcedureToCallMissig BIT = 021 DECLARE @ProcedureToPrepareExists BIT = 022 DECLARE @DebugLevel char(1) = 'I'23 DECLARE @Set0Retries int = 1024 DECLARE @SlotNumberSource int25 DECLARE @SlotNumberTarget int26 DECLARE @DBQueueToMove QBM_YDBQCSCurrentToMove27 DECLARE @DebugSwitch int = 028 DECLARE @DebugMessage nvarchar(1000)29 DECLARE @ModuleInUse QBM_YParameterList30 DECLARE @ElementCount int31 DECLARE @ElementIndex int32 DECLARE @childtask varchar(38)33 DECLARE @RowCountBeforeReset int34 DECLARE @RowCountAfterReset int35 SET XACT_ABORT OFF truncate TABLE #JobQueue truncate TABLE #QBMElementAffectedByJob36 IF @SlotNumber <= 99737 BEGIN38 EXEC QBM_PTransactionLevelCheck 0,39 @@procid,40 'entry'41 END42 IF @DebugSwitch > 043 BEGIN44 print 'eintritt Runner slot' + str(@slotnumber) + ' Task ' + @UID_Task45 END46 SELECT @ProcedureToPrepare = CONCAT(47 LEFT(@ProcedureToCall, 4),48 'R',49 substring(@ProcedureToCall, 6, 30))50 IF EXISTS(51 SELECT TOP 1 152 FROM sys.objects o53 WHERE54 o.type = 'P' AND o.name = @ProcedureToPrepare)55 BEGIN56 SELECT @ProcedureToPrepareExists = 157 END58 IF @DebugSwitch > 059 BEGIN60 SELECT61 @DebugMessage = CONCAT('runner @SlotNumber ',62 str(@SlotNumber),63 ' runner @UID_Task ',64 isnull(@UID_Task, '<null>'),65 ' runner @ProcedureToCall ',66 isnull(@ProcedureToCall, '<null>'))67 EXEC QBM_PJournal @debugmessage,68 @@procid,69 'T',70 @DebugLevel71 END72 IF @ProcedureToPrepareExists = 173 BEGIN74 SELECT @RowCountBeforeReset = count(*)75 FROM QBMDBQueueCurrent cu76 WITH(readpast)77 WHERE78 cu.SlotNumber = @SlotNumber79 IF @isBulkenabled = 180 BEGIN81 BEGIN TRY82 SET lock_timeout 200083 EXEC @ProcedureToPrepare @SlotNumber84 END TRY85 BEGIN CATCH86 SELECT @ErrorSource = 'execute slot Prepare'87 SELECT @ErrorMessage = ERROR_MESSAGE()88 EXEC QBM_PSessionErrorAdd DEFAULT89 SET lock_timeout -190 GOTO Fehlerauswertung91 END CATCH92 SET lock_timeout -193 END94 ELSE95 BEGIN96 SELECT97 TOP 1 @object = rtrim(isnull(qc.UID_Parameter, '')),98 @subobject = rtrim(isnull(qc.UID_SubParameter, '')),99 @GenProcID = rtrim(isnull(qc.GenProcID, ''))100 FROM QBMDBQueueCurrent qc101 WITH(readpast)102 WHERE103 qc.SlotNumber = @SlotNumber104 BEGIN TRY105 SET lock_timeout 2000106 EXEC @ProcedureToPrepare @SlotNumber,107 @object,108 @subobject,109 @GenProcID110 END TRY111 BEGIN CATCH112 SELECT @ErrorSource = 'execute slot Prepare'113 SELECT @ErrorMessage = ERROR_MESSAGE()114 EXEC QBM_PSessionErrorAdd DEFAULT115 SET lock_timeout -1116 GOTO Fehlerauswertung117 END CATCH118 SET lock_timeout -1119 END120 SELECT @RowCountAfterReset = count(*)121 FROM QBMDBQueueCurrent cu122 WITH(readpast)123 WHERE124 cu.SlotNumber = @SlotNumber125 IF @RowCountAfterReset = 0126 BEGIN127 SELECT @RunnerResult = 0128 GOTO ende129 END130 END131 IF @IsWithoutTransaction = 0132 BEGIN133 BEGIN134 TRANSACTION135 END136 BEGIN TRY137 IF @isBulkenabled = 1138 BEGIN139 BEGIN TRY140 truncate TABLE #QBMDBQueueTemp141 IF @IsWithoutTransaction = 0142 BEGIN143 EXEC QBM_PSessionContextSet 'TempQueue',144 'True'145 END146 SET lock_timeout 2000147 IF NOT EXISTS(148 SELECT TOP 1 1149 FROM QBMDBQueueCurrent cu150 WITH(readpast)151 WHERE152 cu.SlotNumber = @SlotNumber)153 BEGIN154 SELECT155 @DebugMessage = CONCAT(OBJECT_NAME(@@procid),156 ' empty DBQueueCurrent found (bulk) ',157 ' UID_Task = ',158 CASE159 WHEN ISNULL(@UID_Task, '') = '' THEN160 ' <empty> '161 ELSE @UID_Task162 END)163 EXEC QBM_PJournal @DebugMessage,164 @@procid,165 'D',166 @DebugLevel167 SELECT @RunnerResult = 1168 GOTO Fehlerauswertung169 END170 EXEC @ProcedureToCall @SlotNumber171 IF dbo.QBM_FGISessionContext('TempQueue') > ' '172 BEGIN173 IF EXISTS(174 SELECT TOP 1 1175 FROM #QBMDBQueueTemp)176 BEGIN177 EXEC QBM_PTempQueueEnd178 END179 EXEC QBM_PSessionContextSet 'TempQueue',180 ''181 END182 SELECT @RunnerResult = 0183 SELECT @ErrorMessage = ''184 END TRY185 BEGIN CATCH186 SELECT @ErrorSource = 'execute slot bulk'187 SELECT @ErrorMessage = ERROR_MESSAGE()188 EXEC QBM_PSessionErrorAdd DEFAULT189 END CATCH190 SET lock_timeout -1191 EXEC QBM_PSessionContextSet 'TempQueue',192 ''193 END194 ELSE195 BEGIN196 SELECT197 TOP 1 @object = rtrim(isnull(qc.UID_Parameter, '')),198 @subobject = rtrim(isnull(qc.UID_SubParameter, '')),199 @GenProcID = rtrim(isnull(qc.GenProcID, ''))200 FROM QBMDBQueueCurrent qc201 WITH(readpast)202 WHERE203 qc.SlotNumber = @SlotNumber204 IF @@ROWCOUNT = 0 OR @GenProcID IS NULL205 BEGIN206 SELECT207 @DebugMessage = CONCAT(OBJECT_NAME(@@procid),208 ' empty values found ',209 ' UID_Task = ',210 CASE211 WHEN ISNULL(@UID_Task, '') = '' THEN212 ' <empty> '213 ELSE @UID_Task214 END,215 ' GenProcID = ',216 CASE217 WHEN ISNULL(@GenProcID, '') = '' THEN218 ' <empty> '219 ELSE @GenProcID220 END,221 ' UID_Parameter = ',222 CASE223 WHEN ISNULL(@object, '') = '' THEN224 ' <empty> '225 ELSE @object226 END,227 ' UID_SubParameter = ',228 CASE229 WHEN ISNULL(@subObject, '') = '' THEN230 ' <empty> '231 ELSE @subObject232 END)233 EXEC QBM_PJournal @DebugMessage,234 @@procid,235 'D',236 @DebugLevel237 SELECT @RunnerResult = 1238 GOTO Fehlerauswertung239 END240 BEGIN TRY241 SET lock_timeout 10000242 EXEC @ProcedureToCall @SlotNumber,243 @object,244 @subobject,245 @GenProcID246 SELECT @RunnerResult = 0247 SELECT @ErrorMessage = ''248 END TRY249 BEGIN CATCH250 SELECT @ErrorSource = 'execute slot single'251 SELECT @ErrorMessage = ERROR_MESSAGE()252 EXEC QBM_PSessionErrorAdd DEFAULT253 END CATCH254 SET lock_timeout -1255 END256 END TRY257 BEGIN CATCH258 SELECT259 @ErrorMessage = CONCAT(ERROR_MESSAGE(),260 ' task: ',261 @UID_Task)262 EXEC QBM_PSessionErrorAdd DEFAULT263 SELECT @ErrorSource = 'main catch'264 EXEC QBM_PSessionContextSet 'TempQueue',265 ''266 END CATCH267 Fehlerauswertung:268 IF @ErrorSource > ' '269 BEGIN270 IF NOT EXISTS(271 SELECT TOP 1 1272 FROM sys.objects o273 WHERE274 o.type = 'P' AND o.name = @ProcedureToCall)275 BEGIN276 SELECT @ProcedureToCallMissig = 1277 END278 IF dbo.QBM_FGISessionErrorIsDeadlock(DEFAULT) = 1 OR @ProcedureToCallMissig = 1279 BEGIN280 SELECT @RunnerResult = 1281 END282 ELSE283 BEGIN284 SELECT @RunnerResult = -1285 END286 END287 IF @DebugSwitch > 0288 BEGIN289 print 'Runnerresult ' + str(@RunnerResult)290 END291 IF @RunnerResult <> 0292 BEGIN293 IF @@trancount > 0294 BEGIN295 ROLLBACK TRANSACTION296 END297 END298 ELSE299 BEGIN300 IF @IsWithoutTransaction = 0301 BEGIN302 COMMIT303 END304 END305 IF @SlotNumber <= 997306 BEGIN307 EXEC QBM_PTransactionLevelCheck 0,308 @@procid,309 'exit'310 END311 IF @RunnerResult = 0312 BEGIN313 IF EXISTS(314 SELECT TOP 1 1315 FROM #JobQueue)316 BEGIN317 INSERT INTO JobQueue(ComponentAssembly,318 ComponentClass,319 DeferOnError,320 ErrorNotify,321 ExecutionType,322 IgnoreErrors,323 IsSplitOnly,324 JobChainName,325 MaxInstance,326 MinutesToDefer,327 Retries,328 ParamIN,329 Priority,330 Queue,331 Ready2EXE,332 StartAt,333 TaskName,334 UID_Job,335 UID_JobError,336 UID_JobSameServer,337 UID_JobSuccess,338 UID_Tree,339 WasError,340 XDateInserted,341 XDateUpdated,342 XUserInserted,343 XUserUpdated,344 IsRootJob,345 GenProcID,346 isToFreezeOnError,347 BasisObjectKey)348 SELECT349 ComponentAssembly,350 ComponentClass,351 DeferOnError,352 ErrorNotify,353 ExecutionType,354 IgnoreErrors,355 IsSplitOnly,356 JobChainName,357 MaxInstance,358 MinutesToDefer,359 Retries,360 ParamIN,361 Priority,362 Queue,363 Ready2EXE,364 StartAt,365 TaskName,366 UID_Job,367 UID_JobError,368 UID_JobSameServer,369 UID_JobSuccess,370 UID_Tree,371 WasError,372 XDateInserted,373 XDateUpdated,374 XUserInserted,375 XUserUpdated,376 IsRootJob,377 GenProcID,378 isToFreezeOnError,379 BasisObjectKey380 FROM #JobQueue381 END382 IF EXISTS(383 SELECT TOP 1 1384 FROM #QBMElementAffectedByJob)385 BEGIN386 INSERT INTO QBMElementAffectedByJob(UID_Job,387 ObjectKeyAffected)388 SELECT389 UID_Job,390 ObjectKeyAffected391 FROM #QBMElementAffectedByJob392 END393 IF EXISTS(394 SELECT TOP 1 1395 FROM QBMDBQueueTaskMetric t396 WITH(nolock)397 WHERE398 t.UID_TaskParent = @UID_Task)399 BEGIN400 DECLARE @DBQueueElements_01 QBM_YDBQueueRaw401 INSERT INTO @DBQueueElements_01(Object,402 SubObject,403 GenProcID)404 SELECT405 cu.UID_Parameter,406 cu.UID_SubParameter,407 max(cu.GenProcID)408 FROM QBMDBQueueCurrent cu409 WITH(readpast)410 WHERE411 cu.SlotNumber = @SlotNumber412 GROUP BY cu.UID_Parameter,413 cu.UID_SubParameter414 DECLARE @FolgeTask QBM_YCursorBuffer415 IF EXISTS(416 SELECT TOP 1 1417 FROM sys.objects o418 WHERE419 o.name = 'QBMVSystemOverview' AND o.type = 'V')420 BEGIN421 INSERT INTO @ModuleInUse(Parameter1)422 SELECT v.Value423 FROM QBMVSystemOverview v424 WHERE425 v.Element = N 'Module in use'426 INSERT INTO @FolgeTask(UID1)427 SELECT t.UID_Task428 FROM QBMDBQueueTaskMetric t429 WITH(readpast)430 LEFT431 OUTER432 JOIN @ModuleInUse v433 ON v.Parameter1 = CONCAT(434 LEFT(t.UID_Task, 3),435 ' ',436 'no')437 WHERE438 t.UID_TaskParent = @UID_Task AND v.Parameter1 IS NULL439 SELECT @ElementCount = @@ROWCOUNT440 END441 ELSE442 BEGIN443 INSERT INTO @FolgeTask(UID1)444 SELECT t.UID_Task445 FROM QBMDBQueueTaskMetric t446 WITH(nolock)447 WHERE448 t.UID_TaskParent = @UID_Task449 SELECT @ElementCount = @@ROWCOUNT450 END451 SELECT @ElementIndex = 1452 WHILE @ElementIndex <= @ElementCount453 BEGIN454 SELECT TOP 1 @Childtask = bu.UID1455 FROM @FolgeTask bu456 WHERE457 bu.ElementIndex = @ElementIndex458 EXEC QBM_PDBQueueInsert_Bulk @childtask,459 @DBQueueElements_01460 SELECT @ElementIndex += 1461 END462 END463 SELECT @CountReallyProcessed = 0464 WHILE @Set0Retries > 0465 BEGIN466 BEGIN TRY467 DELETE @DBQueueToMove468 INSERT INTO @DBQueueToMove(UID_DialogDBQueue)469 SELECT cul.UID_DialogDBQueue470 FROM QBMDBQueueCurrent cul471 WHERE472 cul.SlotNumber = @SlotNumber473 IF @@ROWCOUNT > 0474 BEGIN475 SELECT @SlotNumberSource = @SlotNumber476 SELECT @SlotnumberTarget = 0477 EXEC @CountReallyProcessed = QBM_PDBQCS_CurrentMoveSlot @DBQueueToMove,478 @SlotNumberSource,479 @SlotnumberTarget480 END481 SELECT @Set0Retries = 0482 END TRY483 BEGIN CATCH484 SELECT485 @DebugMessage = CONCAT(ERROR_MESSAGE(),486 '(',487 'update ',488 ' QBMDBQueueCurrent set SlotNumber = 0 where SlotNumber = ',489 str(@Slotnumber),490 ')',491 ' set0Retry ',492 str(@Set0Retries))493 EXEC QBM_PSessionErrorAdd DEFAULT494 EXEC QBM_PWaitForSeconds 0.3495 IF @DebugMessage IS NULL496 BEGIN497 SELECT @DebugMessage = '<empty message> from set 0 retry'498 END499 EXEC QBM_PJournal @DebugMessage,500 @@PROCID,501 'D',502 @DebugLevel503 SELECT @Set0Retries -= 1504 END CATCH505 END506 GOTO Nachbehandlung507 END508 SELECT509 @ErrorMessage = CONCAT('(',510 isnull(@ErrorSource, '<empty @ErrorSource>'),511 ')',512 @ErrorMessage)513 IF @RunnerResult = -1514 BEGIN515 SELECT516 @ErrorMessage = CONCAT(@ErrorMessage,517 dbo.QBM_FGISessionErrorForLog())518 EXEC QBM_PJournal @ErrorMessage,519 @@procid,520 'E',521 @DebugLevel522 GOTO Nachbehandlung523 END524 IF @RunnerResult = 1525 BEGIN526 SELECT527 @ErrorMessage = CONCAT(isnull(@UID_Task, '<empty @UID_Task>'),528 ':',529 @ErrorMessage)530 EXEC QBM_PJournal @ErrorMessage,531 @@PROCID,532 'D',533 @DebugLevel534 END535 IF @RunnerResult = 2536 BEGIN537 SELECT538 @ErrorMessage = CONCAT(@UID_Task,539 ':',540 ' @RunnerResult = 2 ',541 @ErrorMessage)542 EXEC QBM_PJournal @ErrorMessage,543 @@PROCID,544 'E',545 @DebugLevel546 SELECT @RunnerResult = 1547 END548 GOTO ende Nachbehandlung:549 IF @SlotNumber > 997550 BEGIN551 GOTO ende552 END553 SELECT554 @TotalRuntime_ms = DATEDIFF(MS,555 @StartTime,556 GETUTCDATE())557 IF @TotalRuntime_ms > 0.8 * dbo.QBM_FCVStringToFloat(dbo.QBM_FGIConfigparmValue('QBM\DBQueue\KeepAlive'),558 20) * 60.0 * 1000.0559 BEGIN560 SELECT561 @ErrorMessage = CONCAT('#LDS#Extra long running task= {0} runtime = {2} minutes.|',562 @UID_Task,563 '|',564 dbo.QBM_FCVFloatToString(@TotalRuntime_ms / 1000.0 / 60.0),565 '|')566 EXEC QBM_PJournal @ErrorMessage,567 @@PROCID,568 'W',569 @DebugLevel570 END571 ELSE572 BEGIN573 IF @TotalRuntime_ms > 5.0 * dbo.QBM_FCVStringToFloat(dbo.QBM_FGIConfigparmValue('QBM\DBQueue\DefaultRuntime'),574 20) * 1000.0575 BEGIN576 SELECT577 @ErrorMessage = CONCAT('#LDS#Long running task= {0} runtime = {2} seconds.|',578 @UID_Task,579 '|',580 dbo.QBM_FCVFloatToString(@TotalRuntime_ms / 1000.0),581 '|')582 EXEC QBM_PJournal @ErrorMessage,583 @@PROCID,584 'I',585 @DebugLevel586 END587 END588 ende:589 SET lock_timeout -1590 EXEC QBM_PSessionContextSet 'TempQueue',591 '' truncate TABLE #QBMDBQueueTemp592 IF @ProcedureToCallMissig = 1 AND @UID_Task > ' '593 BEGIN594 EXEC QBM_PJournal @ErrorMessage,595 @@ProcID,596 'E',597 @Debuglevel,598 10599 END600 RETURN(@RunnerResult)601 END
Open raw exported source
1 create procedure QBM_PDBQCS_SlotRunner (@SlotNumber int , @UID_Task varchar(38) , @ProcedureToCall varchar(30) , @IsWithoutTransaction bit2 , @isBulkenabled int , @CountReallyProcessed int output ) as begin declare @RunnerResult int = 2 declare @ErrorMessage nvarchar(4000) = '' declare3 @ErrorSource nvarchar(64) = '' declare @object varchar(38) declare @subObject varchar(38) declare @GenProcID varchar(38) declare @StartTime datetime4 = getutcdate() declare @TotalRuntime_ms float declare @ProcedureToPrepare varchar(30) declare @ProcedureToCallMissig bit = 0 declare @ProcedureToPrepareExists5 bit = 0 declare @DebugLevel char(1) = 'I' declare @Set0Retries int = 10 declare @SlotNumberSource int declare @SlotNumberTarget int declare @DBQueueToMove6 QBM_YDBQCSCurrentToMove declare @DebugSwitch int = 0 declare @DebugMessage nvarchar(1000) declare @ModuleInUse QBM_YParameterList declare @ElementCount7 int declare @ElementIndex int declare @childtask varchar(38) declare @RowCountBeforeReset int declare @RowCountAfterReset int SET XACT_ABORT OFF truncate8 table #JobQueue truncate table #QBMElementAffectedByJob if @SlotNumber <= 997 begin exec QBM_PTransactionLevelCheck 0, @@procid, 'entry' end if @DebugSwitch9 > 0 begin print 'eintritt Runner slot' + str(@slotnumber) + ' Task ' + @UID_Task end select @ProcedureToPrepare = concat(left(@ProcedureToCall, 4) , 10'R' , substring(@ProcedureToCall, 6, 30) ) if exists (select top 1 1 from sys.objects o where o.type = 'P' and o.name = @ProcedureToPrepare ) begin select11 @ProcedureToPrepareExists = 1 end if @DebugSwitch > 0 begin select @DebugMessage = concat('runner @SlotNumber ' , str(@SlotNumber) , ' runner @UID_Task '12 , isnull(@UID_Task, '<null>') , ' runner @ProcedureToCall ' , isnull(@ProcedureToCall, '<null>') ) exec QBM_PJournal @debugmessage, @@procid, 'T', @DebugLevel13 end if @ProcedureToPrepareExists = 1 begin select @RowCountBeforeReset = count(*) from QBMDBQueueCurrent cu with (readpast) where cu.SlotNumber = @SlotNumber14 if @isBulkenabled = 1 begin BEGIN TRY set lock_timeout 2000 exec @ProcedureToPrepare @SlotNumber END TRY BEGIN CATCH select @ErrorSource = 'execute slot Prepare'15 select @ErrorMessage = ERROR_MESSAGE() exec QBM_PSessionErrorAdd default set lock_timeout -1 goto Fehlerauswertung END CATCH set lock_timeout -1 end16 else begin select top 1 @object = rtrim(isnull(qc.UID_Parameter, '')), @subobject = rtrim(isnull(qc.UID_SubParameter, '')), @GenProcID = rtrim(isnull17(qc.GenProcID, '')) from QBMDBQueueCurrent qc with (readpast) where qc.SlotNumber = @SlotNumber BEGIN TRY set lock_timeout 2000 exec @ProcedureToPrepare18 @SlotNumber, @object, @subobject, @GenProcID END TRY BEGIN CATCH select @ErrorSource = 'execute slot Prepare' select @ErrorMessage = ERROR_MESSAGE() exec19 QBM_PSessionErrorAdd default set lock_timeout -1 goto Fehlerauswertung END CATCH set lock_timeout -1 end select @RowCountAfterReset = count(*) from20 QBMDBQueueCurrent cu with (readpast) where cu.SlotNumber = @SlotNumber if @RowCountAfterReset = 0 begin select @RunnerResult = 0 goto ende end end 21if @IsWithoutTransaction = 0 begin begin transaction end BEGIN TRY if @isBulkenabled = 1 begin BEGIN TRY truncate table #QBMDBQueueTemp if @IsWithoutTransaction22 = 0 begin exec QBM_PSessionContextSet 'TempQueue', 'True' end set lock_timeout 2000 if not exists ( select top 1 1 from QBMDBQueueCurrent cu with (readpast23) where cu.SlotNumber = @SlotNumber ) begin select @DebugMessage = CONCAT( OBJECT_NAME(@@procid) , ' empty DBQueueCurrent found (bulk) ' , ' UID_Task = '24, case when ISNULL(@UID_Task, '') = '' then ' <empty> ' else @UID_Task end ) exec QBM_PJournal @DebugMessage, @@procid, 'D', @DebugLevel select @RunnerResult25 = 1 goto Fehlerauswertung end exec @ProcedureToCall @SlotNumber if dbo.QBM_FGISessionContext('TempQueue') > ' ' begin if exists ( select top 1 1 from26 #QBMDBQueueTemp ) begin exec QBM_PTempQueueEnd end exec QBM_PSessionContextSet 'TempQueue', '' end select @RunnerResult = 0 select @ErrorMessage = ''27 END TRY BEGIN CATCH select @ErrorSource = 'execute slot bulk' select @ErrorMessage = ERROR_MESSAGE() exec QBM_PSessionErrorAdd default END CATCH set 28lock_timeout -1 exec QBM_PSessionContextSet 'TempQueue', '' end else begin select top 1 @object = rtrim(isnull(qc.UID_Parameter, '')), 29@subobject = rtrim(isnull(qc.UID_SubParameter, '')), @GenProcID = rtrim(isnull(qc.GenProcID, '')) from QBMDBQueueCurrent qc with (readpast) where qc.SlotNumber30 = @SlotNumber if @@ROWCOUNT = 0 or @GenProcID is null begin select @DebugMessage = CONCAT( OBJECT_NAME(@@procid) , ' empty values found ' , ' UID_Task = '31, case when ISNULL(@UID_Task, '') = '' then ' <empty> ' else @UID_Task end , ' GenProcID = ' , case when ISNULL(@GenProcID, '') = '' then ' <empty> ' else32 @GenProcID end , ' UID_Parameter = ' , case when ISNULL(@object, '') = '' then ' <empty> ' else @object end , ' UID_SubParameter = ' , case when ISNULL33(@subObject, '') = '' then ' <empty> ' else @subObject end ) exec QBM_PJournal @DebugMessage, @@procid, 'D', @DebugLevel select @RunnerResult = 1 goto34 Fehlerauswertung end BEGIN TRY set lock_timeout 10000 exec @ProcedureToCall @SlotNumber, @object, @subobject, @GenProcID select @RunnerResult = 0 select35 @ErrorMessage = '' END TRY BEGIN CATCH select @ErrorSource = 'execute slot single' select @ErrorMessage = ERROR_MESSAGE() exec QBM_PSessionErrorAdd default36 END CATCH set lock_timeout -1 end END TRY BEGIN CATCH select @ErrorMessage = concat(ERROR_MESSAGE(), ' task: ' , @UID_Task) exec QBM_PSessionErrorAdd37 default select @ErrorSource = 'main catch' exec QBM_PSessionContextSet 'TempQueue', '' END CATCH Fehlerauswertung: if @ErrorSource > ' ' begin if not 38exists (select top 1 1 from sys.objects o where o.type = 'P' and o.name = @ProcedureToCall ) begin select @ProcedureToCallMissig = 1 end if dbo.QBM_FGISessionErrorIsDeadlock39(default) = 1 or @ProcedureToCallMissig = 1 begin select @RunnerResult = 1 end else begin select @RunnerResult = -1 end end if @DebugSwitch > 0 begin40 print 'Runnerresult ' + str(@RunnerResult) end if @RunnerResult <> 0 begin if @@trancount > 0 begin rollback transaction end end else begin if @IsWithoutTransaction41 = 0 begin commit end end if @SlotNumber <= 997 begin exec QBM_PTransactionLevelCheck 0, @@procid, 'exit' end if @RunnerResult = 0 begin if exists (select42 top 1 1 from #JobQueue ) begin insert into JobQueue ( ComponentAssembly, ComponentClass, DeferOnError, ErrorNotify, ExecutionType, IgnoreErrors, IsSplitOnly43, JobChainName, MaxInstance, MinutesToDefer, Retries, ParamIN, Priority , Queue, Ready2EXE, StartAt, TaskName, UID_Job, UID_JobError, UID_JobSameServer44, UID_JobSuccess, UID_Tree, WasError, XDateInserted, XDateUpdated, XUserInserted, XUserUpdated, IsRootJob, GenProcID , isToFreezeOnError, BasisObjectKey45 ) select ComponentAssembly, ComponentClass, DeferOnError, ErrorNotify, ExecutionType, IgnoreErrors, IsSplitOnly, JobChainName, MaxInstance, MinutesToDefer46, Retries, ParamIN, Priority , Queue, Ready2EXE, StartAt, TaskName, UID_Job, UID_JobError, UID_JobSameServer, UID_JobSuccess, UID_Tree, WasError, XDateInserted47, XDateUpdated, XUserInserted, XUserUpdated, IsRootJob, GenProcID , isToFreezeOnError, BasisObjectKey from #JobQueue end if exists (select top 1 1 from48 #QBMElementAffectedByJob ) begin insert into QBMElementAffectedByJob (UID_Job, ObjectKeyAffected) select UID_Job, ObjectKeyAffected from #QBMElementAffectedByJob49 end if exists (select top 1 1 from QBMDBQueueTaskMetric t with (nolock) where t.UID_TaskParent = @UID_Task ) begin declare @DBQueueElements_01 QBM_YDBQueueRaw50 insert into @DBQueueElements_01(Object, SubObject, GenProcID) select cu.UID_Parameter, cu.UID_SubParameter, max(cu.GenProcID) from QBMDBQueueCurrent cu51 with (readpast) where cu.SlotNumber = @SlotNumber group by cu.UID_Parameter, cu.UID_SubParameter declare @FolgeTask QBM_YCursorBuffer if exists (select52 top 1 1 from sys.objects o where o.name = 'QBMVSystemOverview' and o.type = 'V' ) begin insert into @ModuleInUse(Parameter1) select v.Value from QBMVSystemOverview53 v where v.Element = N'Module in use' insert into @FolgeTask (UID1) select t.UID_Task from QBMDBQueueTaskMetric t with (readpast) left outer join @ModuleInUse54 v on v.Parameter1 = concat(left(t.UID_Task, 3) , ' ', 'no') where t.UID_TaskParent = @UID_Task and v.Parameter1 is null select @ElementCount = @@ROWCOUNT55 end else begin insert into @FolgeTask (UID1) select t.UID_Task from QBMDBQueueTaskMetric t with (nolock) where t.UID_TaskParent = @UID_Task select @ElementCount56 = @@ROWCOUNT end select @ElementIndex = 1 while @ElementIndex <= @ElementCount begin select top 1 @Childtask = bu.UID1 from @FolgeTask bu where bu.ElementIndex57 = @ElementIndex exec QBM_PDBQueueInsert_Bulk @childtask, @DBQueueElements_01 select @ElementIndex += 1 end end select @CountReallyProcessed = 0 while58 @Set0Retries > 0 begin BEGIN TRY delete @DBQueueToMove insert into @DBQueueToMove(UID_DialogDBQueue) select cul.UID_DialogDBQueue from QBMDBQueueCurrent59 cul where cul.SlotNumber = @SlotNumber if @@ROWCOUNT > 0 begin select @SlotNumberSource = @SlotNumber select @SlotnumberTarget = 0 exec @CountReallyProcessed60 = QBM_PDBQCS_CurrentMoveSlot @DBQueueToMove, @SlotNumberSource, @SlotnumberTarget end select @Set0Retries = 0 END TRY BEGIN CATCH select @DebugMessage61 = concat(ERROR_MESSAGE() , '(' , 'update ', ' QBMDBQueueCurrent set SlotNumber = 0 where SlotNumber = ' , str(@Slotnumber) , ')' , ' set0Retry ' , str62(@Set0Retries) ) exec QBM_PSessionErrorAdd default exec QBM_PWaitForSeconds 0.3 if @DebugMessage is null begin select @DebugMessage = '<empty message> from set 0 retry'63 end exec QBM_PJournal @DebugMessage, @@PROCID, 'D', @DebugLevel select @Set0Retries -= 1 END CATCH end goto Nachbehandlung end select @ErrorMessage 64= concat('(' , isnull(@ErrorSource, '<empty @ErrorSource>') , ')' , @ErrorMessage ) if @RunnerResult = -1 begin select @ErrorMessage = concat(@ErrorMessage65 , dbo.QBM_FGISessionErrorForLog() ) exec QBM_PJournal @ErrorMessage, @@procid, 'E', @DebugLevel goto Nachbehandlung end if @RunnerResult = 1 begin select66 @ErrorMessage = concat(isnull(@UID_Task, '<empty @UID_Task>') , ':' , @ErrorMessage ) exec QBM_PJournal @ErrorMessage, @@PROCID, 'D', @DebugLevel end 67if @RunnerResult = 2 begin select @ErrorMessage = concat(@UID_Task , ':' , ' @RunnerResult = 2 ', @ErrorMessage) exec QBM_PJournal @ErrorMessage, @@PROCID68, 'E', @DebugLevel select @RunnerResult = 1 end goto ende Nachbehandlung: if @SlotNumber > 997 begin goto ende end select @TotalRuntime_ms = DATEDIFF69(MS, @StartTime, GETUTCDATE()) if @TotalRuntime_ms > 0.8 * dbo.QBM_FCVStringToFloat(dbo.QBM_FGIConfigparmValue('QBM\DBQueue\KeepAlive'), 20) * 60.0 * 701000.0 begin select @ErrorMessage = CONCAT( '#LDS#Extra long running task= {0} runtime = {2} minutes.|' , @UID_Task, '|' , dbo.QBM_FCVFloatToString(@TotalRuntime_ms71 / 1000.0 / 60.0), '|' ) exec QBM_PJournal @ErrorMessage, @@PROCID, 'W', @DebugLevel end else begin if @TotalRuntime_ms > 5.0 * dbo.QBM_FCVStringToFloat72( dbo.QBM_FGIConfigparmValue('QBM\DBQueue\DefaultRuntime'), 20) * 1000.0 begin select @ErrorMessage = CONCAT( '#LDS#Long running task= {0} runtime = {2} seconds.|'73 , @UID_Task, '|' , dbo.QBM_FCVFloatToString(@TotalRuntime_ms / 1000.0), '|' ) exec QBM_PJournal @ErrorMessage, @@PROCID, 'I', @DebugLevel end end ende:74 set lock_timeout -1 exec QBM_PSessionContextSet 'TempQueue', '' truncate table #QBMDBQueueTemp if @ProcedureToCallMissig = 1 and @UID_Task > ' ' begin75 exec QBM_PJournal @ErrorMessage, @@ProcID, 'E', @Debuglevel, 10 end return (@RunnerResult) end 76