Commit 2c417933 authored by Miguel Martinez Pedreira's avatar Miguel Martinez Pedreira
Browse files

Small changes for directory creation for Cassandra dumper

parent c8639aa6
......@@ -91,6 +91,11 @@ public class LFN_CSD implements Comparable<LFN_CSD>, CatalogEntity {
*/
public static final ExpirationCache<String, UUID> dirCache = new ExpirationCache<>(80000); // TODO: should change size?
/**
* Local cache to hold recently inserted folders
*/
public static final ExpirationCache<String, Integer> rifs = new ExpirationCache<>(5000); // TODO: should change size?
/**
* Owner
*/
......@@ -874,7 +879,7 @@ public class LFN_CSD implements Comparable<LFN_CSD>, CatalogEntity {
return true;
while (folderBookingMap.putIfAbsent(folder, Integer.valueOf(1)) != null) {
Thread.sleep(1000);
Thread.sleep(1000 * bookingTries);
bookingTries++;
if (bookingTries == 3) {
System.err.println("Can't get booking lock: " + folder);
......@@ -882,6 +887,9 @@ public class LFN_CSD implements Comparable<LFN_CSD>, CatalogEntity {
}
}
if (rifs.get(folder) != null)
return true;
try {
// return if in the cache
if (dirCache.get(folder) != null) {
......@@ -925,6 +933,7 @@ public class LFN_CSD implements Comparable<LFN_CSD>, CatalogEntity {
throw (e);
} finally {
folderBookingMap.remove(folder);
rifs.put(folder, Integer.valueOf(1), 30 * 1000); // 30 seconds
}
}
......
......@@ -630,6 +630,8 @@ public class CatalogueToCassandraThreads {
failed_folders.flush();
continue;
}
created = true;
break;
} catch (Exception e) {
final String msg = "Exception inserting directory: " + l.getCanonicalName() + " Time: " + new Date() + " Exception: " + e;
System.err.println(msg);
......@@ -640,7 +642,8 @@ public class CatalogueToCassandraThreads {
}
if (!created) {
out.println("Cannot create dir in AddPath after 3 tries: " + l.getCanonicalName());
System.err.println("Cannot create dir in Recurse after 3 tries: " + l.getCanonicalName());
out.println("Cannot create dir in Recurse after 3 tries: " + l.getCanonicalName());
return;
}
......
Markdown is supported
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