Commit c669d4cf authored by Costin Grigoras's avatar Costin Grigoras
Browse files

Never sort in the database; avoid client sorting when possible

parent 75d1880e
......@@ -63,7 +63,7 @@ public class ChmodLFN extends Request {
if (!recursive || !success)
return;
final Collection<LFN> lfns = LFNUtils.find(path, "*", LFNUtils.FIND_INCLUDE_DIRS);
final Collection<LFN> lfns = LFNUtils.find(path, "*", LFNUtils.FIND_INCLUDE_DIRS | LFNUtils.FIND_NO_SORT);
if (lfns == null) {
success = false;
......
......@@ -66,7 +66,7 @@ public class ChownLFN extends Request {
if (!recursive || !success)
return;
final Collection<LFN> lfns = LFNUtils.find(path, "*", LFNUtils.FIND_INCLUDE_DIRS);
final Collection<LFN> lfns = LFNUtils.find(path, "*", LFNUtils.FIND_INCLUDE_DIRS | LFNUtils.FIND_NO_SORT);
if (lfns == null) {
success = false;
......
......@@ -414,9 +414,6 @@ public class IndexTableEntry implements Serializable, Comparable<IndexTableEntry
if ((flags & LFNUtils.FIND_FILTER_JOBID) != 0 && queueid != null && queueid.longValue() > 0)
q += " AND jobid = " + queueid;
if ((flags & LFNUtils.FIND_NO_SORT) == 0)
q += " ORDER BY lfn";
if (limit > 0)
q += " LIMIT " + limit;
......
......@@ -688,7 +688,12 @@ public class LFNUtils {
return findByMetadata(path, processedPattern, tag, query);
}
final Set<LFN> ret = new LinkedHashSet<>();
final Set<LFN> ret;
if ((flags & FIND_NO_SORT) != 0)
ret = new LinkedHashSet<>();
else
ret = new TreeSet<>();
final Collection<IndexTableEntry> matchingTables = CatalogueUtils.getAllMatchingTables(path);
......@@ -1368,7 +1373,7 @@ public class LFNUtils {
final LFN parentDir = archive.getParentDir();
if (parentDir.exists) {
final Collection<LFN> allJobFiles = find(parentDir.getCanonicalName(), "*", "", LFNUtils.FIND_FILTER_JOBID, null, "", Long.valueOf(archive.jobid), 0);
final Collection<LFN> allJobFiles = find(parentDir.getCanonicalName(), "*", "", LFNUtils.FIND_FILTER_JOBID | LFNUtils.FIND_NO_SORT, null, "", Long.valueOf(archive.jobid), 0);
if (allJobFiles == null || allJobFiles.size() == 0)
return null;
......
......@@ -3450,7 +3450,8 @@ public class TaskQueueUtils {
// we need to clean up the previous output
if (pathFromJDL != null || j.path != null) {
final Collection<LFN> list = LFNUtils.find(pathFromJDL != null ? pathFromJDL : j.path, "*", LFNUtils.FIND_FILTER_JOBID, null, "", Long.valueOf(queueId));
final Collection<LFN> list = LFNUtils.find(pathFromJDL != null ? pathFromJDL : j.path, "*", LFNUtils.FIND_FILTER_JOBID | LFNUtils.FIND_NO_SORT, null, "",
Long.valueOf(queueId));
if (list != null)
for (final LFN l : list) {
if (l.jobid == queueId) {
......
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