From 19c68c08bc018c0cd296abda895754e16f64c890 Mon Sep 17 00:00:00 2001 From: ahodgkinson Date: Thu, 3 Aug 2006 19:24:27 +0000 Subject: [PATCH] FLAIM Changes. Added support for HP-UX built with the native compiler (aCC). Added code to pre-extend the database file(s) when forcing a checkpoint. git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@733 0109f412-320b-0410-ab79-c3e0c5ffbbe6 --- flaim/Makefile | 40 +++++++++++++++++++++++++++++++++------- flaim/src/flaimsys.h | 2 ++ flaim/src/flbackup.cpp | 1 - flaim/src/flchkdb.cpp | 2 +- flaim/src/flcreate.cpp | 12 ++++++++++-- flaim/src/flopen.cpp | 6 ------ flaim/src/fquery.h | 2 +- flaim/src/frebuild.cpp | 1 - flaim/src/fsnext.cpp | 2 +- flaim/src/fsysdata.cpp | 13 +++++++++++++ flaim/src/rfl.cpp | 14 ++++++-------- flaim/src/scache.cpp | 15 +++++++++++++-- flaim/util/view.cpp | 2 -- 13 files changed, 80 insertions(+), 32 deletions(-) diff --git a/flaim/Makefile b/flaim/Makefile index 30ad6da..2f3db29 100644 --- a/flaim/Makefile +++ b/flaim/Makefile @@ -185,6 +185,12 @@ ifndef host_os_family endif endif +ifndef host_os_family + ifneq (,$(findstring HP-UX,$(OSTYPE))) + host_os_family = hpux + endif +endif + ifndef host_os_family $(error Host operating system could not be determined. You may need to export OSTYPE from the environment.) endif @@ -305,12 +311,19 @@ ifeq (,$(HOSTTYPE)) endif ifeq (,$(HOSTTYPE)) - HOSTTYPE := $(shell uname -p) - ifneq (,$(findstring nvalid,$(HOSTTYPE))) - HOSTTYPE := $(shell uname -m) + ifneq ($(host_os_family),hpux) + HOSTTYPE := $(shell uname -p) endif - ifneq (,$(findstring unknown,$(HOSTTYPE))) + ifeq (,$(HOSTTYPE)) HOSTTYPE := $(shell uname -m) + else + ifneq (,$(findstring nvalid,$(HOSTTYPE))) + HOSTTYPE := $(shell uname -m) + else + ifneq (,$(findstring unknown,$(HOSTTYPE))) + HOSTTYPE := $(shell uname -m) + endif + endif endif endif @@ -985,9 +998,19 @@ ifdef unix_target ifeq ($(target_os_family),hpux) ifeq ($(usenativecc),yes) - # Must support 64 bit file sizes - even for 32 bit builds. - - ccdefs += _LARGEFILE_SOURCE _FILE_OFFSET_BITS=64 + + # Disable "Placement operator delete invocation is not yet + # implemented" warning + + ccflags += +W930 + + ifeq ($(target_word_size),64) + ccflags += +DD64 + else + # Must support 64 bit file sizes - even for 32 bit builds. + + ccdefs += _LARGEFILE_SOURCE _FILE_OFFSET_BITS=64 + endif endif endif @@ -1069,6 +1092,9 @@ ifdef unix_target endif ifeq ($(target_os_family),hpux) + ifeq ($(target_word_size),64) + link_flags += +DD64 + endif lib_link_libs += -lm -lc -lrt -lcurses exe_link_libs += -lm -lc -lrt -lcurses endif diff --git a/flaim/src/flaimsys.h b/flaim/src/flaimsys.h index a89da73..2915f4d 100644 --- a/flaim/src/flaimsys.h +++ b/flaim/src/flaimsys.h @@ -2603,6 +2603,8 @@ public: FLMUINT uiFileNumber, char * pszPath); + FLMUINT64 FLMAPI getMaxFileSize( void); + static void bldSuperFileExtension( FLMUINT uiVersionNum, FLMUINT uiFileNum, diff --git a/flaim/src/flbackup.cpp b/flaim/src/flbackup.cpp index 295059b..f09f7f6 100644 --- a/flaim/src/flbackup.cpp +++ b/flaim/src/flbackup.cpp @@ -1821,7 +1821,6 @@ FSTATIC RCODE flmRestoreFile( goto Exit; } - pSFile->setBlockSize( uiBlockSize); *ppSFile = pSFile; (*ppSFile)->AddRef(); } diff --git a/flaim/src/flchkdb.cpp b/flaim/src/flchkdb.cpp index e11fecf..f2c01a5 100644 --- a/flaim/src/flchkdb.cpp +++ b/flaim/src/flchkdb.cpp @@ -4128,7 +4128,7 @@ FSTATIC RCODE chkSetupLfTable( goto Exit; } - pLogicalFile->pIfd = (IFD *) (&pLogicalFile->pIxd[1]); + pLogicalFile->pIfd = (IFD *)((void *)(&pLogicalFile->pIxd[1])); f_memcpy( pLogicalFile->pIxd, pTmpIxd, sizeof(IXD)); f_memcpy( pLogicalFile->pIfd, pTmpIfd, sizeof(IFD) * pTmpIxd->uiNumFlds); diff --git a/flaim/src/flcreate.cpp b/flaim/src/flcreate.cpp index e727b45..409fd58 100644 --- a/flaim/src/flcreate.cpp +++ b/flaim/src/flcreate.cpp @@ -112,6 +112,7 @@ RCODE flmCreateNewFile( RCODE rc = FERR_OK; FDB * pDb = NULL; FFILE * pFile; + FLMUINT uiMaxFileSize; FLMBOOL bFileCreated = FALSE; FLMBOOL bNewFile = FALSE; FLMBOOL bMutexLocked = FALSE; @@ -259,6 +260,15 @@ RCODE flmCreateNewFile( flmAssert( !pDb->pSFileHdl); flmAssert( pFile->FileHdr.uiVersionNum); + + if( pFile->FileHdr.uiVersionNum >= FLM_FILE_FORMAT_VER_4_3) + { + uiMaxFileSize = gv_FlmSysData.uiMaxFileSize; + } + else + { + uiMaxFileSize = MAX_FILE_SIZE_VER40; + } if( (pDb->pSFileHdl = f_new F_SuperFileHdl) == NULL) { @@ -285,8 +295,6 @@ RCODE flmCreateNewFile( goto Exit; } - pDb->pSFileHdl->setBlockSize( pFile->FileHdr.uiBlockSize); - // Create the .db file. if( RC_BAD( rc = pDb->pSFileHdl->createFile( 0))) diff --git a/flaim/src/flopen.cpp b/flaim/src/flopen.cpp index 2c99210..28f26f7 100644 --- a/flaim/src/flopen.cpp +++ b/flaim/src/flopen.cpp @@ -644,8 +644,6 @@ RCODE flmOpenFile( { goto Exit; } - - pDb->pSFileHdl->setBlockSize( pFile->FileHdr.uiBlockSize); } if (bNewFile && !(uiOpenFlags & FO_DONT_REDO_LOG)) @@ -1027,8 +1025,6 @@ FSTATIC RCODE flmPhysFileOpen( goto Exit; } - pDb->pSFileHdl->setBlockSize( pFile->FileHdr.uiBlockSize); - // We must have exclusive access. Create a lock file for that // purpose, if there is not already a lock file. @@ -1569,8 +1565,6 @@ RCODE flmStartCPThread( goto Exit; } - pCPInfo->pSFileHdl->setBlockSize( pFile->FileHdr.uiBlockSize); - if( RC_BAD( rc = flmStatInit( &pCPInfo->Stats, FALSE))) { goto Exit; diff --git a/flaim/src/fquery.h b/flaim/src/fquery.h index 896a9dc..0400a53 100644 --- a/flaim/src/fquery.h +++ b/flaim/src/fquery.h @@ -49,7 +49,7 @@ class FSDataCursor; #define FLM_RESULT_MASK 0xF00 #define FLM_SET_RESULT(uiStatus,uiResult) \ - ((uiStatus) = ((uiStatus) & (~(FLM_RESULT_MASK))) | ((uiResult) << 8)) + ((uiStatus) = ((uiStatus) & (~(FLM_RESULT_MASK))) | (FLMUINT)((uiResult) << 8)) #define FLM_GET_RESULT(uiStatus) \ (FLMUINT)(((uiStatus) & (FLM_RESULT_MASK)) >> 8) diff --git a/flaim/src/frebuild.cpp b/flaim/src/frebuild.cpp index a9c21a2..b31de79 100644 --- a/flaim/src/frebuild.cpp +++ b/flaim/src/frebuild.cpp @@ -2470,7 +2470,6 @@ FLMEXP RCODE FLMAPI FlmDbRebuild( goto Exit; } - pSFileHdl->setBlockSize( pCreateOpts->uiBlockSize); pRebuildState->pSFileHdl = pSFileHdl; // Calculate the file size. diff --git a/flaim/src/fsnext.cpp b/flaim/src/fsnext.cpp index bc5351d..a2b15ba 100644 --- a/flaim/src/fsnext.cpp +++ b/flaim/src/fsnext.cpp @@ -467,7 +467,7 @@ FLMUINT FSGetDomain( { curElm += BBE_GET_KL( curElm) + uiElmOvhd; uiDinDomain = ((FLMUINT) * curElm++) << 16; - uiDinDomain |= ((FLMUINT16) * curElm++) << 8; + uiDinDomain |= (FLMUINT)(((FLMUINT16) * curElm++) << 8); uiDinDomain |= *curElm++; } } diff --git a/flaim/src/fsysdata.cpp b/flaim/src/fsysdata.cpp index e717cf5..47574d5 100644 --- a/flaim/src/fsysdata.cpp +++ b/flaim/src/fsysdata.cpp @@ -4237,6 +4237,19 @@ FLMUINT FLMAPI F_SuperFileClient::getBlockAddress( return( FSBlkAddress( uiFileNumber, uiFileOffset)); } +/**************************************************************************** +Desc: +****************************************************************************/ +FLMUINT64 FLMAPI F_SuperFileClient::getMaxFileSize( void) +{ + if( m_uiDbVersion >= FLM_FILE_FORMAT_VER_4_3) + { + return( gv_FlmSysData.uiMaxFileSize); + } + + return( MAX_FILE_SIZE_VER40); +} + /**************************************************************************** Desc: ****************************************************************************/ diff --git a/flaim/src/rfl.cpp b/flaim/src/rfl.cpp index d8440b3..f8d3fe8 100644 --- a/flaim/src/rfl.cpp +++ b/flaim/src/rfl.cpp @@ -1368,7 +1368,7 @@ RCODE F_Rfl::flush( pBuffer->pIOBuffer->setPending(); rc = m_pFileHdl->write( uiFileOffset, uiBufBytes, - pucOldBuffer, &uiBytesWritten); + pucOldBuffer, &uiBytesWritten); } if( RC_OK( rc)) @@ -1405,16 +1405,13 @@ RCODE F_Rfl::flush( // only have one buffer, we cannot do async writes. flmAssert( !pIOBuffer); + pBuffer->pIOBuffer->notifyComplete( rc); if( RC_OK( rc) && !bFinalWrite) { copyLastBlock( pBuffer, pucOldBuffer, pucOldBuffer, uiCurrPacketLen, bStartingNewFile); } - - // DO NOT call notifyComplete - that would put - // pBuffer->pIOBuffer into the avail list, and we don't want - // that. We simply want to keep reusing it. } else { @@ -1606,8 +1603,7 @@ Desc: Wait for the transaction writes to be finished. RCODE F_Rfl::completeTransWrites( FDB * pDb, FLMBOOL bCommitting, - FLMBOOL bOkToUnlock - ) + FLMBOOL bOkToUnlock) { RCODE rc = FERR_OK; RCODE tmpRc; @@ -1799,7 +1795,7 @@ RCODE F_Rfl::completeTransWrites( goto Exit; } - // Wait for any pending IO off of the log buffer + // Wait for any pending I/O off of the log buffer if (RC_BAD( tmpRc = m_pCommitBuf->pBufferMgr->waitForAllPendingIO())) { @@ -1945,6 +1941,8 @@ FLMBYTE RflCalcChecksum( pucSectionEnd = pucStart + (sizeof( FLMUINT) - ((FLMUINT)pucStart & 0x3)); #endif + flmAssert( pucSectionEnd >= pucStart); + if (pucSectionEnd > pucEnd) { pucSectionEnd = pucEnd; diff --git a/flaim/src/scache.cpp b/flaim/src/scache.cpp index 566059f..30fc86d 100644 --- a/flaim/src/scache.cpp +++ b/flaim/src/scache.cpp @@ -5045,6 +5045,18 @@ FSTATIC RCODE scaWriteSortedBlocks( SCACHE * pSCache; IF_IOBuffer * pIOBuffer = NULL; FLMBYTE * pucBuffer; + + // Extend the database to its new size + + if( bForceCheckpoint && pSFileHdl->canDoDirectIO() && uiNumSortedBlocks > 1) + { + if( RC_BAD( rc = pSFileHdl->allocateBlocks( + pFile->ppBlocksDone[ 0]->uiBlkAddress, + pFile->ppBlocksDone[ uiNumSortedBlocks - 1]->uiBlkAddress))) + { + goto Exit; + } + } uiOffset = 0; for (;;) @@ -6717,8 +6729,7 @@ RCODE ScaLogPhysBlk( // count. if( (FLMUINT)FB2UD( &pucBlkBuf [BH_TRANS_ID]) < - (FLMUINT)FB2UD( - &pFile->ucUncommittedLogHdr [LOG_LAST_BACKUP_TRANS_ID])) + (FLMUINT)FB2UD( &pFile->ucUncommittedLogHdr [LOG_LAST_BACKUP_TRANS_ID])) { flmIncrUint( &pFile->ucUncommittedLogHdr [LOG_BLK_CHG_SINCE_BACKUP], 1); diff --git a/flaim/util/view.cpp b/flaim/util/view.cpp index 113504f..a8086ea 100644 --- a/flaim/util/view.cpp +++ b/flaim/util/view.cpp @@ -658,8 +658,6 @@ Get_File_Name: goto Exit; } - gv_pSFileHdl->setBlockSize( gv_ViewHdrInfo.FileHdr.uiBlockSize); - if( RC_BAD( rc = ViewReadAndVerifyHdrInfo())) { if (rc == FERR_IO_PATH_NOT_FOUND)