Skip to content

Commit

Permalink
Move roxierow to roxiemem
Browse files Browse the repository at this point in the history
Separation of roxiemem from roxiehelper, didn't need latter in other
engines, e.g. Thor.

Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed May 4, 2012
1 parent f048d9d commit 9242b6f
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 32 deletions.
4 changes: 2 additions & 2 deletions common/roxiehelper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
1 change: 1 addition & 0 deletions common/roxiehelper/roxiedebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
############################################################################## */

#include "jexcept.hpp"
#include "roxie.hpp"
#include "roxiehelper.hpp"
#include "roxiedebug.hpp"
#include "portlist.h"
Expand Down
1 change: 1 addition & 0 deletions common/roxiehelper/roxiehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
############################################################################## */

#include "jexcept.hpp"
#include "roxie.hpp"
#include "roxiehelper.hpp"
#include "roxielmj.hpp"

Expand Down
2 changes: 1 addition & 1 deletion roxie/ccd/ccdserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7367,7 +7367,7 @@ class CSpillingQuickSortAlgorithm : implements ISortAlgorithm, implements roxiem
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");
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions roxie/roxie/roxie.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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




Expand Down
22 changes: 13 additions & 9 deletions roxie/roxiemem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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}
)

Expand Down
10 changes: 5 additions & 5 deletions roxie/roxiemem/roxiemem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -2244,7 +2244,7 @@ class CChunkingRowManager : public CInterface, implements IRowManager
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");
}
}
}
Expand Down Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion roxie/roxiemem/roxiemem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "jlib.hpp"
#include "jlog.hpp"
#include "jdebug.hpp"
#include "roxie.hpp"
#include "errorlist.h"

#ifdef _WIN32
#ifdef ROXIEMEM_EXPORTS
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions common/roxiehelper/roxierow.hpp → roxie/roxiemem/roxierow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion roxie/roxiemem/roxierowbuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions roxie/udplib/udpsha.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "udpsha.hpp"
#include "jsocket.hpp"
#include "jlog.hpp"
#include "roxie.hpp"
#include "roxiemem.hpp"

#ifdef _WIN32
Expand Down
1 change: 1 addition & 0 deletions roxie/udplib/udptrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "udptrs.hpp"
#include "jsocket.hpp"
#include "jlog.hpp"
#include "roxie.hpp"
#ifdef _WIN32
#include <winsock.h>
#else
Expand Down
2 changes: 2 additions & 0 deletions system/include/errorlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 9242b6f

Please sign in to comment.