Commit 2389888b authored by Eric Cano's avatar Eric Cano
Browse files

Created new ArchiveQueue flavors.

Their poping of elements will be indifferent of number of bytes.
parent 0654c5cd
......@@ -137,5 +137,15 @@ public:
// with this current value of 25k, the performance should be roughly flat until 25k^2=625M.
static const uint64_t c_maxShardSize = 25000;
};
class ArchiveQueueToReport: public ArchiveQueue {
public:
template<typename...Ts> ArchiveQueueToReport(Ts...args): ArchiveQueue(args...) {}
};
class ArchiveQueueFailed: public ArchiveQueue {
public:
template<typename...Ts> ArchiveQueueFailed(Ts...args): ArchiveQueue(args...) {}
};
}}
......@@ -83,6 +83,13 @@ void ContainerTraits<ArchiveQueue>::PoppedElementsSummary::addDeltaToLog(const P
.add("bytesAfter", bytes);
}
void ContainerTraits<ArchiveQueueToReport>::PoppedElementsSummary::addDeltaToLog(const PoppedElementsSummary& previous,
log::ScopedParamContainer& params) {
params.add("filesAdded", files - previous.files)
.add("filesBefore", previous.files)
.add("filesAfter", files);
}
void ContainerTraits<ArchiveQueue>::ContainerSummary::addDeltaToLog(ContainerSummary& previous, log::ScopedParamContainer& params) {
params.add("queueJobsBefore", previous.jobs)
.add("queueBytesBefore", previous.bytes)
......@@ -195,6 +202,18 @@ auto ContainerTraits<ArchiveQueue>::getPoppingElementsCandidates(Container& cont
return ret;
}
auto ContainerTraits<ArchiveQueueToReport>::getPoppingElementsCandidates(Container& cont, PopCriteria& unfulfilledCriteria,
ElementsToSkipSet& elemtsToSkip, log::LogContext& lc) -> PoppedElementsBatch {
PoppedElementsBatch ret;
auto candidateJobsFromQueue=cont.getCandidateList(std::numeric_limits<uint64_t>::max(), unfulfilledCriteria.files, elemtsToSkip);
for (auto &cjfq: candidateJobsFromQueue.candidates) {
ret.elements.emplace_back(PoppedElement{cta::make_unique<ArchiveRequest>(cjfq.address, cont.m_objectStore), cjfq.copyNb, cjfq.size,
common::dataStructures::ArchiveFile(), "", "", "", });
ret.summary.files++;
}
return ret;
}
auto ContainerTraits<ArchiveQueue>::getElementSummary(const PoppedElement& poppedElement) -> PoppedElementsSummary {
PoppedElementsSummary ret;
ret.bytes = poppedElement.bytes;
......@@ -218,6 +237,11 @@ auto ContainerTraits<ArchiveQueue>::PopCriteria::operator-=(const PoppedElements
return *this;
}
auto ContainerTraits<ArchiveQueueToReport>::PopCriteria::operator-=(const PoppedElementsSummary& pes) -> PopCriteria & {
files -= pes.files;
return *this;
}
auto ContainerTraits<ArchiveQueue>::switchElementsOwnership(PoppedElementsBatch & popedElementBatch,
const ContainerAddress & contAddress, const ContainerAddress & previousOwnerAddress, log::TimingList& timingList, utils::Timer & t,
log::LogContext & lc)
......
......@@ -145,4 +145,39 @@ public:
};
template<>
class ContainerTraits<ArchiveQueueToReport>: public ContainerTraits<ArchiveQueue> {
class PoppedElementsSummary;
class PopCriteria {
public:
PopCriteria& operator-= (const PoppedElementsSummary &);
uint64_t files = 0;
};
class PoppedElementsSummary {
public:
uint64_t files = 0;
bool operator< (const PopCriteria & pc) {
return files < pc.files;
}
PoppedElementsSummary& operator+= (const PoppedElementsSummary & other) {
files += other.files;
return *this;
}
void addDeltaToLog(const PoppedElementsSummary&, log::ScopedParamContainer &);
};
class PoppedElementsBatch {
public:
PoppedElementsList elements;
PoppedElementsSummary summary;
void addToLog(log::ScopedParamContainer &);
};
static PoppedElementsBatch getPoppingElementsCandidates(Container & cont, PopCriteria & unfulfilledCriteria,
ElementsToSkipSet & elemtsToSkip, log::LogContext & lc);
};
template<>
class ContainerTraits<ArchiveQueueFailed>: public ContainerTraits<ArchiveQueueToReport> {/* Same same */ };
}} // namespace cta::objectstore
\ No newline at end of file
......@@ -34,6 +34,8 @@ class ScopedLock;
class ScopedExclusiveLock;
template <class C> class ContainerTraits;
class ArchiveQueue;
class ArchiveQueueToReport;
class ArchiveQueueFailed;
class RetrieveQueue;
class ObjectOpsBase {
......@@ -43,6 +45,8 @@ class ObjectOpsBase {
friend class GenericObject;
friend class Helpers;
friend ContainerTraits<ArchiveQueue>;
friend ContainerTraits<ArchiveQueueToReport>;
friend ContainerTraits<ArchiveQueueFailed>;
friend ContainerTraits<RetrieveQueue>;
protected:
ObjectOpsBase(Backend & os): m_nameSet(false), m_objectStore(os),
......
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