diff --git a/CMakeLists.txt b/CMakeLists.txt index e8e70be66..ef0bb09ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -316,11 +316,6 @@ ADD_SUBDIRECTORY(storage-manager) # WriteEngine component tests IF( WITH_SHARED_COMP_TESTS ) - # search for cppunit - INCLUDE (findcppunit.cmake) - if (NOT CPPUNIT_FOUND) - MESSAGE(FATAL_ERROR "CPPUnit not found please install cppunit-devel for CentOS/RedHat or libcppunit-dev for Ubuntu/Debian") - endif() ADD_SUBDIRECTORY(writeengine/shared) ENDIF( WITH_SHARED_COMP_TESTS ) diff --git a/utils/idbdatafile/IDBPolicy.cpp b/utils/idbdatafile/IDBPolicy.cpp index 5bdeb2271..b88c918a5 100644 --- a/utils/idbdatafile/IDBPolicy.cpp +++ b/utils/idbdatafile/IDBPolicy.cpp @@ -296,10 +296,9 @@ void IDBPolicy::configIDBPolicy() if ( setting.length() != 0 ) { - if ( setting.size() == 3 + if ( setting.size() == 2 && ( setting[0] == 'O' || setting[0] == 'o' ) - && ( setting[1] == 'F' || setting[1] == 'f' ) - && ( setting[2] == 'F' || setting[2] == 'f' ) + && ( setting[1] == 'N' || setting[1] == 'n' ) ) { // int into uint16_t implicit conversion @@ -310,7 +309,7 @@ void IDBPolicy::configIDBPolicy() } } -void IDBPolicy::setPreallocSpace(uint16_t dbRoot) +void IDBPolicy::enablePreallocSpace(uint16_t dbRoot) { s_PreallocSpace.push_back(dbRoot); } diff --git a/utils/idbdatafile/IDBPolicy.h b/utils/idbdatafile/IDBPolicy.h index d05415117..11a534da2 100644 --- a/utils/idbdatafile/IDBPolicy.h +++ b/utils/idbdatafile/IDBPolicy.h @@ -89,7 +89,7 @@ public: /** * Checks for disk space preallocation feature status for a dbroot */ - static bool PreallocSpace(uint16_t dbRoot); + static bool PreallocSpaceDisabled(uint16_t dbRoot); /** * Accessor method that returns whether to use HDFS memory buffers @@ -137,7 +137,7 @@ public: /** * This is used in WE shared components Unit Tests */ - static void setPreallocSpace(uint16_t dbRoot); + static void enablePreallocSpace(uint16_t dbRoot); private: /** @@ -178,11 +178,11 @@ bool IDBPolicy::useCloud() // MCOL-498 Looking for dbRoot in the List set in configIDBPolicy. inline -bool IDBPolicy::PreallocSpace(uint16_t dbRoot) +bool IDBPolicy::PreallocSpaceDisabled(uint16_t dbRoot) { std::vector::iterator dbRootIter = find(s_PreallocSpace.begin(), s_PreallocSpace.end(), dbRoot); - return dbRootIter != s_PreallocSpace.end(); + return dbRootIter == s_PreallocSpace.end(); } inline diff --git a/writeengine/shared/shared_components_tests.cpp b/writeengine/shared/shared_components_tests.cpp index e569ecee6..682bf1251 100644 --- a/writeengine/shared/shared_components_tests.cpp +++ b/writeengine/shared/shared_components_tests.cpp @@ -1017,7 +1017,7 @@ public: CPPUNIT_ASSERT(rc == NO_ERROR); - CPPUNIT_ASSERT(bFile->size() == 67108864); + CPPUNIT_ASSERT(bFile->size() == 2105344); fileOp.closeFile(pFile); // file has been extended delete the file before // the second run @@ -1046,8 +1046,8 @@ public: bFile = new idbdatafile::BufferedFile(fileName, "r+b", 0); pFile = dynamic_cast(bFile); - // disable disk space preallocation and extend - idbdatafile::IDBPolicy::setPreallocSpace(dbRoot); + // enable disk space preallocation and extend + idbdatafile::IDBPolicy::enablePreallocSpace(dbRoot); rc = fileOp.initColumnExtent(pFile, dbRoot, BYTE_PER_BLOCK, // number of blocks @@ -1060,7 +1060,7 @@ public: CPPUNIT_ASSERT(rc == NO_ERROR); - CPPUNIT_ASSERT(bFile->size() == 2105344); + CPPUNIT_ASSERT(bFile->size() == 67108864); fileOp.closeFile(pFile); // file has been extended @@ -1114,7 +1114,7 @@ public: false, false ); //enable preallocation // Check the file size and remove the file - CPPUNIT_ASSERT(bFile->size() == 67379200); + CPPUNIT_ASSERT(bFile->size() == 483328); CPPUNIT_ASSERT(rc == NO_ERROR); fileOp.deleteFile( fileName ); CPPUNIT_ASSERT(fileOp.exists( fileName ) == false); @@ -1129,8 +1129,8 @@ public: bFile = (idbdatafile::BufferedFile*)m_dFile; CPPUNIT_ASSERT(m_dFile != NULL); - // disable preallocation and create a Dictionary - idbdatafile::IDBPolicy::setPreallocSpace(dbRoot); + // enable preallocation and create a Dictionary + idbdatafile::IDBPolicy::enablePreallocSpace(dbRoot); m_Dctnry.compressionType(1); rc = m_Dctnry.initDctnryExtent( m_dFile, dbRoot, @@ -1141,7 +1141,7 @@ public: true ); //skip preallocation // Check the size and remove the file. - CPPUNIT_ASSERT(bFile->size() == 483328); + CPPUNIT_ASSERT(bFile->size() == 67379200); CPPUNIT_ASSERT(rc == NO_ERROR); fileOp.deleteFile(fileName); CPPUNIT_ASSERT(fileOp.exists( fileName ) == false); diff --git a/writeengine/shared/we_fileop.cpp b/writeengine/shared/we_fileop.cpp index 1b181ac22..c2426ca2c 100644 --- a/writeengine/shared/we_fileop.cpp +++ b/writeengine/shared/we_fileop.cpp @@ -1081,7 +1081,7 @@ int FileOp::initColumnExtent( // IMO it is better to check bool then to call a function. if ( bOptExtension ) { - bOptExtension = (idbdatafile::IDBPolicy::PreallocSpace(dbRoot)) + bOptExtension = (idbdatafile::IDBPolicy::PreallocSpaceDisabled(dbRoot)) ? bOptExtension : false; } // Reduce number of blocks allocated for abbreviated extents thus @@ -1849,7 +1849,7 @@ int FileOp::initDctnryExtent( // CS doesn't optimize non-compressed dict creation. if ( bOptExtension ) { - bOptExtension = (idbdatafile::IDBPolicy::PreallocSpace(dbRoot) + bOptExtension = (idbdatafile::IDBPolicy::PreallocSpaceDisabled(dbRoot) && m_compressionType) ? bOptExtension : false; } // Reduce number of blocks allocated for abbreviated extents thus