Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-32875 Ensure rowservice can process fields stored as blobs #19254

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions fs/dafsserver/dafsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2278,6 +2278,7 @@ class CRemoteIndexReadActivity : public CRemoteIndexBaseActivity

Owned<const IDynamicTransform> translator;
unsigned __int64 chooseN = 0;
bool cleanupBlobs = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it necessary to check in dtor in case of exception? or will they be cleared up as the index is released anyway?

public:
CRemoteIndexReadActivity(IPropertyTree &config, IFileDescriptor *fileDesc) : PARENT(config, fileDesc)
{
Expand Down Expand Up @@ -2316,6 +2317,12 @@ class CRemoteIndexReadActivity : public CRemoteIndexBaseActivity
}
dbgassertex(retSz);

if (cleanupBlobs)
{
keyManager->releaseBlobs();
cleanupBlobs = false;
}

const void *ret = outBuilder.getSelf();
outBuilder.finishRow(retSz);
++processed;
Expand Down Expand Up @@ -2350,6 +2357,13 @@ class CRemoteIndexReadActivity : public CRemoteIndexBaseActivity
{
return out.appendf("indexread[%s]", fileName.get());
}

virtual const byte * lookupBlob(unsigned __int64 id) override
{
size32_t dummy;
cleanupBlobs = true;
return (byte *) keyManager->loadBlob(id, dummy, nullptr);
}
};


Expand Down
1 change: 1 addition & 0 deletions rtl/eclrtl/rtldynfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,7 @@ class GeneralRecordTranslator : public CInterfaceOf<IDynamicTransform>
{
const RtlRecord *subDest = destRecInfo.queryNested(idx);
const RtlRecord *subSrc = sourceRecInfo.queryNested(info.matchIdx);
assertex(subSrc);
info.subTrans = new GeneralRecordTranslator(*subDest, *subSrc, binarySource);
if (!info.subTrans->needsTranslate())
{
Expand Down
8 changes: 8 additions & 0 deletions rtl/eclrtl/rtlrecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ RtlRecord::RtlRecord(const RtlFieldInfo * const *_fields, bool expandFields) : f
const RtlTypeInfo *curType = queryType(i);
if (!curType->isFixedSize() || (fields[i]->flags & RFTMinifblock))
numVarFields++;
if (curType->isBlob())
{
curType = curType->queryChildType();
if (unlikely(!curType))
throwUnexpectedX("Blob type has no child type");
}
if (curType->getType()==type_table || curType->getType()==type_record || curType->getType()==type_dictionary)
numTables++;
}
Expand Down Expand Up @@ -331,6 +337,8 @@ RtlRecord::RtlRecord(const RtlFieldInfo * const *_fields, bool expandFields) : f
curVariable++;
fixedOffset = 0;
}
if (curType->isBlob())
curType = curType->queryChildType();
switch (curType->getType())
{
case type_table:
Expand Down
25 changes: 17 additions & 8 deletions system/jhtree/jhtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3636,7 +3636,7 @@ class IKeyManagerTest : public CppUnit::TestFixture
{
const char *json = variable ?
"{ \"ty1\": { \"fieldType\": 4, \"length\": 10 }, "
" \"ty2\": { \"fieldType\": 15, \"length\": 8 }, "
" \"ty2\": { \"fieldType\": 15, \"length\": 8, \"child\": \"ty1\" }, "
" \"fieldType\": 13, \"length\": 10, "
" \"fields\": [ "
" { \"name\": \"f1\", \"type\": \"ty1\", \"flags\": 4 }, "
Expand Down Expand Up @@ -3816,13 +3816,22 @@ class IKeyManagerTest : public CppUnit::TestFixture

void testKeys()
{
ASSERT(sizeof(CKeyIdAndPos) == sizeof(unsigned __int64) + sizeof(offset_t));
for (bool var : { true, false })
for (bool trail : { false, true })
for (bool noseek : { false, true })
for (bool quick : { true, false })
for (const char * compression : { (const char *)nullptr, "POC", "inplace" })
testKeys(var, trail, noseek, quick, compression);
try
{
ASSERT(sizeof(CKeyIdAndPos) == sizeof(unsigned __int64) + sizeof(offset_t));
for (bool var : { true, false })
for (bool trail : { false, true })
for (bool noseek : { false, true })
for (bool quick : { true, false })
for (const char * compression : { (const char *)nullptr, "POC", "inplace" })
testKeys(var, trail, noseek, quick, compression);
}
catch (IException * e)
{
StringBuffer s;
e->errorMessage(s);
CPPUNIT_ASSERT_MESSAGE(s.str(), false);
}
}
};

Expand Down
Loading