Commit 2dfd3d43 authored by Giuseppe Lo Presti's avatar Giuseppe Lo Presti
Browse files

Bug #101722: RFE: provide a fast repack -s without details

Implemented by caching the count at the beginning and showing it instead of the COUNTs
of SubRequest. The latter is available as a -d, --detailed report with all progresses (# of recalls, # of migrations, etc.).
parent fa907021
......@@ -1067,8 +1067,16 @@ CREATE GLOBAL TEMPORARY TABLE DeleteDiskCopyHelper
/* Repack */
/**********/
/* SQL statements for type StageRepackRequest (not autogenerated any more) */
CREATE TABLE StageRepackRequest (flags INTEGER, userName VARCHAR2(2048), euid NUMBER, egid NUMBER, mask NUMBER, pid NUMBER, machine VARCHAR2(2048), svcClassName VARCHAR2(2048), userTag VARCHAR2(2048), reqId VARCHAR2(2048), creationTime INTEGER, lastModificationTime INTEGER, repackVid VARCHAR2(2048), id INTEGER CONSTRAINT PK_StageRepackRequest_Id PRIMARY KEY, svcClass INTEGER, client INTEGER, status INTEGER) INITRANS 50 PCTFREE 50 ENABLE ROW MOVEMENT;
/* SQL statements for type StageRepackRequest */
CREATE TABLE StageRepackRequest (flags INTEGER, userName VARCHAR2(2048), euid NUMBER, egid NUMBER, mask NUMBER, pid NUMBER, machine VARCHAR2(2048), svcClassName VARCHAR2(2048), userTag VARCHAR2(2048), reqId VARCHAR2(2048), creationTime INTEGER, lastModificationTime INTEGER,
repackVid VARCHAR2(2048) CONSTRAINT NN_StageRepackReq_repackVid NOT NULL,
id INTEGER CONSTRAINT PK_StageRepackRequest_Id PRIMARY KEY,
svcClass INTEGER,
client INTEGER,
status INTEGER CONSTRAINT NN_StageRepackReq_status NOT NULL,
fileCount INTEGER CONSTRAINT NN_StageRepackReq_fileCount NOT NULL,
totalSize INTEGER CONSTRAINT NN_StageRepackReq_totalSize NOT NULL)
INITRANS 50 PCTFREE 50 ENABLE ROW MOVEMENT;
BEGIN
setObjStatusName('StageRepackRequest', 'status', 0, 'REPACK_STARTING');
......
......@@ -105,9 +105,9 @@ BEGIN
varReqUUID := uuidGen();
-- insert the request in status SUBMITTED, the SubRequests will be created afterwards
INSERT INTO StageRepackRequest (reqId, machine, euid, egid, pid, userName, svcClassName, svcClass, client, repackVID,
userTag, flags, mask, creationTime, lastModificationTime, status, id)
userTag, flags, mask, creationTime, lastModificationTime, status, fileCount, totalSize, id)
VALUES (varReqUUID, inMachine, inEuid, inEgid, inPid, inUserName, inSvcClassName, varSvcClassId, varClientId, reqVID,
varReqUUID, 0, 0, getTime(), getTime(), tconst.REPACK_SUBMITTED, ids_seq.nextval);
varReqUUID, 0, 0, getTime(), getTime(), tconst.REPACK_SUBMITTED, 0, 0, ids_seq.nextval);
COMMIT;
logToDLF(varReqUUID, dlf.LVL_SYSTEM, dlf.REPACK_SUBMITTED, 0, '', 'repackd', 'TPVID=' || reqVID);
END;
......@@ -132,6 +132,7 @@ CREATE OR REPLACE PROCEDURE handleRepackRequest(inReqUUID IN VARCHAR2,
unused INTEGER;
firstCF boolean := True;
isOngoing boolean := False;
varTotalSize INTEGER := 0;
BEGIN
UPDATE StageRepackRequest SET status = tconst.REPACK_STARTING
WHERE reqId = inReqUUID
......@@ -179,6 +180,7 @@ BEGIN
varMigrationTriggered BOOLEAN := False;
BEGIN
outNbFilesProcessed := outNbFilesProcessed + 1;
varTotalSize := varTotalSize + segment.segSize;
-- Commit from time to time
IF MOD(outNbFilesProcessed, 1000) = 0 THEN
COMMIT;
......@@ -309,13 +311,25 @@ BEGIN
EXECUTE IMMEDIATE 'TRUNCATE TABLE RepackTapeSegments';
-- update status of the RepackRequest
IF isOngoing THEN
UPDATE StageRepackRequest SET status = tconst.REPACK_ONGOING WHERE StageRepackRequest.id = varReqId;
UPDATE StageRepackRequest
SET status = tconst.REPACK_ONGOING,
fileCount = outNbFilesProcessed,
totalSize = varTotalSize
WHERE StageRepackRequest.id = varReqId;
ELSE
IF outNbFailures > 0 THEN
UPDATE StageRepackRequest SET status = tconst.REPACK_FAILED WHERE StageRepackRequest.id = varReqId;
UPDATE StageRepackRequest
SET status = tconst.REPACK_FAILED,
fileCount = outNbFilesProcessed,
totalSize = varTotalSize
WHERE StageRepackRequest.id = varReqId;
ELSE
-- CASE of an 'empty' repack : the tape had no files at all
UPDATE StageRepackRequest SET status = tconst.REPACK_FINISHED WHERE StageRepackRequest.id = varReqId;
UPDATE StageRepackRequest
SET status = tconst.REPACK_FINISHED,
fileCount = 0,
totalSize = 0
WHERE StageRepackRequest.id = varReqId;
END IF;
END IF;
COMMIT;
......
......@@ -26,7 +26,7 @@
"""repack command line of CASTOR."""
import os, sys, time, pwd
import os, sys, time
import getopt, socket
import castor_tools
import subprocess
......@@ -36,13 +36,13 @@ import cx_Oracle
def usage(exitCode):
'''prints usage'''
print 'Usage :'
print ' repack -h/--help'
print ' repack -h|--help'
print ' repack -V <VID>[:<VID>[:...]] -o serviceclass'
print ' repack --bulkvolumeid <filename> -o serviceclass'
print ' repack -R <VID>[:<VID>[:...]]'
print ' repack --bulkdelete <filename>'
print ' repack -s'
print ' repack -S <VID>:<VID>[:...]]'
print ' repack -s|--statusAll [-d|--detailed]'
print ' repack -S <VID>:<VID>[:...]] [-d|--detailed]'
print ' repack -e <VID>[:<VID>[:...]] [-n <nbErrorsDisplayed>]'
sys.exit(exitCode)
......@@ -52,7 +52,7 @@ def parseInputFile(fileName):
# first parse the options
try:
options, arguments = getopt.getopt(sys.argv[1:], 'V:o:sS:R:e:hn:v', ['volumeid=', 'bulkvolumeid=', 'svcclass=', 'statusAll', 'status=', 'delete=', 'bulkdelete=', 'errors=', 'help', 'nbErrorsDisplayed=', 'verbose'])
options, arguments = getopt.getopt(sys.argv[1:], 'V:o:sdS:R:e:hn:v', ['volumeid=', 'bulkvolumeid=', 'svcclass=', 'statusAll', 'detailed', 'status=', 'delete=', 'bulkdelete=', 'errors=', 'help', 'nbErrorsDisplayed=', 'verbose'])
except Exception, parsingException:
print parsingException
usage(1)
......@@ -61,6 +61,7 @@ vflag = False
sflag = False
rflag = False
eflag = False
detailFlag = False
svcClass = None
maxNbErrors = None
verbose = False
......@@ -75,6 +76,8 @@ for f, v in options:
vflag = True
elif f == '-s' or f == '--statusAll':
sflag = True
elif f == '-d' or f == '--detailed':
detailFlag = True
elif f == '-S' or f == '--status':
vids.extend(v.split(':'))
sflag = True
......@@ -128,28 +131,13 @@ def _getIdentity():
euid = os.getuid()
egid = os.getgid()
pid = os.getpid()
username = pwd.getpwuid(euid)[0]
username = castor_tools.getCurrentUsername()
sip = socket.gethostbyname(machine).split('.')
ip = (int(sip[0]) << 24 | int(sip[1]) << 16 | int(sip[2]) << 8 | int(sip[3]))
if ip & 0x80000000 != 0:
ip = ip - 0x100000000
return machine, euid, egid, pid, username, ip
_powerSuf = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB']
def _humanReadableSize(size):
'''Converts a number of bytes into human readable format'''
if not size:
size = 0
order = 0
fsize = float(size)
while fsize >= 1000:
fsize = fsize / 1024
order = order + 1
if order == 0:
return str(size) + _powerSuf[order]
else:
return '%.2f' % fsize + _powerSuf[order]
_repackRequestStatuses = ['STARTING', 'ONGOING', 'FINISHED', 'FAILED', 'ABORTING', 'ABORTED', 'SUBMITTED']
def _printStatusLine(subTime, lastModTime, user, machine, vid, status, total, size, toRecall, toMigr, failed, migrated):
'''prints one status line'''
......@@ -164,74 +152,73 @@ def _printStatusLine(subTime, lastModTime, user, machine, vid, status, total, si
else:
repackTime = time.time() - subTime
# format elapsed time
d, rest = divmod(repackTime, 86400)
h, rest = divmod(rest, 3600)
repackTime = '%2dd %02d:%02d' % (d, h, rest / 60)
repackTime = castor_tools.nbToAge(int(repackTime))
# times need to be transformed in human readable strings
subTime = time.strftime('%d-%b-%y %H:%M', time.localtime(subTime))
# human readable size
size = _humanReadableSize(size)
# format size
size = castor_tools.nbToDataAmount(size)
# actual printing
if total > 0:
# Completion % takes into account each operation (recall and migration) as 1, so that e.g. a tape with half files recalled and none migrated counts as 25% done;
# no weight is given to recalls vs. migrations nor is the file size taken into account.
print '%-18s%10s%10s%29s%9s%11d%12s%10d%10d%10d%10d%7d%%%11s' % (subTime, repackTime, user, machine, vid, total, size, toRecall, toMigr, failed, migrated, 100-(2*toRecall+toMigr)*50.0/total, status)
else:
print '%-18s%10s%10s%29s%9s%11d%12s%10d%10d%10d%10d N/A %11s' % (subTime, repackTime, user, machine, vid, total, size, toRecall, toMigr, failed, migrated, status)
try:
if total > 0:
# Completion % takes into account each operation (recall and migration) as 1, so that e.g. a tape with half files recalled and none migrated counts as 25% done;
# no weight is given to recalls vs. migrations nor is the file size taken into account.
print '%-18s%10s%17s%29s%9s%11d%12s%10d%10d%10d%10d%7d%%%11s' % (subTime, repackTime, user, machine, vid, total, size, toRecall, toMigr, failed, migrated, 100-(2*toRecall+toMigr)*50.0/total, status)
else:
print '%-18s%10s%17s%29s%9s%11d%12s%10d%10d%10d%10d N/A %11s' % (subTime, repackTime, user, machine, vid, total, size, toRecall, toMigr, failed, migrated, status)
except TypeError:
# case of reporting without details
print '%-18s%10s%17s%29s%9s%11d%12s%11s' % (subTime, repackTime, user, machine, vid, total, size, status)
def displayStatus():
'''displays the ongoing repacks. If vids is not empty, the output is limited to these tapes'''
# prepare DB connection
stconn = castor_tools.connectToStager()
stcur = stconn.cursor()
stcur.arraysize = 50
stGetStatus = '''
SELECT StageRepackRequest.creationTime, StageRepackRequest.lastModificationTime, StageRepackRequest.username,
StageRepackRequest.machine, StageRepackRequest.repackVID, StageRepackRequest.status,
SUM(CASE WHEN SubRequest.status IS NULL THEN 0 ELSE 1 END) total,
SUM(SubRequest.xsize) totsize,
SUM(CASE WHEN SubRequest.status IN (4, 5) THEN 1 ELSE 0 END) toRecall,
SUM(CASE SubRequest.status WHEN 12 THEN 1 ELSE 0 END) toMigr,
SUM(CASE WHEN SubRequest.status IN (7, 9) THEN 1 ELSE 0 END) failed,
SUM(CASE WHEN SubRequest.status IN (8, 11) THEN 1 ELSE 0 END) migrated
FROM StageRepackRequest, SubRequest
WHERE SubRequest.request(+) = StageRepackRequest.id
'''
# query only the requested VIDs. This requires hard parsing but it's still more efficient
# than a later 'grep' and avoids the complexity of dealing with a string list as bind variable.
if vids:
stGetStatus += "AND StageRepackRequest.repackVID IN ('" + "','".join(vids) + "')"
stGetStatus += '''
GROUP BY StageRepackRequest.creationTime, StageRepackRequest.lastModificationTime, StageRepackRequest.username,
StageRepackRequest.machine, StageRepackRequest.repackVID, StageRepackRequest.status
ORDER BY creationTime DESC'''
# go to DB and get back the data
stcur.execute(stGetStatus)
rows = stcur.fetchall()
if len(rows) == 0:
print 'No repack activity found'
return
def _displaySummary(rows):
'''prints a summary of all repack requests according to the given criteria'''
# print out results
print '='*117
print 'SubmitTime RepackTime User Machine Vid Total Size Status'
print '-'*117
sumTotal = sumSize = 0
globalStatus = 2 # FINISHED
shownVids = set()
for subTime, lastModTime, user, machine, vid, status, total, totsize in rows:
if not vids and vid in shownVids:
# when showing full statistics skip the less recent requests for each VID
continue
shownVids.add(vid)
_printStatusLine(subTime, lastModTime, user, machine, vid, status, total, totsize, '-', '-', '-', '-')
sumTotal += total
if totsize > 0:
# it may have returned None
sumSize += totsize
if status != 2 and status != 3 and status != 5:
globalStatus = 1 # ONGOING
print '-'*117
# when showing full statistics, print out summary line
if not vids and sumTotal > 0:
_printStatusLine(time.time(), 0, '-', '-', 'TOTAL', globalStatus, sumTotal, sumSize, '-', '-', '-', '-')
def _displayDetailed(rows):
'''prints the details of all repack requests according to the given criteria'''
# print out results
print '='*158
print 'SubmitTime RepackTime User Machine Vid Total Size toRecall toMigr Failed Migrated Compl% Status'
print '-'*158
print '='*165
print 'SubmitTime RepackTime User Machine Vid Total Size toRecall toMigr Failed Migrated Compl% Status'
print '-'*165
sumTotal = sumSize = sumToRecall = sumToMigr = sumFailed = sumMigrated = 0
shownVids = set()
for subTime, lastModTime, user, machine, vid, status, total, size, toRecall, toMigr, failed, migrated in rows:
for subTime, lastModTime, user, machine, vid, status, total, totsize, toRecall, toMigr, failed, migrated in rows:
if not vids and vid in shownVids:
# when showing full statistics skip the less recent requests for each VID
continue
shownVids.add(vid)
_printStatusLine(subTime, lastModTime, user, machine, vid, status, total, size, toRecall, toMigr, failed, migrated)
_printStatusLine(subTime, lastModTime, user, machine, vid, status, total, totsize, toRecall, toMigr, failed, migrated)
sumTotal += total
if size > 0:
if totsize > 0:
# it may have returned None
sumSize += size
sumSize += totsize
sumToRecall += toRecall
sumToMigr += toMigr
sumFailed += failed
sumMigrated += migrated
print '-'*158
print '-'*165
# when showing full statistics, print out summary line
if not vids and sumTotal > 0:
if sumToRecall + sumToMigr > 0:
......@@ -239,6 +226,54 @@ def displayStatus():
else:
globalStatus = 2 # FINISHED
_printStatusLine(time.time(), 0, '-', '-', 'TOTAL', globalStatus, sumTotal, sumSize, sumToRecall, sumToMigr, sumFailed, sumMigrated)
def displayStatus(detailed):
'''displays the ongoing repacks. If vids is not empty, the output is limited to these tapes'''
# prepare DB connection
stconn = castor_tools.connectToStager()
stcur = stconn.cursor()
stcur.arraysize = 50
if not detailed:
stGetStatus = '''
SELECT creationTime, lastModificationTime, username,
machine, repackVID, status, fileCount total, totalSize totsize
FROM StageRepackRequest
'''
# query only the requested VIDs. This requires hard parsing but it's still more efficient
# than a later 'grep' and avoids the complexity of dealing with a string list as bind variable.
if vids:
stGetStatus += "WHERE StageRepackRequest.repackVID IN ('" + "','".join(vids) + "')"
else:
stGetStatus = '''
SELECT StageRepackRequest.creationTime, StageRepackRequest.lastModificationTime, StageRepackRequest.username,
StageRepackRequest.machine, StageRepackRequest.repackVID, StageRepackRequest.status,
StageRepackRequest.fileCount total, StageRepackRequest.totalSize totsize,
SUM(CASE WHEN SubRequest.status IN (4, 5) THEN 1 ELSE 0 END) toRecall,
SUM(CASE SubRequest.status WHEN 12 THEN 1 ELSE 0 END) toMigr,
SUM(CASE WHEN SubRequest.status IN (7, 9) THEN 1 ELSE 0 END) failed,
SUM(CASE WHEN SubRequest.status IN (8, 11) THEN 1 ELSE 0 END) migrated
FROM StageRepackRequest, SubRequest
WHERE SubRequest.request(+) = StageRepackRequest.id
'''
# query only the requested VIDs, see above
if vids:
stGetStatus += "AND StageRepackRequest.repackVID IN ('" + "','".join(vids) + "')"
stGetStatus += '''
GROUP BY StageRepackRequest.creationTime, StageRepackRequest.lastModificationTime, StageRepackRequest.username,
StageRepackRequest.machine, StageRepackRequest.repackVID, StageRepackRequest.status,
StageRepackRequest.fileCount, StageRepackRequest.totalSize'''
stGetStatus += ' ORDER BY StageRepackRequest.creationTime DESC'
# go to DB and get back the data
stcur.execute(stGetStatus)
rows = stcur.fetchall()
if len(rows) == 0:
print 'No repack activity found'
return
# display
if detailed:
_displayDetailed(rows)
else:
_displaySummary(rows)
# close DB connection
castor_tools.disconnectDB(stconn)
......@@ -424,7 +459,7 @@ try:
if vflag:
submitRepack()
elif sflag:
displayStatus()
displayStatus(detailFlag)
elif rflag:
cancelRepack()
elif eflag:
......
......@@ -41,10 +41,10 @@ repack \- Move files from tape(s) to other tape destination
.BI \-\-bulkdelete\ <file>
.br
.B repack
.BI \-s\
.BI \-s|--statusAll\ [-d|--detailed]
.br
.B repack
.BI \-S\ <VID>[:<VID>[...]]
.BI \-S\ <VID>[:<VID>[...]]\ [-d|--detailed]
.br
.B repack
.BI \-e\ <VID>[:<VID>[...]]\ [\-n\ <nbErrorsDisplayed>]
......@@ -96,6 +96,10 @@ in the stager database. The default value is 5.
shows the status of all ongoing and finished repacks. If multiple repack requests were issued for a given
tape, only the last request is shown. Note that old completed repacks are automatically removed
from the database and are not shown any longer.
.BI \-d,\ \-\-detailed
shows the status of all ongoing and finished repacks with detailed figures for the count of ongoing
recalls and migrations and a completion percentage. If multiple repack requests were issued for a given
tape, only the last request is shown.
.TP
.BI \-S,\ \-\-status
shows the status of ongoing and finished repacks for the given tape(s). The tape(s) is(are) given by their
......@@ -122,39 +126,53 @@ Repack submitted for tape I10551
Repack submitted for tape I10552
> repack -s
===========================================================================================================================================================
SubmitTime RepackTime User Machine Vid Total Size toRecall toMigr Failed Migrated Compl% Status
-----------------------------------------------------------------------------------------------------------------------------------------------------------
23-Jun-11 14:34 0d 03:10 sponcec3 lxcastordev01.cern.ch I10551 44 47.41KiB 0 43 1 0 0% STARTING
22-Jun-11 17:19 1d 01:10 sponcec3 lxcastordev01.cern.ch I10552 1 721B 0 0 0 1 100% FINISHED
> repack -S I10552
===========================================================================================================================================================
SubmitTime RepackTime User Machine Vid Total Size toRecall toMigr Failed Migrated Compl% Status
-----------------------------------------------------------------------------------------------------------------------------------------------------------
23-Jun-11 14:34 0d 03:10 sponcec3 lxcastordev01.cern.ch I10552 1 721B 0 0 1 0 100% ABORTED
22-Jun-11 17:19 1d 01:10 sponcec3 lxcastordev01.cern.ch I10552 1 721B 0 0 0 1 100% FINISHED
22-Jun-11 17:18 1d 01:11 sponcec3 lxcastordev01.cern.ch I10552 1 721B 0 0 1 0 100% FAILED
> repack -S I10551
===========================================================================================================================================================
SubmitTime RepackTime User Machine Vid Total Size toRecall toMigr Failed Migrated Compl% Status
-----------------------------------------------------------------------------------------------------------------------------------------------------------
23-Jun-11 14:34 0d 03:10 sponcec3 lxcastordev01.cern.ch I10551 44 47.41KiB 0 40 1 3 1% ONGOING
> repack -R I10551
> repack -S I10551
===========================================================================================================================================================
SubmitTime RepackTime User Machine Vid Total Size toRecall toMigr Failed Migrated Compl% Status
-----------------------------------------------------------------------------------------------------------------------------------------------------------
23-Jun-11 14:34 0d 03:10 sponcec3 lxcastordev01.cern.ch I10551 44 47.41KiB 0 40 1 3 1% ABORTING
> repack -S I10551
===========================================================================================================================================================
SubmitTime RepackTime User Machine Vid Total Size toRecall toMigr Failed Migrated Compl% Status
-----------------------------------------------------------------------------------------------------------------------------------------------------------
23-Jun-11 14:34 0d 03:10 sponcec3 lxcastordev01.cern.ch I10551 44 47.41KiB 0 0 41 3 100% ABORTED
=====================================================================================================================
SubmitTime RepackTime User Machine Vid Total Size Status
---------------------------------------------------------------------------------------------------------------------
11-Jun-13 18:57 1mn20s itglp@CERN.CH lxc2dev2.cern.ch V21002 4 3.29KiB FINISHED
10-Jun-13 15:42 1mn40s root lxc2dev2.cern.ch V22003 1 2.93KiB FINISHED
---------------------------------------------------------------------------------------------------------------------
11-Jun-13 19:29 - - - TOTAL 5 6.22KiB FINISHED
> repack -s -d
=====================================================================================================================================================================
SubmitTime RepackTime User Machine Vid Total Size toRecall toMigr Failed Migrated Compl% Status
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
11-Jun-13 18:57 1mn20s itglp@CERN.CH lxc2dev2.cern.ch V21002 4 3.29KiB 0 0 0 4 100% FINISHED
10-Jun-13 15:42 1mn40s root lxc2dev2.cern.ch V22003 1 2.93KiB 0 0 0 1 100% FINISHED
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
11-Jun-13 19:29 - - - TOTAL 5 6.22KiB 0 0 0 5 100% FINISHED
> repack -S V21002 -d
=====================================================================================================================================================================
SubmitTime RepackTime User Machine Vid Total Size toRecall toMigr Failed Migrated Compl% Status
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
11-Jun-13 18:57 1mn20s itglp@CERN.CH lxc2dev2.cern.ch V21002 4 3.29KiB 0 0 0 4 100% FINISHED
10-Jun-13 15:00 1mn30s itglp@CERN.CH lxc2dev2.cern.ch V21002 4 3.29KiB 0 0 2 2 100% FAILED
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
> repack -S V21003
=====================================================================================================================
SubmitTime RepackTime User Machine Vid Total Size Status
---------------------------------------------------------------------------------------------------------------------
11-Jun-13 17:43 1mn10s itglp@CERN.CH lxc2dev2.cern.ch V21003 4 3.29KiB ONGOING
---------------------------------------------------------------------------------------------------------------------
> repack -R V21003
> repack -S V21003
=====================================================================================================================
SubmitTime RepackTime User Machine Vid Total Size Status
---------------------------------------------------------------------------------------------------------------------
11-Jun-13 17:43 1mn15s itglp@CERN.CH lxc2dev2.cern.ch V21003 4 3.29KiB ABORTING
---------------------------------------------------------------------------------------------------------------------
> repack -S V21003 -d
=====================================================================================================================================================================
SubmitTime RepackTime User Machine Vid Total Size toRecall toMigr Failed Migrated Compl% Status
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
11-Jun-13 17:43 1mn20s itglp@CERN.CH lxc2dev2.cern.ch V21003 4 3.29KiB 0 0 1 3 100% ABORTED
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
> repack -e I10551
......@@ -163,7 +181,6 @@ SubmitTime RepackTime User Machine Vid T
--------------------------------------------------------------------------------------------
Fileid CopyNo ErrorCode ErrorMessage
--------------------------------------------------------------------------------------------
5000053222 n/a 16 File is currently being written or migrated
5000157562 n/a 1701 Aborted explicitely
5000157580 n/a 1701 Aborted explicitely
5000156311 n/a 1701 Aborted explicitely
......@@ -173,21 +190,21 @@ Fileid CopyNo ErrorCode ErrorMessage
5000157625 n/a 1701 Aborted explicitely
5000157632 n/a 1701 Aborted explicitely
5000157638 n/a 1701 Aborted explicitely
5000157640 n/a 1701 Aborted explicitely
Output restricted to 10 errors. There are more errors for this tape
> repack -e I10551 -n 3
> repack -e I10551 -n 2
*** Tape I10551 ***
--------------------------------------------------------------------------------------------
Fileid CopyNo ErrorCode ErrorMessage
--------------------------------------------------------------------------------------------
5000053222 n/a 16 File is currently being written or migrated
5000157562 n/a 1701 Aborted explicitely
5000157580 n/a 1701 Aborted explicitely
Output restricted to 3 errors. There are more errors for this tape
Output restricted to 2 errors. There are more errors for this tape
.SH NOTES
This command requires database client access to the stager catalogue.
......
......@@ -16,10 +16,15 @@ DELETE FROM ObjStatus WHERE object='DiskCopy' AND field='status'
BEGIN setObjStatusName('DiskCopy', 'status', 0, 'DISKCOPY_VALID'); END;
/
-- temporary function-based index to speed up the following update
CREATE INDEX I_CF_OpenTimeNull
ON CastorFile(decode(nvl(nsOpenTime, -1), -1, 1, NULL));
DECLARE
remCF INTEGER;
CURSOR cfs IS
SELECT id FROM CastorFile WHERE nsOpenTime IS NULL;
SELECT id FROM CastorFile WHERE decode(nvl(nsOpenTime, -1), -1, 1, NULL) = 1;
ids "numList";
BEGIN
FOR cf IN (SELECT unique castorFile, status, nbCopies
......@@ -39,8 +44,8 @@ BEGIN
-- Update all nsOpenTime values
LOOP
OPEN cfs;
FETCH cfs BULK COLLECT INTO ids LIMIT 10000;
EXIT WHEN ifs.count = 0;
FETCH cfs BULK COLLECT INTO ids LIMIT 1000;
EXIT WHEN ids.count = 0;
FORALL i IN 1 .. ids.COUNT
UPDATE CastorFile SET nsOpenTime = lastUpdateTime WHERE id = ids(i);
CLOSE cfs;
......@@ -59,6 +64,11 @@ END;
ALTER TABLE CastorFile MODIFY (nsOpenTime CONSTRAINT NN_CastorFile_NsOpenTime NOT NULL);
ALTER TABLE StageRepackRequest ADD (fileCount INTEGER, totalSize INTEGER);
UPDATE StageRepackRequest SET fileCount = 0, totalSize = 0; -- XXX do we need to recompute those figures? probably not...
ALTER TABLE StageRepackRequest MODIFY (fileCount CONSTRAINT NN_StageRepackReq_fileCount NOT NULL, totalSize CONSTRAINT NN_StageRepackReq_totalSize NOT NULL, status CONSTRAINT NN_StageRepackReq_status NOT NULL, repackVid CONSTRAINT NN_StageRepackReq_repackVid NOT NULL);
DROP TRIGGER tr_DiskCopy_Online;
DROP PROCEDURE getDiskCopiesForJob;
DROP PROCEDURE processPrepareRequest;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment