Skip to content

Commit

Permalink
XrdApps::JCache: fix pgRead type from ChunkInfo to PageInfo (which ma…
Browse files Browse the repository at this point in the history
…kes it work inside an XRootD Proxy)
  • Loading branch information
apeters1971 committed Jun 13, 2024
1 parent e09d541 commit f1aeb02
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/XrdApps/XrdClJCachePlugin/file/XrdClJCacheFile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ XRootDStatus JCacheFile::Read(uint64_t offset, uint32_t size, void *buffer,
if (pFile) {
sStats.bench.AddMeasurement(size);
if (sEnableJournalCache && AttachForRead()) {
mLog->Info(1, "JCache : Read: offset=%llu size=%llu buffer=%x path='%s'",
offset, size, buffer, pUrl.c_str());
bool eof = false;
auto rb = pJournal->pread(buffer, size, offset, eof);
if ((rb == size) || (eof && rb)) {
Expand Down Expand Up @@ -218,16 +220,21 @@ XRootDStatus JCacheFile::PgRead(uint64_t offset, uint32_t size, void *buffer,
if (pFile) {
sStats.bench.AddMeasurement(size);
if (sEnableJournalCache && AttachForRead()) {
mLog->Info(1, "JCache : PgRead: offset=%llu size=%llu buffer=%x path='%s'",
offset, size, buffer, pUrl.c_str());
bool eof = false;
auto rb = pJournal->pread(buffer, size, offset, eof);

mLog->Info(1, "JCache : PgRead: rb=%llu size=%llu eof=%x path='%s'",
rb, size, eof, pUrl.c_str());
if ((rb == size) || (eof && rb)) {
pStats->bytesCached += rb;
pStats->readOps++;
// we can only serve success full reads from the cache for now
// we can only serve complete reads from the cache for now
XRootDStatus *ret_st = new XRootDStatus(st);
ChunkInfo *chunkInfo = new ChunkInfo(offset, rb, buffer);
PageInfo *pageInfo = new PageInfo(offset, rb, buffer);
AnyObject *obj = new AnyObject();
obj->Set(chunkInfo);
obj->Set(pageInfo);
handler->HandleResponse(ret_st, obj);
st = XRootDStatus(stOK, 0);
return st;
Expand Down

0 comments on commit f1aeb02

Please sign in to comment.