From 2bca03c66832e163def9b1235881f5070b603059 Mon Sep 17 00:00:00 2001 From: Eric Cano <Eric.Cano@cern.ch> Date: Tue, 27 Mar 2018 14:56:27 +0200 Subject: [PATCH] Added missing updating oldest reuest age in retrieve queue. --- objectstore/RetrieveQueue.cpp | 7 +++++++ objectstore/RetrieveQueueTest.cpp | 3 +++ 2 files changed, 10 insertions(+) diff --git a/objectstore/RetrieveQueue.cpp b/objectstore/RetrieveQueue.cpp index 5f19a47d0f..14f94447b8 100644 --- a/objectstore/RetrieveQueue.cpp +++ b/objectstore/RetrieveQueue.cpp @@ -459,6 +459,13 @@ void RetrieveQueue::addJobsAndCommit(std::list<JobToAdd> & jobsToAdd, AgentRefer maxDriveAllowedMap.incCount(j.policy.maxDrivesAllowed); priorityMap.incCount(j.policy.retrievePriority); minRetrieveRequestAgeMap.incCount(j.policy.retrieveMinRequestAge); + // oldestjobcreationtime is initialized to 0 when + if (m_payload.oldestjobcreationtime()) { + if ((uint64_t)j.startTime < m_payload.oldestjobcreationtime()) + m_payload.set_oldestjobcreationtime(j.startTime); + } else { + m_payload.set_oldestjobcreationtime(j.startTime); + } } // ... update the shard pointer auto shardSummary = rqs.getJobsSummary(); diff --git a/objectstore/RetrieveQueueTest.cpp b/objectstore/RetrieveQueueTest.cpp index 24b4ac1ecf..1701acda04 100644 --- a/objectstore/RetrieveQueueTest.cpp +++ b/objectstore/RetrieveQueueTest.cpp @@ -76,6 +76,8 @@ TEST(ObjectStore, RetrieveQueueShardingAndOrderingTest) { jta.retrieveRequestAddress = address.str(); jobsToAdd.push_back(jta); } + // By construction, first job has lowest start time. + auto minStartTime=jobsToAdd.front().startTime; std::string retrieveQueueAddress = agentRef.nextId("RetrieveQueue"); { // Try to create the retrieve queue @@ -119,6 +121,7 @@ TEST(ObjectStore, RetrieveQueueShardingAndOrderingTest) { ASSERT_NO_THROW(rq.fetch()); // Pop jobs while we can. They should come out in fseq order as there is // no interleaved push and pop. + ASSERT_EQ(minStartTime, rq.getJobsSummary().oldestJobStartTime); uint64_t nextExpectedFseq=0; while (rq.getJobsSummary().files) { auto candidateJobs = rq.getCandidateList(std::numeric_limits<uint64_t>::max(), 50, std::set<std::string>()); -- GitLab