Skip to content

Commit

Permalink
spacemanager: Drop 'fix missing size' command
Browse files Browse the repository at this point in the history
The command was used to recover from a bug in dCache 1.9.1 and
is no longer needed.

Target: trunk
Require-notes: yes
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Acked-by: Dmitry Litinvtsev <litvinse@fnal.gov>
Patch: http://rb.dcache.org/r/6372/
  • Loading branch information
gbehrmann committed Jan 10, 2014
1 parent 877a497 commit 79cad7f
Showing 1 changed file with 0 additions and 61 deletions.
Expand Up @@ -1370,67 +1370,6 @@ public String ac_remove_file( Args args )
return "please specify \"-id=\" or \"-pnfsId=\" option";
}

private static final Object fixMissingSizeLock = new Object();

private static final String SELECT_RECORDS_WITH_MISSING_SIZE =
String.format("select f.* from srmspacefile f, srmspace s where f.state=%d and f.sizeinbytes=0 and f.spacereservationid=s.id and s.state=%d",
FileState.STORED.getStateId(),
SpaceState.RESERVED.getStateId());

private void fixMissingSize() {
synchronized (fixMissingSizeLock) {
try {
logger.info("fix missing size: Searching for " +
"files...");
Set<File> files=
dbManager.select(fileIO,
SELECT_RECORDS_WITH_MISSING_SIZE);
int counter=0;
for (File file : files) {
if (counter%1000==0) {
logger.info("fix missing size: " +
"Processed {} of {} files.",
counter, files.size());
}
long size=pnfs.getFileAttributes(file.getPnfsId(),
EnumSet.of(FileAttribute.SIZE)).getSize();
updateSpaceFile(file.getId(),
null,
null,
null,
size,
null,
null);
counter++;
}
logger.info("fix missing size: Done");
}
catch (SQLException | CacheException e) {
logger.error("failed to fix missing size: {}",
e.getMessage());
}
}
}

public static final String hh_fix_missing_size=
"# See full help for details";

public static final String fh_fix_missing_size=
"Cleans up after a bug that was present in dCache 1.9.1-1 to 1.9.1-3. That \n"
+"bug caused files to be registered with a wrong size in the space manager.\n"
+"Warning: This command may take a long time to complete and may consume a\n"
+"lot of memory. Progress information can be found in the log file.";

public String ac_fix_missing_size(Args args) {
new Thread() {
@Override
public void run() {
fixMissingSize();
}
}.start();
return "Command is executed in a background thread.";
}

private void dbinit() throws SQLException {
insertRetentionPolicies();
insertAccessLatencies();
Expand Down

0 comments on commit 79cad7f

Please sign in to comment.