@@ -3429,7 +3429,9 @@ void FileSprayer::spray()
3429
3429
3430
3430
// If got here then we have succeeded
3431
3431
// Note: On failure, costs will not be updated. Future: would be useful to have a way to update costs on failure.
3432
- updateTargetProperties ();
3432
+ cost_type totalWriteCost = updateTargetProperties ();
3433
+ cost_type totalReadCost = updateSourceProperties ();
3434
+ progressReport->setFileAccessCost (totalReadCost+totalWriteCost);
3433
3435
3434
3436
StringBuffer copyEventText; // [logical-source] > [logical-target]
3435
3437
if (distributedSource)
@@ -3479,13 +3481,13 @@ bool FileSprayer::isSameSizeHeaderFooter()
3479
3481
return retVal;
3480
3482
}
3481
3483
3482
- void FileSprayer::updateTargetProperties ()
3484
+ cost_type FileSprayer::updateTargetProperties ()
3483
3485
{
3484
3486
TimeSection timer (" FileSprayer::updateTargetProperties() time" );
3485
3487
Owned<IException> error;
3486
- cost_type totalWriteCost = 0 ;
3487
3488
if (distributedTarget)
3488
3489
{
3490
+ cost_type totalWriteCost = 0 ;
3489
3491
StringBuffer failedParts;
3490
3492
CRC32Merger partCRC;
3491
3493
offset_t partLength = 0 ;
@@ -3836,12 +3838,20 @@ void FileSprayer::updateTargetProperties()
3836
3838
int expireDays = options->getPropInt (" @expireDays" , -1 );
3837
3839
if (expireDays != -1 )
3838
3840
curProps.setPropInt (" @expireDays" , expireDays);
3841
+ return totalWriteCost;
3839
3842
}
3843
+ if (error)
3844
+ throw error.getClear ();
3845
+ return 0 ;
3846
+ }
3847
+
3848
+ cost_type FileSprayer::updateSourceProperties ()
3849
+ {
3850
+ TimeSection timer (" FileSprayer::updateSourceProperties() time" );
3840
3851
// Update file readCost and numReads in file properties and do the same for subfiles
3841
- // Update totalReadCost
3842
- cost_type totalReadCost = 0 ;
3843
3852
if (distributedSource)
3844
3853
{
3854
+ cost_type totalReadCost = 0 ;
3845
3855
IDistributedSuperFile * superSrc = distributedSource->querySuperFile ();
3846
3856
if (superSrc && superSrc->numSubFiles () > 0 )
3847
3857
{
@@ -3866,14 +3876,10 @@ void FileSprayer::updateTargetProperties()
3866
3876
// so query the first (and only) subfile
3867
3877
subfile = &superSrc->querySubFile (0 );
3868
3878
}
3869
- DistributedFilePropertyLock lock (subfile);
3870
- IPropertyTree &subFileProps = lock.queryAttributes ();
3871
- stat_type prevNumReads = subFileProps.getPropInt64 (getDFUQResultFieldName (DFUQRFnumDiskReads), 0 );
3872
- cost_type legacyReadCost = getLegacyReadCost (subfile->queryAttributes (), subfile);
3873
- cost_type prevReadCost = subFileProps.getPropInt64 (getDFUQResultFieldName (DFUQRFreadCost), 0 );
3874
3879
cost_type curReadCost = calcFileAccessCost (subfile, 0 , curProgress.numReads );
3875
- subFileProps.setPropInt64 (getDFUQResultFieldName (DFUQRFnumDiskReads), prevNumReads + curProgress.numReads );
3876
- subFileProps.setPropInt64 (getDFUQResultFieldName (DFUQRFreadCost), legacyReadCost + prevReadCost + curReadCost);
3880
+ subfile->addAttrValue (getDFUQResultFieldName (DFUQRFnumDiskReads), curProgress.numReads );
3881
+ cost_type legacyReadCost = getLegacyReadCost (subfile->queryAttributes (), subfile);
3882
+ subfile->addAttrValue (getDFUQResultFieldName (DFUQRFreadCost), legacyReadCost + curReadCost);
3877
3883
totalReadCost += curReadCost;
3878
3884
}
3879
3885
else
@@ -3887,20 +3893,14 @@ void FileSprayer::updateTargetProperties()
3887
3893
{
3888
3894
totalReadCost = calcFileAccessCost (distributedSource, 0 , totalNumReads);
3889
3895
}
3890
- DistributedFilePropertyLock lock (distributedSource);
3891
- IPropertyTree &curProps = lock.queryAttributes ();
3892
- stat_type prevNumReads = curProps.getPropInt64 (getDFUQResultFieldName (DFUQRFnumDiskReads), 0 );
3893
- cost_type legacyReadCost = getLegacyReadCost (curProps, distributedSource);
3894
- cost_type prevReadCost = curProps.getPropInt64 (getDFUQResultFieldName (DFUQRFreadCost), 0 );
3895
- curProps.setPropInt64 (getDFUQResultFieldName (DFUQRFnumDiskReads), prevNumReads + totalNumReads);
3896
- curProps.setPropInt64 (getDFUQResultFieldName (DFUQRFreadCost), legacyReadCost + prevReadCost + totalReadCost);
3896
+ distributedSource->addAttrValue (getDFUQResultFieldName (DFUQRFnumDiskReads), totalNumReads);
3897
+ cost_type legacyReadCost = getLegacyReadCost (distributedSource->queryAttributes (), distributedSource);
3898
+ distributedSource->addAttrValue (getDFUQResultFieldName (DFUQRFreadCost), legacyReadCost + totalReadCost);
3899
+ return totalReadCost; // return the total cost of this file operation (exclude previous and legacy read costs)
3897
3900
}
3898
- progressReport->setFileAccessCost (totalReadCost+totalWriteCost);
3899
- if (error)
3900
- throw error.getClear ();
3901
+ return 0 ;
3901
3902
}
3902
3903
3903
-
3904
3904
void FileSprayer::splitAndCollectFileInfo (IPropertyTree * newRecord, RemoteFilename &remoteFileName,
3905
3905
bool isDistributedSource)
3906
3906
{
0 commit comments