Skip to content

HPCC-33929 Fix the publication of duplicate stats in thor index write #19798

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

Merged
merged 1 commit into from
May 28, 2025
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
8 changes: 5 additions & 3 deletions testing/regress/ecl/createnumericindex.ecl
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
//Create a pathologically compressible index - especially with the new inplace compression
#onwarning (4523, ignore);

import Std.File AS FileServices;
import std.system.thorlib;

r := { string10 key => unsigned value };
numRows := 2000000;
scale := 1;

ds := DATASET(numRows, TRANSFORM(r, SELF.key := INTFORMAT(COUNTER, 10, 1); SELF.value := COUNTER * scale), DISTRIBUTED);
ds := DATASET(numRows, TRANSFORM(r, SELF.key := INTFORMAT(COUNTER/2, 10, 1); SELF.value := COUNTER * scale), DISTRIBUTED);

engine := thorlib.platform();
filename := '~regress::index::numeric::' + engine;
Expand All @@ -41,6 +42,7 @@ s := PROJECT(ds, recordof(numberIndex));


ordered(
BUILD(numberIndex, ds, overwrite, LOCAL);
compareFiles(s, numberIndex);
BUILD(numberIndex, ds, overwrite, LOCAL);
compareFiles(s, numberIndex);
FileServices.DeleteLogicalFile(filename);
);
10 changes: 1 addition & 9 deletions thorlcr/activities/indexwrite/thindexwrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
class IndexWriteActivityMaster : public CMasterActivity
{
rowcount_t recordsProcessed = 0;
unsigned __int64 duplicateKeyCount = 0;
unsigned __int64 cummulativeDuplicateKeyCount = 0;
offset_t compressedFileSize = 0;
offset_t uncompressedSize = 0;
offset_t originalBlobSize = 0;
Expand Down Expand Up @@ -244,13 +242,12 @@ class IndexWriteActivityMaster : public CMasterActivity
IHThorIndexWriteArg *helper = (IHThorIndexWriteArg *)queryHelper();
updateActivityResult(container.queryJob().queryWorkUnit(), 0, helper->getSequence(), fileName, recordsProcessed);

cummulativeDuplicateKeyCount += duplicateKeyCount;
// MORE - add in the extra entry somehow
if (fileName.get())
{
IPropertyTree &props = fileDesc->queryProperties();
props.setPropInt64("@recordCount", recordsProcessed);
props.setPropInt64("@duplicateKeyCount", duplicateKeyCount);
props.setPropInt64("@duplicateKeyCount", statsCollection.getStatisticSum(StNumDuplicateKeys));
props.setProp("@kind", "key");
props.setPropInt64("@uncompressedSize", uncompressedSize);
props.setPropInt64("@size", compressedFileSize);
Expand Down Expand Up @@ -322,12 +319,9 @@ class IndexWriteActivityMaster : public CMasterActivity
if (mb.length()) // if 0 implies aborted out from this slave.
{
rowcount_t r;
unsigned __int64 slaveDuplicateKeyCount;
mb.read(r);
mb.read(slaveDuplicateKeyCount);

recordsProcessed += r;
duplicateKeyCount += slaveDuplicateKeyCount;

if (!singlePartKey || 0 == slaveIdx)
{
Expand Down Expand Up @@ -398,12 +392,10 @@ class IndexWriteActivityMaster : public CMasterActivity
checkSuperFileOwnership(*file);
}
}
duplicateKeyCount = 0;
}
virtual void getActivityStats(IStatisticGatherer & stats) override
{
CMasterActivity::getActivityStats(stats);
stats.addStatistic(StNumDuplicateKeys, cummulativeDuplicateKeyCount);
diskAccessCost = calcDiskWriteCost(clusters, statsCollection.getStatisticSum(StNumDiskWrites));
if (diskAccessCost)
stats.addStatistic(StCostFileAccess, diskAccessCost);
Expand Down
1 change: 0 additions & 1 deletion thorlcr/activities/indexwrite/thindexwriteslave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,6 @@ class IndexWriteSlaveActivity : public ProcessSlaveActivity, public ILookAheadSt
return;
rowcount_t _processed = processed & THORDATALINK_COUNT_MASK;
mb.append(_processed);
mb.append(inactiveStats.getStatisticValue(StNumDuplicateKeys));
if (!singlePartKey || firstNode())
{
StringBuffer partFname;
Expand Down
Loading