Bläddra i källkod

HPCC-9017 Use less kernel page cache for roxie copies, update8

Signed-off-by: Mark Kelly <mark.kelly@lexisnexis.com>
Mark Kelly 11 år sedan
förälder
incheckning
33a83e283d
4 ändrade filer med 14 tillägg och 9 borttagningar
  1. 8 3
      common/remote/sockfile.cpp
  2. 3 3
      dali/ft/fttransform.cpp
  3. 1 1
      system/jlib/jfile.hpp
  4. 2 2
      testing/unittests/jlibtests.cpp

+ 8 - 3
common/remote/sockfile.cpp

@@ -3422,10 +3422,15 @@ public:
         byte mode;
         byte share;
         msg.read(name->text).read(mode).read(share);  
-        // also try to recv extra
+        // also try to recv extra byte
         byte extra = 0;
         if (msg.remaining() >= sizeof(byte))
             msg.read(extra);
+        IFEflags extraFlags = (IFEflags)extra;
+        // none => nocache for remote (hint)
+        // can revert to previous behavior with conf file setting "allow_pgcache_flush=false"
+        if (extraFlags == IFEnone)
+            extraFlags = IFEnocache;
         try {
             Owned<IFile> file = createIFile(name->text);
             switch ((compatIFSHmode)share) {
@@ -3448,8 +3453,8 @@ public:
                 break;
             }
             if (TF_TRACE_PRE_IO)
-                PROGLOG("before open file '%s',  (%d,%d,%d)",name->text.get(),(int)mode,(int)share,(int)extra);
-            IFileIO *fileio = file->open((IFOmode)mode,(IFEflags)extra);
+                PROGLOG("before open file '%s',  (%d,%d,%d)",name->text.get(),(int)mode,(int)share,extraFlags);
+            IFileIO *fileio = file->open((IFOmode)mode,extraFlags);
             int handle;
             if (fileio) {
                 CriticalBlock block(sect);

+ 3 - 3
dali/ft/fttransform.cpp

@@ -92,8 +92,8 @@ size32_t CTransformer::read(size32_t maxLength, void * buffer)
 bool CTransformer::setPartition(RemoteFilename & remoteInputName, offset_t _startOffset, offset_t _length, bool compressedInput, const char *decryptKey)
 {
     CTransformerBase::setPartition(remoteInputName, _startOffset, _length);
-    // if we want spray to not fill page cache use IFEnocache
-    input.setown(inputFile->open(IFOread,IFEnone));
+    // could be cache for local, nocache for mirror
+    input.setown(inputFile->open(IFOread,IFEnocache));
     if (compressedInput) {                          
         Owned<IExpander> expander;
         if (decryptKey&&*decryptKey) {
@@ -825,7 +825,7 @@ processedProgress:
 
             OwnedIFile outFile = createIFile(localFilename.str());
             // if we want spray to not fill page cache use IFEnocache
-            OwnedIFileIO outio = outFile->openShared(IFOcreate,IFSHnone,IFEnone);
+            OwnedIFileIO outio = outFile->openShared(IFOcreate,IFSHnone,IFEnocache);
             if (!outio)
                 throwError1(DFTERR_CouldNotCreateOutput, localFilename.str());
             if (compressOutput) {

+ 1 - 1
system/jlib/jfile.hpp

@@ -40,7 +40,7 @@ enum IFOmode { IFOcreate, IFOread, IFOwrite, IFOreadwrite, IFOcreaterw };    //
 enum IFSHmode { IFSHnone, IFSHread=0x8, IFSHfull=0x10};   // sharing modes
 enum IFSmode { IFScurrent = FILE_CURRENT, IFSend = FILE_END, IFSbegin = FILE_BEGIN };    // seek mode
 enum CFPmode { CFPcontinue, CFPcancel, CFPstop };    // modes for ICopyFileProgress::onProgress return
-enum IFEflags { IFEnone=0x0, IFEnocache=0x1 };
+enum IFEflags { IFEnone=0x0, IFEnocache=0x1, IFEcache=0x2 };    // mask
 class CDateTime;
 
 interface IDirectoryIterator : extends IIteratorOf<IFile> 

+ 2 - 2
testing/unittests/jlibtests.cpp

@@ -155,7 +155,7 @@ protected:
 
             unsigned st = msTick();
 
-            IFEflags extraFlags = IFEnone;
+            IFEflags extraFlags = IFEcache;
             if (j==1)
                 extraFlags = IFEnocache;
             ifileio = ifile->open(IFOcreate, extraFlags);
@@ -183,7 +183,7 @@ protected:
 
             st = msTick();
 
-            extraFlags = IFEnone;
+            extraFlags = IFEcache;
             if (j==1)
                 extraFlags = IFEnocache;
             ifileio = ifile->open(IFOread, extraFlags);