Forráskód Böngészése

HPCC-25708 Auto populate file level @compressedSize based on parts

@size was auto-calculated and populated based on the part meta info
when creating a distributed file, but @compressedSize wasn't.
Instead, the engines had code to manually calculate and populate
this (and in some cases @size too). And in a couple of cases they
did not populate @compressedSize, so it was missing.

Fix by always calculating and populating in DFS and removing
the engine code that did it.

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
Jake Smith 4 éve
szülő
commit
a2ec37d4e1

+ 22 - 7
dali/base/dadfs.cpp

@@ -3498,29 +3498,42 @@ public:
 #ifdef EXTRA_LOGGING
         LOGPTREE("CDistributedFile.b root.1",root);
 #endif
-        offset_t totalsize=0;
+        offset_t totalsize = 0;
+        offset_t totalCompressedSize = 0;
         unsigned checkSum = ~0;
         bool useableCheckSum = true;
         MemoryBuffer pmb;
         unsigned n = fdesc->numParts();
-        for (unsigned i=0;i<n;i++) {
+        bool compressed = isCompressed(nullptr);
+        for (unsigned i=0;i<n;i++)
+        {
             IPropertyTree *partattr = &fdesc->queryPart(i)->queryProperties();
             if (!partattr)
             {
-                totalsize = (unsigned)-1;
+                totalsize = (offset_t)-1;
+                totalCompressedSize = (offset_t)-1;
                 useableCheckSum = false;
             }
             else
             {
-                offset_t psz;
-                if (totalsize!=(offset_t)-1) {
-                    psz = (offset_t)partattr->getPropInt64("@size", -1);
+                if (totalsize!=(offset_t)-1)
+                {
+                    offset_t psz = (offset_t)partattr->getPropInt64("@size", -1);
                     if (psz==(offset_t)-1)
                         totalsize = psz;
                     else
                         totalsize += psz;
+                    if (compressed)
+                    {
+                        psz = (offset_t)partattr->getPropInt64("@compressedSize", -1);
+                        if (psz==(offset_t)-1)
+                            totalCompressedSize = psz;
+                        else
+                            totalCompressedSize += psz;
+                    }
                 }
-                if (useableCheckSum) {
+                if (useableCheckSum)
+                {
                     unsigned crc;
                     if (fdesc->queryPart(i)->getCrc(crc))
                         checkSum ^= crc;
@@ -3532,6 +3545,8 @@ public:
         shrinkFileTree(root);
         if (totalsize!=(offset_t)-1)
             queryAttributes().setPropInt64("@size", totalsize);
+        if (totalCompressedSize!=(offset_t)-1)
+            queryAttributes().setPropInt64("@compressedSize", totalCompressedSize);
         if (useableCheckSum)
             queryAttributes().setPropInt64("@checkSum", checkSum);
         setModified();

+ 0 - 3
ecl/hthor/hthor.cpp

@@ -703,10 +703,7 @@ void CHThorDiskWriteActivity::publish()
     if (encrypted)
         properties.setPropBool("@encrypted", true);
     if (blockcompressed)
-    {
-        properties.setPropInt64("@compressedSize", fileSize);
         properties.setPropBool("@blockCompressed", true);
-    }
     if (helper.getFlags() & TDWpersist)
         properties.setPropBool("@persistent", true);
     if (grouped)

+ 0 - 2
roxie/ccd/ccdserver.cpp

@@ -11713,9 +11713,7 @@ public:
         {
             // caller has already set @size from file size...
             fileProps.setPropBool("@blockCompressed", true);
-            fileProps.setPropInt64("@compressedSize", partProps.getPropInt64("@size", 0));
             partProps.setPropInt64("@compressedSize", partProps.getPropInt64("@size", 0));
-            fileProps.setPropInt64("@size", uncompressedBytesWritten);
             partProps.setPropInt64("@size", uncompressedBytesWritten);
         }
         else if (tallycrc && crc.get())

+ 1 - 9
thorlcr/mfilemanager/thmfilemanager.cpp

@@ -583,17 +583,9 @@ public:
             return;
         }
         file->setAccessed();
+        offset_t fs = file->getDiskSize(false, false);
         if (publishedFile)
             publishedFile->set(file);
-        __int64 fs = file->getFileSize(false,false);
-        if (fs!=-1)
-            file->queryAttributes().setPropInt64("@size",fs);
-        if (file->isCompressed())
-        {
-            fs = file->getDiskSize(false,false);
-            if (fs!=-1)
-                file->queryAttributes().setPropInt64("@compressedSize",fs);
-        }
         file->attach(logicalName, job.queryUserDescriptor());
         unsigned c=0;
         for (; c<fileDesc.numClusters(); c++)