Skip to content

Instantly share code, notes, and snippets.

@andreaceccanti
Last active September 29, 2017 15:49
Show Gist options
  • Save andreaceccanti/890cb9705a37a32c49f9f41a4324db99 to your computer and use it in GitHub Desktop.
Save andreaceccanti/890cb9705a37a32c49f9f41a4324db99 to your computer and use it in GitHub Desktop.
StoRM PtP cleanup scripts
-- Selects and displays PtP requests that are stuck in progress for one month
SELECT rq.ID, rq.timeStamp, rp.targetSURL, sp.statusCode, sp.explanation
FROM storm_db.request_queue rq, storm_db.request_Put rp, storm_db.status_Put sp
WHERE rq.ID = rp.request_queueID and rp.ID = sp.request_PutID
and rq.status = 18 and rq.timeStamp <= DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 MONTH);
-- Marks PtP requests stuck in progress for one month as expired, so that the StoRM
-- request garbage collector will remove them from the database
UPDATE storm_db.request_queue rq, storm_db.request_Put rp, storm_db.status_Put sp
SET sp.statusCode = 1, sp.explanation = "Request expired.", rq.status = 1
WHERE rq.ID = rp.request_queueID and rp.ID = sp.request_PutID
and rq.status = 18 and rq.timeStamp <= DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 MONTH);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment