feat: refs #7144 DiagnoseProducionFailure changes
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-05-23 13:49:23 +02:00
parent cb32be3814
commit 2a6cd4698a
2 changed files with 28 additions and 4 deletions

View File

@ -9,11 +9,21 @@ BEGIN
* @table tmp.diagnoseProductionFailure(message, hasError) * @table tmp.diagnoseProductionFailure(message, hasError)
*/ */
DECLARE vHasError BOOL; DECLARE vHasError BOOL;
DECLARE vMaxThreads INT;
DECLARE vMaxTime INT;
SELECT IF(COUNT(ID) > 5, TRUE, FALSE) INTO vHasError SELECT dbFreezeMaxThreads, dbFreezeMaxTime
INTO vMaxThreads, vMaxTime
FROM diagnoseProductionFailureConfig;
IF vMaxThreads IS NULL OR vMaxTime IS NULL THEN
CALL util.throw("Configuration variables not set");
END IF;
SELECT IF(COUNT(ID) > vMaxThreads, TRUE, FALSE) INTO vHasError
FROM information_schema.PROCESSLIST FROM information_schema.PROCESSLIST
WHERE COMMAND = 'Query' WHERE COMMAND = 'Query'
AND `time` > 60; # Variable en tabla AND `time` > vMaxTime;
RETURN vHasError; RETURN vHasError;
END$$ END$$

View File

@ -9,13 +9,27 @@ BEGIN
* @table tmp.diagnoseProductionFailure(message, hasError) * @table tmp.diagnoseProductionFailure(message, hasError)
*/ */
DECLARE vHasError BOOL; DECLARE vHasError BOOL;
DECLARE vMaxTime INT;
SELECT dbGetLockMaxTime INTO vMaxTime
FROM diagnoseProductionFailureConfig;
IF vMaxTime IS NULL THEN
CALL util.throw("Configuration variable not set");
END IF;
/* Bug: En local la tabla METADATA_LOCK_INFO no existe... /* Bug: En local la tabla METADATA_LOCK_INFO no existe...
SELECT COUNT(*) INTO vHasError SELECT COUNT(*) INTO vHasError
FROM information_schema.METADATA_LOCK_INFO mli FROM information_schema.METADATA_LOCK_INFO mli
JOIN information_schema.PROCESSLIST pl ON pl.ID = mli.THREAD_ID JOIN information_schema.PROCESSLIST pl ON pl.ID = mli.THREAD_ID
WHERE mli.LOCK_MODE = 'MDL_SHARED_NO_WRITE' WHERE mli.LOCK_MODE = 'MDL_SHARED_NO_WRITE'
AND pl.`time` > 30; # Variable en tabla AND pl.`time` > vMaxTime;
RETURN vHasError;
*/ */
RETURN true; -- vHasError;
RETURN TRUE;
END$$ END$$
DELIMITER ; DELIMITER ;