فهرست منبع

Move roxierow to roxiemem

Separation of roxiemem from roxiehelper, didn't need latter in other
engines, e.g. Thor.

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Jake Smith 13 سال پیش
والد
کامیت
9242b6f161

+ 2 - 2
common/roxiehelper/CMakeLists.txt

@@ -44,8 +44,8 @@ include_directories (            ./../../system/security/securesocket
 
 ADD_DEFINITIONS( -DROXIEHELPER_EXPORTS -D_USRDLL -DMODULE_PRIORITY=5 )
 
-set ( SRCS roxiehelper.cpp roxiedebug.cpp roxierow.cpp
-           roxiehelper.hpp roxiedebug.hpp roxierow.hpp roxielmj.hpp)
+set ( SRCS roxiehelper.cpp roxiedebug.cpp
+           roxiehelper.hpp roxiedebug.hpp roxielmj.hpp)
 
 HPCC_ADD_LIBRARY( roxiehelper SHARED ${SRCS} )
 install ( TARGETS roxiehelper DESTINATION ${OSSDIR}/lib )

+ 1 - 0
common/roxiehelper/roxiedebug.cpp

@@ -17,6 +17,7 @@
 ############################################################################## */
 
 #include "jexcept.hpp"
+#include "roxie.hpp"
 #include "roxiehelper.hpp"
 #include "roxiedebug.hpp"
 #include "portlist.h"

+ 1 - 0
common/roxiehelper/roxiehelper.cpp

@@ -17,6 +17,7 @@
 ############################################################################## */
 
 #include "jexcept.hpp"
+#include "roxie.hpp"
 #include "roxiehelper.hpp"
 #include "roxielmj.hpp"
 

+ 1 - 1
roxie/ccd/ccdserver.cpp

@@ -7367,7 +7367,7 @@ public:
                 if (!rowsToSort.append(next))
                 {
                     ReleaseRoxieRow(next);
-                    throw MakeStringException(ROXIE_MEMORY_LIMIT_EXCEEDED, "Insufficient memory to append sort row");
+                    throw MakeStringException(ROXIEMM_MEMORY_LIMIT_EXCEEDED, "Insufficient memory to append sort row");
                 }
             }
         }

+ 5 - 5
roxie/roxie/roxie.hpp

@@ -72,10 +72,10 @@
 #define ROXIE_SET_INPUT             ROXIE_ERROR_START+47
 #define ROXIE_SINK                  ROXIE_ERROR_START+48
 #define ROXIE_MISSING_PARAMS        ROXIE_ERROR_START+49
-#define ROXIE_MEMORY_LIMIT_EXCEEDED     ROXIE_ERROR_START+50
-#define ROXIE_MEMORY_POOL_EXHAUSTED     ROXIE_ERROR_START+51
-#define ROXIE_INVALID_MEMORY_ALIGNMENT  ROXIE_ERROR_START+52
-#define ROXIE_HEAP_ERROR                ROXIE_ERROR_START+53
+
+
+
+
 #define ROXIE_CALLBACK_ERROR        ROXIE_ERROR_START+54
 #define ROXIE_UDP_ERROR             ROXIE_ERROR_START+55
 #define ROXIE_LIBRARY_ERROR         ROXIE_ERROR_START+56
@@ -86,7 +86,7 @@
 #define ROXIE_CLIENT_CLOSED         ROXIE_ERROR_START+61
 #define ROXIE_ABORT_ERROR           ROXIE_ERROR_START+62
 #define ROXIE_OPT_REPORTING         ROXIE_ERROR_START+63
-#define ROXIE_LARGE_MEMORY_EXHAUSTED ROXIE_ERROR_START+64
+
 
 
 

+ 13 - 9
roxie/roxiemem/CMakeLists.txt

@@ -25,21 +25,23 @@
 project( roxiemem ) 
 
 set (    SRCS 
+         roxierow.cpp
          roxiemem.cpp 
          roxierowbuff.cpp
     )
          
 set (    INCLUDES
-         roxiemem.hpp 
+         roxierow.hpp
+         roxiemem.hpp
          roxierowbuff.hpp
     )
 
-include_directories ( 
-         ./../../system/include 
-         ./../../system/jlib 
-         ./../../roxie/roxie 
-         ./../../roxie/ccd
-         ./../../rtl/include 
+include_directories (
+         ./../../system/include
+         ./../../system/jlib
+         ./../../rtl/include
+         ./../../rtl/eclrtl
+         ./../../common/thorhelper
     )
 
 ADD_DEFINITIONS( -D_USRDLL -DROXIEMEM_EXPORTS)
@@ -49,8 +51,10 @@ endif (${CMAKE_COMPILER_IS_GNUCXX})
 
 HPCC_ADD_LIBRARY( roxiemem SHARED ${SRCS} ${INCLUDES})
 install ( TARGETS roxiemem DESTINATION ${OSSDIR}/lib )
-target_link_libraries ( roxiemem 
-         jlib 
+target_link_libraries ( roxiemem
+         jlib
+         thorhelper
+         eclrtl
          ${CPPUNIT_LIBRARIES}
     )
 

+ 5 - 5
roxie/roxiemem/roxiemem.cpp

@@ -80,7 +80,7 @@ Some thoughts on improving this memory manager:
 //================================================================================
 // Allocation of aligned blocks from os
 
-#define HEAPERROR(a) throw MakeStringException(ROXIE_HEAP_ERROR, a)
+#define HEAPERROR(a) throw MakeStringException(ROXIEMM_HEAP_ERROR, a)
 
 #ifdef _DEBUG
 const unsigned maxLeakReport = 20;
@@ -328,7 +328,7 @@ static StringBuffer &memmap(StringBuffer &stats)
 static void throwHeapExhausted(unsigned pages)
 {
     DBGLOG("RoxieMemMgr: Memory pool (%u pages) exhausted requested %u", heapTotalPages, pages);
-    throw MakeStringException(ROXIE_MEMORY_POOL_EXHAUSTED, "Memory pool exhausted");
+    throw MakeStringException(ROXIEMM_MEMORY_POOL_EXHAUSTED, "Memory pool exhausted");
 }
 
 static void *suballoc_aligned(size32_t pages, bool returnNullWhenExhausted)
@@ -372,7 +372,7 @@ static void *suballoc_aligned(size32_t pages, bool returnNullWhenExhausted)
                     if (returnNullWhenExhausted)
                         return NULL;
                     DBGLOG("RoxieMemMgr: Request for large memory denied (%u..%u)", heapLargeBlocks, largeBlocksRequired);
-                    throw MakeStringException(ROXIE_LARGE_MEMORY_EXHAUSTED, "Memory pool exhausted");
+                    throw MakeStringException(ROXIEMM_LARGE_MEMORY_EXHAUSTED, "Memory pool exhausted");
                 }
 
                 heapLargeBlocks = largeBlocksRequired;
@@ -2244,7 +2244,7 @@ public:
                     if (numHeapPages == atomic_read(&totalHeapPages))
                     {
                         logctx.CTXLOG("RoxieMemMgr: Memory limit exceeded - current %u, requested %u, limit %u", pageCount, numRequested, pageLimit);
-                        throw MakeStringException(ROXIE_MEMORY_LIMIT_EXCEEDED, "memory limit exceeded");
+                        throw MakeStringException(ROXIEMM_MEMORY_LIMIT_EXCEEDED, "memory limit exceeded");
                     }
                 }
             }
@@ -2930,7 +2930,7 @@ extern void setDataAlignmentSize(unsigned size)
     if (size==0x400 || size==0x2000)
         DATA_ALIGNMENT_SIZE = size;
     else
-        throw MakeStringException(ROXIE_INVALID_MEMORY_ALIGNMENT, "Invalid parameter to setDataAlignmentSize %u", size);
+        throw MakeStringException(ROXIEMM_INVALID_MEMORY_ALIGNMENT, "Invalid parameter to setDataAlignmentSize %u", size);
 }
 
 } // namespace roxiemem

+ 8 - 1
roxie/roxiemem/roxiemem.hpp

@@ -21,7 +21,7 @@
 #include "jlib.hpp"
 #include "jlog.hpp"
 #include "jdebug.hpp"
-#include "roxie.hpp"
+#include "errorlist.h"
 
 #ifdef _WIN32
  #ifdef ROXIEMEM_EXPORTS
@@ -33,6 +33,13 @@
  #define roxiemem_decl
 #endif
 
+#define ROXIEMM_MEMORY_LIMIT_EXCEEDED     ROXIEMM_ERROR_START
+#define ROXIEMM_MEMORY_POOL_EXHAUSTED     ROXIEMM_ERROR_START+1
+#define ROXIEMM_INVALID_MEMORY_ALIGNMENT  ROXIEMM_ERROR_START+2
+#define ROXIEMM_HEAP_ERROR                ROXIEMM_ERROR_START+3
+#define ROXIEMM_LARGE_MEMORY_EXHAUSTED    ROXIEMM_ERROR_START+4
+
+
 //Use for asserts that are highly unlikely to occur, and would likely to be reproduced in debug mode.
 #ifdef _DEBUG
 #define dbgassertex(x) assertex(x)

+ 4 - 1
common/roxiehelper/roxierow.cpp

@@ -17,8 +17,11 @@
 ############################################################################## */
 
 #include "jexcept.hpp"
+#include "jcrc.hpp"
+
+#include "thorcommon.ipp" // for CachedOutputMetaData
+
 #include "roxierow.hpp"
-#include "thorcommon.ipp"
 
 //Classes can be used to configure the allocator, and add extra data to the end.
 //The checking needs to be done by setting a bit in the allocatorid

+ 7 - 7
common/roxiehelper/roxierow.hpp

@@ -20,13 +20,13 @@
 #define _ROXIEROW_INCL
 
 #ifdef _WIN32
- #ifdef ROXIEHELPER_EXPORTS
-  #define ROXIEHELPER_API __declspec(dllexport)
+ #ifdef ROXIEMEM_EXPORTS
+  #define roxiemem_decl __declspec(dllexport)
  #else
-  #define ROXIEHELPER_API __declspec(dllimport)
+  #define roxiemem_decl __declspec(dllimport)
  #endif
 #else
- #define ROXIEHELPER_API
+ #define roxiemem_decl
 #endif
 
 #include "roxiemem.hpp"
@@ -35,10 +35,10 @@
 #define ALLOCATORID_CHECK_MASK  0x00300000
 #define ALLOCATORID_MASK                0x000fffff
 
-extern ROXIEHELPER_API IEngineRowAllocator * createRoxieRowAllocator(roxiemem::IRowManager & _rowManager, IOutputMetaData * _meta, unsigned _activityId, unsigned _allocatorId, bool packed);
-extern ROXIEHELPER_API IEngineRowAllocator * createCrcRoxieRowAllocator(roxiemem::IRowManager & rowManager, IOutputMetaData * meta, unsigned activityId, unsigned allocatorId, bool packed);
+extern roxiemem_decl IEngineRowAllocator * createRoxieRowAllocator(roxiemem::IRowManager & _rowManager, IOutputMetaData * _meta, unsigned _activityId, unsigned _allocatorId, bool packed);
+extern roxiemem_decl IEngineRowAllocator * createCrcRoxieRowAllocator(roxiemem::IRowManager & rowManager, IOutputMetaData * meta, unsigned activityId, unsigned allocatorId, bool packed);
 
-extern ROXIEHELPER_API bool isRowCheckValid(unsigned allocatorId, const void * row);
+extern roxiemem_decl bool isRowCheckValid(unsigned allocatorId, const void * row);
 
 //Inline call which avoids the call if no row checking is enabled.
 inline bool RoxieRowCheckValid(unsigned allocatorId, const void * row)

+ 1 - 1
roxie/roxiemem/roxierowbuff.cpp

@@ -167,7 +167,7 @@ bool DynamicRoxieOutputRowArray::ensure(rowidx_t requiredRows)
     {
         //Pahological cases - not enough memory to reallocate the target row buffer, or no contiguous pages available.
         unsigned code = e->errorCode();
-        if ((code == ROXIE_MEMORY_LIMIT_EXCEEDED) || (code == ROXIE_MEMORY_POOL_EXHAUSTED))
+        if ((code == ROXIEMM_MEMORY_LIMIT_EXCEEDED) || (code == ROXIEMM_MEMORY_POOL_EXHAUSTED))
         {
             e->Release();
             return false;

+ 1 - 0
roxie/udplib/udpsha.cpp

@@ -20,6 +20,7 @@
 #include "udpsha.hpp"
 #include "jsocket.hpp"
 #include "jlog.hpp"
+#include "roxie.hpp"
 #include "roxiemem.hpp"
 
 #ifdef _WIN32

+ 1 - 0
roxie/udplib/udptrs.cpp

@@ -21,6 +21,7 @@
 #include "udptrs.hpp"
 #include "jsocket.hpp"
 #include "jlog.hpp"
+#include "roxie.hpp"
 #ifdef _WIN32
 #include <winsock.h>
 #else

+ 2 - 0
system/include/errorlist.h

@@ -32,6 +32,8 @@
 #define ECL_WARN_START          1000
 #define ECL_WARN_END            1099
 
+#define ROXIEMM_ERROR_START     1300
+
 #define ROXIE_ERROR_START      1400   // roxie is already using this start value
 #define ROXIE_ERROR_END        1799