1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-04-18 21:44:02 +03:00

remove winport

This commit is contained in:
Leonid Fedorov 2023-03-02 15:37:11 +00:00
parent 4d4e4ad30d
commit 123c345b40
52 changed files with 0 additions and 8534 deletions

View File

@ -19,7 +19,6 @@ add_subdirectory(ddlcleanup)
add_subdirectory(querystats)
add_subdirectory(windowfunction)
add_subdirectory(idbdatafile)
add_subdirectory(winport)
add_subdirectory(querytele)
add_subdirectory(libmysql_client)
add_subdirectory(regr)

View File

@ -56,8 +56,6 @@
#include "branchpred.h"
#include "datatypes/mcs_int128.h"
#include "../winport/winport.h"
#include "collation.h"
#include "common/hashfamily.h"

View File

@ -35,7 +35,6 @@
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
#include <atomic>
#include "../winport/winport.h"
#include "primitives/primproc/umsocketselector.h"
#include "atomicops.h"

View File

@ -1,3 +0,0 @@
include_directories( ${ENGINE_COMMON_INCLUDES} )

View File

@ -1,207 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Calpont Version="V1.0.0">
<ExeMgr1>
<IPAddr>127.0.0.1</IPAddr>
<Port>8601</Port>
</ExeMgr1>
<DDLProc>
<IPAddr>127.0.0.1</IPAddr>
<Port>8612</Port>
</DDLProc>
<DMLProc>
<IPAddr>127.0.0.1</IPAddr>
<Port>8614</Port>
</DMLProc>
<pm1_WriteEngineServer>
<IPAddr>127.0.0.1</IPAddr>
<Port>8630</Port>
</pm1_WriteEngineServer>
<BatchInsert>
<RowsPerBatch>10000</RowsPerBatch>
</BatchInsert>
<PrimitiveServers>
<Count>1</Count>
<ConnectionsPerPrimProc>2</ConnectionsPerPrimProc>
<ProcessorThreshold>128</ProcessorThreshold>
<ProcessorQueueSize>10K</ProcessorQueueSize>
<DebugLevel>0</DebugLevel>
<LBID_Shift>13</LBID_Shift>
<ColScanBufferSizeBlocks>512</ColScanBufferSizeBlocks>
<ColScanReadAheadBlocks>512</ColScanReadAheadBlocks>
<PrefetchThreshold>5</PrefetchThreshold>
<PTTrace>0</PTTrace>
<RotatingDestination>n</RotatingDestination>
</PrimitiveServers>
<PMS1>
<IPAddr>127.0.0.1</IPAddr>
<Port>8620</Port>
</PMS1>
<PMS2>
<IPAddr>127.0.0.1</IPAddr>
<Port>8620</Port>
</PMS2>
<SystemConfig>
<SystemName>WInfiniDB</SystemName>
<ParentOAMModuleName>pm1</ParentOAMModuleName>
<ModuleHeartbeatPeriod>10</ModuleHeartbeatPeriod>
<ModuleHeartbeatCount>3</ModuleHeartbeatCount>
<DBRootCount>1</DBRootCount>
<DBRoot1>$INSTALLDIR/data1</DBRoot1>
<DBRMRoot>$INSTALLDIR/dbrm/BRM_saves</DBRMRoot>
<TempDiskPath>$INSTALLDIR/tmp</TempDiskPath>
<WorkingDir>$INSTALLDIR</WorkingDir>
<TableLockSaveFile>$INSTALLDIR/dbrm/tablelocks</TableLockSaveFile>
<TransactionArchivePeriod>10</TransactionArchivePeriod>
<TempSaveSize>128M</TempSaveSize>
<WaitPeriod>10</WaitPeriod>
</SystemConfig>
<SystemModuleConfig>
<ModuleType1>dm</ModuleType1>
<ModuleDesc1>Director Module</ModuleDesc1>
<RunType1>SIMPLEX</RunType1>
<ModuleCount1>0</ModuleCount1>
<ModuleIPAddr1-1-1>0.0.0.0</ModuleIPAddr1-1-1>
<ModuleHostName1-1-1>unassigned</ModuleHostName1-1-1>
<ModuleDisableState1-1>ENABLED</ModuleDisableState1-1>
<ModuleCPUCriticalThreshold1>90</ModuleCPUCriticalThreshold1>
<ModuleCPUMajorThreshold1>80</ModuleCPUMajorThreshold1>
<ModuleCPUMinorThreshold1>70</ModuleCPUMinorThreshold1>
<ModuleCPUMinorClearThreshold1>60</ModuleCPUMinorClearThreshold1>
<ModuleDiskCriticalThreshold1>90</ModuleDiskCriticalThreshold1>
<ModuleDiskMajorThreshold1>80</ModuleDiskMajorThreshold1>
<ModuleDiskMinorThreshold1>70</ModuleDiskMinorThreshold1>
<ModuleMemCriticalThreshold1>90</ModuleMemCriticalThreshold1>
<ModuleMemMajorThreshold1>80</ModuleMemMajorThreshold1>
<ModuleMemMinorThreshold1>70</ModuleMemMinorThreshold1>
<ModuleSwapCriticalThreshold1>90</ModuleSwapCriticalThreshold1>
<ModuleSwapMajorThreshold1>80</ModuleSwapMajorThreshold1>
<ModuleSwapMinorThreshold1>70</ModuleSwapMinorThreshold1>
<ModuleDiskMonitorFileSystem1-1>/</ModuleDiskMonitorFileSystem1-1>
<ModuleDBRootCount1-1>0</ModuleDBRootCount1-1>
<ModuleDBRootID1-1-1>0</ModuleDBRootID1-1-1>
<ModuleType2>um</ModuleType2>
<ModuleDesc2>User Module</ModuleDesc2>
<RunType2>LOADSHARE</RunType2>
<ModuleCount2>0</ModuleCount2>
<ModuleIPAddr1-1-2>0.0.0.0</ModuleIPAddr1-1-2>
<ModuleHostName1-1-2>unassigned</ModuleHostName1-1-2>
<ModuleDisableState1-2>ENABLED</ModuleDisableState1-2>
<ModuleCPUCriticalThreshold2>90</ModuleCPUCriticalThreshold2>
<ModuleCPUMajorThreshold2>80</ModuleCPUMajorThreshold2>
<ModuleCPUMinorThreshold2>70</ModuleCPUMinorThreshold2>
<ModuleCPUMinorClearThreshold2>60</ModuleCPUMinorClearThreshold2>
<ModuleDiskCriticalThreshold2>90</ModuleDiskCriticalThreshold2>
<ModuleDiskMajorThreshold2>80</ModuleDiskMajorThreshold2>
<ModuleDiskMinorThreshold2>70</ModuleDiskMinorThreshold2>
<ModuleMemCriticalThreshold2>90</ModuleMemCriticalThreshold2>
<ModuleMemMajorThreshold2>80</ModuleMemMajorThreshold2>
<ModuleMemMinorThreshold2>70</ModuleMemMinorThreshold2>
<ModuleSwapCriticalThreshold2>90</ModuleSwapCriticalThreshold2>
<ModuleSwapMajorThreshold2>80</ModuleSwapMajorThreshold2>
<ModuleSwapMinorThreshold2>70</ModuleSwapMinorThreshold2>
<ModuleDiskMonitorFileSystem1-2>/</ModuleDiskMonitorFileSystem1-2>
<ModuleDBRootCount1-2>0</ModuleDBRootCount1-2>
<ModuleDBRootID1-1-2>0</ModuleDBRootID1-1-2>
<ModuleType3>pm</ModuleType3>
<ModuleDesc3>Performance Module</ModuleDesc3>
<RunType3>SIMPLEX</RunType3>
<ModuleCount3>1</ModuleCount3>
<ModuleIPAddr1-1-3>127.0.0.1</ModuleIPAddr1-1-3>
<ModuleHostName1-1-3>localhost</ModuleHostName1-1-3>
<ModuleDisableState1-3>ENABLED</ModuleDisableState1-3>
<ModuleCPUCriticalThreshold3>90</ModuleCPUCriticalThreshold3>
<ModuleCPUMajorThreshold3>80</ModuleCPUMajorThreshold3>
<ModuleCPUMinorThreshold3>70</ModuleCPUMinorThreshold3>
<ModuleCPUMinorClearThreshold3>60</ModuleCPUMinorClearThreshold3>
<ModuleDiskCriticalThreshold3>90</ModuleDiskCriticalThreshold3>
<ModuleDiskMajorThreshold3>80</ModuleDiskMajorThreshold3>
<ModuleDiskMinorThreshold3>70</ModuleDiskMinorThreshold3>
<ModuleMemCriticalThreshold3>0</ModuleMemCriticalThreshold3>
<ModuleMemMajorThreshold3>0</ModuleMemMajorThreshold3>
<ModuleMemMinorThreshold3>0</ModuleMemMinorThreshold3>
<ModuleSwapCriticalThreshold3>90</ModuleSwapCriticalThreshold3>
<ModuleSwapMajorThreshold3>80</ModuleSwapMajorThreshold3>
<ModuleSwapMinorThreshold3>70</ModuleSwapMinorThreshold3>
<ModuleDiskMonitorFileSystem1-3>/</ModuleDiskMonitorFileSystem1-3>
<ModuleDBRootCount1-3>1</ModuleDBRootCount1-3>
<ModuleDBRootID1-1-3>1</ModuleDBRootID1-1-3>
</SystemModuleConfig>
<SystemExtDeviceConfig>
<Count>0</Count>
<Name1>unassigned</Name1>
<IPAddr1>0.0.0.0</IPAddr1>
<DisableState1>ENABLED</DisableState1>
</SystemExtDeviceConfig>
<SessionManager>
<MaxConcurrentTransactions>1000</MaxConcurrentTransactions>
<SharedMemoryTmpFile>$INSTALLDIR/dbrm/CalpontShm</SharedMemoryTmpFile>
<TxnIDFile>$INSTALLDIR/dbrm/SMTxnID</TxnIDFile>
</SessionManager>
<SessionMonitor>
<SharedMemoryTmpFile>$INSTALLDIR/dbrm/CalpontSessionMonitorShm</SharedMemoryTmpFile>
<TransactionAgeLimit>10</TransactionAgeLimit>
</SessionMonitor>
<VersionBuffer>
<VersionBufferFileSize>1GB</VersionBufferFileSize>
</VersionBuffer>
<OIDManager>
<OIDBitmapFile>$INSTALLDIR/dbrm/oidbitmap</OIDBitmapFile>
<FirstOID>3000</FirstOID>
</OIDManager>
<WriteEngine>
<BulkRoot>$INSTALLDIR/bulk</BulkRoot>
<BulkRollbackDir>$INSTALLDIR/bulk/rollback</BulkRollbackDir>
</WriteEngine>
<DBRM_Controller>
<NumWorkers>1</NumWorkers>
<IPAddr>127.0.0.1</IPAddr>
<Port>8616</Port>
</DBRM_Controller>
<DBRM_Worker1>
<IPAddr>127.0.0.1</IPAddr>
<Port>8700</Port>
<Module>pm1</Module>
</DBRM_Worker1>
<DBBC>
<NumBlocksPct>66</NumBlocksPct>
<IOMTracing>0</IOMTracing>
<BRPTracing>0</BRPTracing>
<ReportFrequency>65536</ReportFrequency>
<MaxOpenFiles>2K</MaxOpenFiles>
<DecreaseOpenFilesCount>200</DecreaseOpenFilesCount>
<FDCacheTrace>0</FDCacheTrace>
</DBBC>
<Installation>
<SystemStartupOffline>n</SystemStartupOffline>
<InitialInstallFlag>y</InitialInstallFlag>
<ServerTypeInstall>2</ServerTypeInstall>
<DBRootStorageType>internal</DBRootStorageType>
<UMStorageType>internal</UMStorageType>
</Installation>
<ExtentMap>
<FilesPerColumnPartition>4</FilesPerColumnPartition>
<ExtentsPerSegmentFile>2</ExtentsPerSegmentFile>
<BRM_UID>0x0</BRM_UID>
</ExtentMap>
<HashJoin>
<MaxBuckets>128</MaxBuckets>
<MaxElems>128K</MaxElems>
<FifoSizeLargeSide>128</FifoSizeLargeSide>
<PmMaxMemorySmallSide>64M</PmMaxMemorySmallSide>
<TotalUmMemory>8G</TotalUmMemory>
<AllowDiskBasedJoin>N</AllowDiskBasedJoin>
<TempFilePath>$INSTALLDIR/tmp</TempFilePath>
<TempFileCompression>Y</TempFileCompression>
</HashJoin>
<JobList>
<FlushInterval>16K</FlushInterval>
<FifoSize>32</FifoSize>
<RequestSize>1</RequestSize>
<MaxOutstandingRequests>5</MaxOutstandingRequests>
</JobList>
<TupleWSDL>
<MaxSize>1M</MaxSize>
<InitialCapacity>1M</InitialCapacity>
<MaxBuckets>512</MaxBuckets>
</TupleWSDL>
</Calpont>

View File

@ -1,328 +0,0 @@
/**
* EnvVarUpdate.nsh
* : Environmental Variables: append, prepend, and remove entries
*
* WARNING: If you use StrFunc.nsh header then include it before this file
* with all required definitions. This is to avoid conflicts
*
* Usage:
* ${EnvVarUpdate} "ResultVar" "EnvVarName" "Action" "RegLoc" "PathString"
*
* Credits:
* Version 1.0
* * Cal Turney (turnec2)
* * Amir Szekely (KiCHiK) and e-circ for developing the forerunners of this
* function: AddToPath, un.RemoveFromPath, AddToEnvVar, un.RemoveFromEnvVar,
* WriteEnvStr, and un.DeleteEnvStr
* * Diego Pedroso (deguix) for StrTok
* * Kevin English (kenglish_hi) for StrContains
* * Hendri Adriaens (Smile2Me), Diego Pedroso (deguix), and Dan Fuhry
* (dandaman32) for StrReplace
*
* Version 1.1 (compatibility with StrFunc.nsh)
* * techtonik
*
* http://nsis.sourceforge.net/Environmental_Variables:_append%2C_prepend%2C_and_remove_entries
*
*/
!ifndef ENVVARUPDATE_FUNCTION
!define ENVVARUPDATE_FUNCTION
!verbose push
!verbose 3
!include "LogicLib.nsh"
!include "WinMessages.NSH"
!include "StrFunc.nsh"
; ---- Fix for conflict if StrFunc.nsh is already includes in main file -----------------------
!macro _IncludeStrFunction StrFuncName
!ifndef ${StrFuncName}_INCLUDED
${${StrFuncName}}
!endif
!ifndef Un${StrFuncName}_INCLUDED
${Un${StrFuncName}}
!endif
!define un.${StrFuncName} "${Un${StrFuncName}}"
!macroend
!insertmacro _IncludeStrFunction StrTok
!insertmacro _IncludeStrFunction StrStr
!insertmacro _IncludeStrFunction StrRep
; ---------------------------------- Macro Definitions ----------------------------------------
!macro _EnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
Push "${EnvVarName}"
Push "${Action}"
Push "${RegLoc}"
Push "${PathString}"
Call EnvVarUpdate
Pop "${ResultVar}"
!macroend
!define EnvVarUpdate '!insertmacro "_EnvVarUpdateConstructor"'
!macro _unEnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
Push "${EnvVarName}"
Push "${Action}"
Push "${RegLoc}"
Push "${PathString}"
Call un.EnvVarUpdate
Pop "${ResultVar}"
!macroend
!define un.EnvVarUpdate '!insertmacro "_unEnvVarUpdateConstructor"'
; ---------------------------------- Macro Definitions end-------------------------------------
;----------------------------------- EnvVarUpdate start----------------------------------------
!define hklm_all_users 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
!define hkcu_current_user 'HKCU "Environment"'
!macro EnvVarUpdate UN
Function ${UN}EnvVarUpdate
Push $0
Exch 4
Exch $1
Exch 3
Exch $2
Exch 2
Exch $3
Exch
Exch $4
Push $5
Push $6
Push $7
Push $8
Push $9
Push $R0
/* After this point:
-------------------------
$0 = ResultVar (returned)
$1 = EnvVarName (input)
$2 = Action (input)
$3 = RegLoc (input)
$4 = PathString (input)
$5 = Orig EnvVar (read from registry)
$6 = Len of $0 (temp)
$7 = tempstr1 (temp)
$8 = Entry counter (temp)
$9 = tempstr2 (temp)
$R0 = tempChar (temp) */
; Step 1: Read contents of EnvVarName from RegLoc
;
; Check for empty EnvVarName
${If} $1 == ""
SetErrors
DetailPrint "ERROR: EnvVarName is blank"
Goto EnvVarUpdate_Restore_Vars
${EndIf}
; Check for valid Action
${If} $2 != "A"
${AndIf} $2 != "P"
${AndIf} $2 != "R"
SetErrors
DetailPrint "ERROR: Invalid Action - must be A, P, or R"
Goto EnvVarUpdate_Restore_Vars
${EndIf}
${If} $3 == HKLM
ReadRegStr $5 ${hklm_all_users} $1 ; Get EnvVarName from all users into $5
${ElseIf} $3 == HKCU
ReadRegStr $5 ${hkcu_current_user} $1 ; Read EnvVarName from current user into $5
${Else}
SetErrors
DetailPrint 'ERROR: Action is [$3] but must be "HKLM" or HKCU"'
Goto EnvVarUpdate_Restore_Vars
${EndIf}
; Check for empty PathString
${If} $4 == ""
SetErrors
DetailPrint "ERROR: PathString is blank"
Goto EnvVarUpdate_Restore_Vars
${EndIf}
; Make sure we've got some work to do
${If} $5 == ""
${AndIf} $2 == "R"
SetErrors
DetailPrint "$1 is empty - Nothing to remove"
Goto EnvVarUpdate_Restore_Vars
${EndIf}
; Step 2: Scrub EnvVar
;
StrCpy $0 $5 ; Copy the contents to $0
; Remove spaces around semicolons (NOTE: spaces before the 1st entry or
; after the last one are not removed here but instead in Step 3)
${If} $0 != "" ; If EnvVar is not empty ...
${Do}
${${UN}StrStr} $7 $0 " ;"
${If} $7 == ""
${ExitDo}
${EndIf}
${${UN}StrRep} $0 $0 " ;" ";" ; Remove '<space>;'
${Loop}
${Do}
${${UN}StrStr} $7 $0 "; "
${If} $7 == ""
${ExitDo}
${EndIf}
${${UN}StrRep} $0 $0 "; " ";" ; Remove ';<space>'
${Loop}
${Do}
${${UN}StrStr} $7 $0 ";;"
${If} $7 == ""
${ExitDo}
${EndIf}
${${UN}StrRep} $0 $0 ";;" ";"
${Loop}
; Remove a leading or trailing semicolon from EnvVar
StrCpy $7 $0 1 0
${If} $7 == ";"
StrCpy $0 $0 "" 1 ; Change ';<EnvVar>' to '<EnvVar>'
${EndIf}
StrLen $6 $0
IntOp $6 $6 - 1
StrCpy $7 $0 1 $6
${If} $7 == ";"
StrCpy $0 $0 $6 ; Change ';<EnvVar>' to '<EnvVar>'
${EndIf}
; DetailPrint "Scrubbed $1: [$0]" ; Uncomment to debug
${EndIf}
/* Step 3. Remove all instances of the target path/string (even if "A" or "P")
$6 = bool flag (1 = found and removed PathString)
$7 = a string (e.g. path) delimited by semicolon(s)
$8 = entry counter starting at 0
$9 = copy of $0
$R0 = tempChar */
${If} $5 != "" ; If EnvVar is not empty ...
StrCpy $9 $0
StrCpy $0 ""
StrCpy $8 0
StrCpy $6 0
${Do}
${${UN}StrTok} $7 $9 ";" $8 "0" ; $7 = next entry, $8 = entry counter
${If} $7 == "" ; If we've run out of entries,
${ExitDo} ; were done
${EndIf} ;
; Remove leading and trailing spaces from this entry (critical step for Action=Remove)
${Do}
StrCpy $R0 $7 1
${If} $R0 != " "
${ExitDo}
${EndIf}
StrCpy $7 $7 "" 1 ; Remove leading space
${Loop}
${Do}
StrCpy $R0 $7 1 -1
${If} $R0 != " "
${ExitDo}
${EndIf}
StrCpy $7 $7 -1 ; Remove trailing space
${Loop}
${If} $7 == $4 ; If string matches, remove it by not appending it
StrCpy $6 1 ; Set 'found' flag
${ElseIf} $7 != $4 ; If string does NOT match
${AndIf} $0 == "" ; and the 1st string being added to $0,
StrCpy $0 $7 ; copy it to $0 without a prepended semicolon
${ElseIf} $7 != $4 ; If string does NOT match
${AndIf} $0 != "" ; and this is NOT the 1st string to be added to $0,
StrCpy $0 $0;$7 ; append path to $0 with a prepended semicolon
${EndIf} ;
IntOp $8 $8 + 1 ; Bump counter
${Loop} ; Check for duplicates until we run out of paths
${EndIf}
; Step 4: Perform the requested Action
;
${If} $2 != "R" ; If Append or Prepend
${If} $6 == 1 ; And if we found the target
DetailPrint "Target is already present in $1. It will be removed and"
${EndIf}
${If} $0 == "" ; If EnvVar is (now) empty
StrCpy $0 $4 ; just copy PathString to EnvVar
${If} $6 == 0 ; If found flag is either 0
${OrIf} $6 == "" ; or blank (if EnvVarName is empty)
DetailPrint "$1 was empty and has been updated with the target"
${EndIf}
${ElseIf} $2 == "A" ; If Append (and EnvVar is not empty),
StrCpy $0 $0;$4 ; append PathString
${If} $6 == 1
DetailPrint "appended to $1"
${Else}
DetailPrint "Target was appended to $1"
${EndIf}
${Else} ; If Prepend (and EnvVar is not empty),
StrCpy $0 $4;$0 ; prepend PathString
${If} $6 == 1
DetailPrint "prepended to $1"
${Else}
DetailPrint "Target was prepended to $1"
${EndIf}
${EndIf}
${Else} ; If Action = Remove
${If} $6 == 1 ; and we found the target
DetailPrint "Target was found and removed from $1"
${Else}
DetailPrint "Target was NOT found in $1 (nothing to remove)"
${EndIf}
${If} $0 == ""
DetailPrint "$1 is now empty"
${EndIf}
${EndIf}
; Step 5: Update the registry at RegLoc with the updated EnvVar and announce the change
;
ClearErrors
${If} $3 == HKLM
WriteRegExpandStr ${hklm_all_users} $1 $0 ; Write it in all users section
${ElseIf} $3 == HKCU
WriteRegExpandStr ${hkcu_current_user} $1 $0 ; Write it to current user section
${EndIf}
IfErrors 0 +4
MessageBox MB_OK|MB_ICONEXCLAMATION "Could not write updated $1 to $3"
DetailPrint "Could not write updated $1 to $3"
Goto EnvVarUpdate_Restore_Vars
; "Export" our change
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
EnvVarUpdate_Restore_Vars:
;
; Restore the user's variables and return ResultVar
Pop $R0
Pop $9
Pop $8
Pop $7
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Push $0 ; Push my $0 (ResultVar)
Exch
Pop $0 ; Restore his $0
FunctionEnd
!macroend ; EnvVarUpdate UN
!insertmacro EnvVarUpdate ""
!insertmacro EnvVarUpdate "un."
;----------------------------------- EnvVarUpdate end----------------------------------------
!verbose pop
!endif

View File

@ -1,323 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include <time.h>
#include <string>
#include <sys/types.h>
#include <map>
#include "boost/filesystem/operations.hpp"
#include "boost/filesystem/path.hpp"
namespace fs = boost::filesystem;
using namespace std;
#include "unistd.h"
#include "stdint.h"
#include "sys/time.h"
#include "syslog.h"
#include "idbregistry.h"
#include "WinSysLog.h"
// WinSyslog class encapsulates what substitutes for the syslog in the
// InfiniDB Windows version.
// Singleton instance
WinSyslog* WinSyslog::fpSysLog = WinSyslog::instance();
// For archive coordination.
// We have two mutexes. Only one will be used. We want to use the inter-process
// mutex name fhMutex. If creation succeeds, we set fbGoodIPMutex so the code knows
// it's good. If we fail, fMutex (Only this processes threads) will be used - it's
// better than nothing.
boost::mutex WinSyslog::fMutex; // Failsafe Intra process mutex
HANDLE WinSyslog::fhMutex; // Interprocess named mutex
bool WinSyslog::fbGoodIPMutex = false;
#define WINSYSLOG_MUTEX_NAME "WinSysLogMutex" // For the Windows Named Mutex
// Constructor, wherein we initialize everything
WinSyslog::WinSyslog() : fLastArchiveTime(0), fLastArchiveDay(0), fLogLineheaderSize(0)
{
fLogDirName = IDBreadRegistry("") + "\\log";
fLogFileName = IDBreadRegistry("") + "\\log\\InfiniDBLog.txt";
fTimeFileName = IDBreadRegistry("") + "\\log\\InfiniDBLastArchive.dat";
// Set up a buffer with all the line header except the timestamp.
// Leave room in the front for the timestamp.
// This header will approximate the linux standard syslog log header.
memset(fLogLineHeader, 0, LOG_BUF_SIZE);
char* pEnd = fLogLineHeader + LOG_BUF_SIZE;
char* pHeader = fLogLineHeader + TIMESTAMP_SIZE;
char exePath[LOG_BUF_SIZE];
DWORD nameSize = (DWORD)(pEnd - pHeader);
GetComputerName(pHeader, &nameSize);
pHeader += nameSize;
*pHeader++ = ' ';
GetModuleFileName(0, exePath, LOG_BUF_SIZE);
_splitpath_s(exePath, NULL, 0, NULL, 0, pHeader, pEnd - pHeader, NULL, 0);
pHeader += strlen(pHeader);
;
*pHeader++ = '[';
int pid = GetCurrentProcessId();
snprintf(pHeader, pEnd - pHeader, "%d", pid);
pHeader += strlen(pHeader);
;
*pHeader++ = ']';
*pHeader++ = ':';
fLogLineheaderSize = (int)(pHeader - fLogLineHeader);
// Set up the date we compare against for archiving.
// This will either be today (if fTimeFileName doesn't exist)
// or the the date stored in fTimeFileName.
time_t now = time(0);
FILE* lf;
lf = fopen(fTimeFileName.c_str(), "r+b");
if (lf == NULL) // First time archiving.
{
fLastArchiveTime = now;
// Persist the timestamp of last archive.
lf = fopen(fTimeFileName.c_str(), "w+b");
if (lf != 0)
{
fwrite(&fLastArchiveTime, sizeof(time_t), 1, lf);
fclose(lf);
}
}
else
{
fread(&fLastArchiveTime, sizeof(time_t), 1, lf);
fclose(lf);
}
struct tm lasttm;
localtime_s(&lasttm, &fLastArchiveTime);
fLastArchiveDay = lasttm.tm_yday;
// Create an interprocess mutex to coordinate the archiving function
fhMutex = CreateMutex(NULL, FALSE, WINSYSLOG_MUTEX_NAME);
if (fhMutex == NULL)
{
syslog(LOG_ERR, "WinSyslog CreateMutex error: %d\n", GetLastError());
}
else
{
fbGoodIPMutex = true;
}
}
WinSyslog::~WinSyslog()
{
CloseHandle(fhMutex);
}
// Log() is called by ::syslog() to actually write stuff to the file
int WinSyslog::Log(int priority, const char* format, va_list& args)
{
struct tm nowtm;
FILE* f;
time_t now = time(0);
localtime_s(&nowtm, &now);
// If now isn't the same day as the last archive date, archve.
if (nowtm.tm_yday != fLastArchiveDay)
{
Archive(nowtm);
}
// Log the line.
strftime(fLogLineHeader, TIMESTAMP_SIZE, "%b %d %H:%M:%S", &nowtm);
fLogLineHeader[TIMESTAMP_SIZE - 1] = ' ';
f = fopen(fLogFileName.c_str(), "a+");
if (f == 0)
return -1;
fwrite(fLogLineHeader, 1, fLogLineheaderSize, f);
vfprintf(f, format, args);
fwrite("\n", 1, 1, f);
fclose(f);
return 0;
}
// Archive() is called by Log() when the date changes
// Here we rename our log file to an archive name and delete
// any old files.
void WinSyslog::Archive(const tm& nowtm)
{
struct tm yesterdaytm;
bool bArchive = true;
time_t writeTime;
char ctimebuf[TIME_BUF_SIZE] = {0};
DWORD dwWaitResult;
char* szError = "";
// Lock it so we don't have two threads archiving.
if (fbGoodIPMutex)
{
// We have a good interprocess mutex. Try for one second to
// lock it. Abandon trying after a second. Something's stuck.
dwWaitResult = WaitForSingleObject(fhMutex, 1000);
switch (dwWaitResult)
{
// The thread got ownership of the mutex. Continue on.
case WAIT_OBJECT_0: break;
// The thread got ownership of an abandoned mutex, most likely because
// some process crashed in the middle of archiving. Continue on.
case WAIT_ABANDONED: break;
// We timed out. Something's not right. Don't archive.
case WAIT_TIMEOUT:
szError = "WinSyslog::Archive WAIT_TIMEOUT";
bArchive = false;
break;
// Horrible failure. Don't archive
case WAIT_FAILED:
szError = "WinSyslog::Archive WAIT_FAILED";
bArchive = false;
break;
}
}
else
{
boost::mutex::scoped_lock lock(fMutex);
}
try
{
// Check to see if any other thread or process already archived.
// If the value in fTimeFileName is different than our saved value
// Then somebody else beat us to it. Don't do it again.
time_t storedLastArchiveTime;
FILE* lf;
lf = fopen(fTimeFileName.c_str(), "r+b");
if (lf != NULL)
{
fread(&storedLastArchiveTime, sizeof(time_t), 1, lf);
fclose(lf);
if (storedLastArchiveTime != fLastArchiveTime)
{
bArchive = false;
}
}
else
{
// If we had something go wrong earlier, and then failed to read the Time file,
// this should prevent retrying to archive every log line.
storedLastArchiveTime = fLastArchiveTime = time(NULL);
}
if (bArchive == false)
{
// Something's not right. Try to set the internals so we don't attempt
// archiving again.
fLastArchiveTime = storedLastArchiveTime;
fLastArchiveDay = nowtm.tm_yday;
if (szError)
{
syslog(LOG_ERR, szError);
}
return;
}
// Get last archive date (usually yesterday)
yesterdaytm = nowtm;
yesterdaytm.tm_mday -= 1; // May be 0. mktime() adjusts accordingly.
time_t yesterday = mktime(&yesterdaytm);
localtime_s(&yesterdaytm, &yesterday);
string archiveFileName = fLogFileName;
size_t tail = archiveFileName.find(".txt");
archiveFileName.erase(tail, 4);
strftime(ctimebuf, TIME_BUF_SIZE, "-%Y-%m-%d.txt", &yesterdaytm);
archiveFileName += ctimebuf;
rename(fLogFileName.c_str(), archiveFileName.c_str());
// Persist the timestamp of last archive. In case of reboot, we
// can still archive properly
lf = fopen(fTimeFileName.c_str(), "w+b");
if (lf != 0)
{
fLastArchiveTime = time(0);
fwrite(&fLastArchiveTime, sizeof(time_t), 1, lf);
fclose(lf);
}
fLastArchiveDay = nowtm.tm_yday;
// Get the dates of all archive files.
fs::path sourceDir(fLogDirName);
fs::directory_iterator iter(sourceDir);
fs::directory_iterator end_iter;
std::multimap<std::time_t, fs::path> fileSet; // Stays sorted
while (iter != end_iter)
{
fs::path archiveFile = *iter;
if (fs::is_regular_file(archiveFile))
{
if (archiveFile.extension() == ".txt")
{
writeTime = fs::last_write_time(archiveFile);
fileSet.insert(make_pair(writeTime, archiveFile));
}
}
++iter;
}
// Delete anything past the first seven newest files
typedef std::multimap<std::time_t, fs::path>::iterator PATH_ITER;
PATH_ITER fileIter = fileSet.begin();
PATH_ITER fileIterEnd = fileSet.end();
std::reverse_iterator<PATH_ITER> revEnd(fileIter);
std::reverse_iterator<PATH_ITER> revIter(fileIterEnd);
int cnt = 0;
for (; revIter != revEnd; ++revIter)
{
if (cnt++ < 7)
continue;
_wunlink(revIter->second.c_str());
}
}
catch (exception& e)
{
syslog(LOG_ERR, "WinSyslog::Archive Exception %s", e.what());
}
catch (...)
{
syslog(LOG_ERR, "WinSyslog::Archive Exception ...");
}
if (fbGoodIPMutex)
{
if (!ReleaseMutex(fhMutex))
syslog(LOG_ERR, "WinSyslog::Archive ReleaseMutex failed %d", GetLastError());
}
}

View File

@ -1,86 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include <boost/thread/mutex.hpp>
#define LOG_BUF_SIZE 256
#define TIMESTAMP_SIZE 16
#define TIME_BUF_SIZE 36
class WinSyslog
{
public:
/**
* @brief dtor
* Might work as private, but not sure.
*/
~WinSyslog();
/**
* @brief Singleton accessor.
* Doesn't need locking because we use early construction.
*/
static WinSyslog* instance()
{
if (!fpSysLog)
fpSysLog = new WinSyslog();
return fpSysLog;
};
int OpenLog()
{
return 0;
};
int CloseLog()
{
return 0;
};
/**
* @brief Logging function.
* Called by ::syslog to do the logging
*/
int Log(int priority, const char* format, va_list& args);
private:
// Disable public construction, destruction and assignment
WinSyslog();
WinSyslog(WinSyslog&);
void operator=(WinSyslog const&);
/**
* @brief Archiving function.
* Called by Log() at midnight to archive the log
* file and create a new one
*/
void Archive(const tm& nowtm);
time_t fLastArchiveTime;
int fLastArchiveDay;
string fLogDirName;
string fLogFileName;
string fTimeFileName;
char fLogLineHeader[LOG_BUF_SIZE];
int fLogLineheaderSize;
// Singleton pointer
static WinSyslog* fpSysLog;
// Synchronize objects for Archiving.
static boost::mutex fMutex;
static HANDLE fhMutex;
static bool fbGoodIPMutex;
};

View File

@ -1 +0,0 @@
#include <winresrc.h>

View File

@ -1,380 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include <iostream>
#include <string>
#include <unistd.h>
#include <io.h>
#include <sys\stat.h>
#include <idbregistry.h>
#include <direct.h>
#include <malloc.h>
#include <fstream>
using namespace std;
#include "syncstream.h"
#include "fixup.h"
using namespace bootstrap;
#include "grepit.h"
using namespace winport;
namespace
{
bool vFlg;
string installDir;
const size_t cmdLineLen = 2 * 1024;
int fixPath()
{
int rc;
string newDir = installDir + "\\bin";
rc = _chdir(newDir.c_str());
return rc;
}
int runIt(const string& pName)
{
char* cmdLine = (char*)_malloca(cmdLineLen);
strncpy_s(cmdLine, cmdLineLen, pName.c_str(), pName.size());
PROCESS_INFORMATION pInfo;
ZeroMemory(&pInfo, sizeof(pInfo));
STARTUPINFO sInfo;
ZeroMemory(&sInfo, sizeof(sInfo));
if (CreateProcess(0, cmdLine, 0, 0, false, 0, 0, 0, &sInfo, &pInfo) == 0)
{
_freea(cmdLine);
return -1;
}
if (WaitForSingleObject(pInfo.hProcess, INFINITE) != WAIT_OBJECT_0)
{
_freea(cmdLine);
return -1;
}
DWORD exitCode;
GetExitCodeProcess(pInfo.hProcess, &exitCode);
if (exitCode != 0)
{
_freea(cmdLine);
return -1;
}
CloseHandle(pInfo.hProcess);
_freea(cmdLine);
return 0;
}
int installMySQL()
{
int rc;
char* cmdLine = (char*)_malloca(cmdLineLen);
sprintf_s(cmdLine, cmdLineLen,
"%s\\bin\\mysqld.exe --defaults-file=%s\\my.ini --bootstrap --loose-skip-innodb < "
"%s\\etc\\win_setup_mysql_part1.sql",
installDir.c_str(), installDir.c_str(), installDir.c_str());
rc = system(cmdLine);
_freea(cmdLine);
return rc;
}
int installIDBConn()
{
int rc;
char* cmdLine = (char*)_malloca(cmdLineLen);
sprintf_s(cmdLine, cmdLineLen,
"%s\\bin\\mysql.exe --defaults-file=%s\\my.ini --user=root --force < "
"%s\\etc\\win_setup_mysql_part2.sql > nul 2>&1",
installDir.c_str(), installDir.c_str(), installDir.c_str());
rc = system(cmdLine);
_freea(cmdLine);
return rc;
}
int installIDBConnStep2()
{
int rc = -1;
char* cmdLine = (char*)_malloca(cmdLineLen);
FILE* p;
bool needAlterTable1 = false;
bool needAlterTable2 = false;
sprintf_s(cmdLine, cmdLineLen,
"%s\\bin\\mysql.exe --defaults-file=%s\\my.ini --user=root --execute=\"describe syscolumn;\" "
"calpontsys 2>&1",
installDir.c_str(), installDir.c_str());
p = _popen(cmdLine, "rt");
if (p == NULL)
goto out;
if (!grepit(syncstream::isyncstream(p), "^compressiontype[ \t].*"))
needAlterTable1 = true;
_pclose(p);
p = _popen(cmdLine, "rt");
if (p == NULL)
goto out;
if (!grepit(syncstream::isyncstream(p), "^nextvalue[ \t].*"))
needAlterTable2 = true;
_pclose(p);
if (needAlterTable1 || needAlterTable2)
{
cout << "Checking InfiniDB components and system catalog for necessary upgrades..." << endl;
// This script needs to be force-fed to mysqld and any errors ignored
if (needAlterTable1)
{
sprintf_s(cmdLine, cmdLineLen,
"%s\\bin\\mysql.exe --defaults-file=%s\\my.ini --user=root --force < "
"%s\\etc\\win_setup_mysql_part3.sql > nul 2>&1",
installDir.c_str(), installDir.c_str(), installDir.c_str());
rc = system(cmdLine);
}
if (needAlterTable2)
{
sprintf_s(cmdLine, cmdLineLen,
"%s\\bin\\mysql.exe --defaults-file=%s\\my.ini --user=root --force < "
"%s\\etc\\win_setup_mysql_part3.1.sql > nul 2>&1",
installDir.c_str(), installDir.c_str(), installDir.c_str());
rc = system(cmdLine);
}
}
#ifndef SKIP_MYSQL_SETUP4
sprintf_s(cmdLine, cmdLineLen,
"%s\\bin\\mysql.exe --defaults-file=%s\\my.ini --user=root --force < "
"%s\\etc\\win_setup_mysql_part4.sql > nul 2>&1",
installDir.c_str(), installDir.c_str(), installDir.c_str());
rc = system(cmdLine);
rc = 0;
#endif
sprintf_s(cmdLine, cmdLineLen,
"%s\\bin\\mysql.exe --defaults-file=%s\\my.ini --user=root --force < "
"%s\\etc\\win_setup_mysql_part5.sql > nul 2>&1",
installDir.c_str(), installDir.c_str(), installDir.c_str());
rc = system(cmdLine);
rc = 0;
// Install the user priority stored procedures
sprintf_s(cmdLine, cmdLineLen,
"%s\\bin\\mysql.exe --defaults-file=%s\\my.ini --user=root --force < "
"%s\\sql\\calsetuserpriority.sql > nul 2>&1",
installDir.c_str(), installDir.c_str(), installDir.c_str());
rc = system(cmdLine);
rc = 0;
sprintf_s(cmdLine, cmdLineLen,
"%s\\bin\\mysql.exe --defaults-file=%s\\my.ini --user=root --force < "
"%s\\sql\\calremoveuserpriority.sql > nul 2>&1",
installDir.c_str(), installDir.c_str(), installDir.c_str());
rc = system(cmdLine);
rc = 0;
sprintf_s(cmdLine, cmdLineLen,
"%s\\bin\\mysql.exe --defaults-file=%s\\my.ini --user=root --force < "
"%s\\sql\\calshowprocesslist.sql > nul 2>&1",
installDir.c_str(), installDir.c_str(), installDir.c_str());
rc = system(cmdLine);
rc = 0;
out:
_freea(cmdLine);
return rc;
}
int startupIDB()
{
int rc;
string cmd;
cmd = installDir + "\\bin\\winfinidb.exe start";
rc = runIt(cmd);
return rc;
}
int installIDBDB()
{
int rc;
for (int retry = 0; retry < 5; retry++)
{
rc = installIDBConn();
if (rc == 0)
break;
Sleep(5 * (retry + 1) * 1000);
}
if (rc)
return rc;
rc = installIDBConnStep2();
if (rc)
return rc;
string cmd;
cmd = installDir + "\\bin\\dbbuilder.exe 7";
rc = runIt(cmd);
return rc;
}
int upgradeInfiniDB()
{
int rc = 0;
// We'll just have to blast these changes in...
installIDBConn();
// Add new enterprise functions & new syscolumn columns
rc = installIDBConnStep2();
if (rc)
return rc;
return rc;
}
} // namespace
int main(int argc, char** argv)
{
opterr = 0;
vFlg = false;
int c;
while ((c = getopt(argc, argv, "v")) != EOF)
switch (c)
{
case 'v': vFlg = true; break;
case '?':
default: break;
}
string mysqlPort("3306");
if (argc - optind >= 1)
mysqlPort = argv[optind++];
installDir = IDBreadRegistry("", true);
if (fixPath())
{
cerr << "Something went wrong trying to change to the install directory " << installDir << endl;
return 1;
}
cout << "Running InfiniDB bootstrap installer..." << endl;
cout << "Tuning configuration..." << endl;
string moduleFile = installDir + "\\local\\module";
if (_access(moduleFile.c_str(), F_OK) != 0)
{
ofstream mfs(moduleFile.c_str());
if (!mfs.good())
{
cerr << "Something went wrong creating the module file" << endl;
return 1;
}
mfs << "pm1" << endl;
mfs.close();
}
if (fixupConfig(installDir, mysqlPort))
{
cerr << "Something went wrong fixing up a config file" << endl;
return 1;
}
string mysqldb = installDir + "\\mysqldb\\mysql\\user.frm";
struct _stat statbuf;
if (_stat(mysqldb.c_str(), &statbuf) == 0)
{
cout << "Using existing MySQL database." << endl;
}
else
{
cout << "Installing empty MySQL database..." << endl;
if (installMySQL())
{
cerr << "Something went wrong trying to setup MySQL" << endl;
return 1;
}
}
cout << "Starting InfiniDB..." << endl;
if (startupIDB())
{
cerr << "Something went wrong trying to start InfiniDB" << endl;
return 1;
}
Sleep(5 * 1000);
string cnffile = installDir + "\\data1\\000.dir";
if (_stat(cnffile.c_str(), &statbuf) == 0)
{
cout << "Using existing InfiniDB database." << endl;
}
else
{
cout << "Installing InfiniDB components and system catalog..." << endl;
if (installIDBDB())
{
cerr << "Something went wrong trying to install InfiniDB components" << endl;
return 1;
}
}
if (upgradeInfiniDB())
{
cerr << "Something went wrong trying to upgrade InfiniDB components" << endl;
return 1;
}
cout << "Done!" << endl;
Sleep(3 * 1000);
return 0;
}

View File

@ -1,193 +0,0 @@
/*% cc -O -K -dos % -o crc.exe
*/
/*
* Crc - 32 BIT ANSI X3.66 CRC checksum files
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
/**********************************************************************\
|* *|
|* Demonstration program to compute the 32-bit CRC used as the frame *|
|* check sequence in ADCCP (ANSI X3.66, also known as FIPS PUB 71 *|
|* and FED-STD-1003, the U.S. versions of CCITT's X.25 link-level *|
|* protocol). The 32-bit FCS was added via the Federal Register, *|
|* 1 June 1982, p.23798. I presume but don't know for certain that *|
|* this polynomial is or will be included in CCITT V.41, which *|
|* defines the 16-bit CRC (often called CRC-CCITT) polynomial. FIPS *|
|* PUB 78 says that the 32-bit FCS reduces otherwise undetected *|
|* errors by a factor of 10^-5 over 16-bit FCS. *|
|* *|
\**********************************************************************/
/* Need an unsigned type capable of holding 32 bits; */
typedef unsigned long int UNS_32_BITS;
/*
* Copyright (C) 1986 Gary S. Brown. You may use this program, or
* code or tables extracted from it, as desired without restriction.
*/
/* First, the polynomial itself and its table of feedback terms. The */
/* polynomial is */
/* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */
/* Note that we take it "backwards" and put the highest-order term in */
/* the lowest-order bit. The X^32 term is "implied"; the LSB is the */
/* X^31 term, etc. The X^0 term (usually shown as "+1") results in */
/* the MSB being 1. */
/* Note that the usual hardware shift register implementation, which */
/* is what we're using (we're merely optimizing it by doing eight-bit */
/* chunks at a time) shifts bits into the lowest-order term. In our */
/* implementation, that means shifting towards the right. Why do we */
/* do it this way? Because the calculated CRC must be transmitted in */
/* order from highest-order term to lowest-order term. UARTs transmit */
/* characters in order from LSB to MSB. By storing the CRC this way, */
/* we hand it to the UART in the order low-byte to high-byte; the UART */
/* sends each low-bit to hight-bit; and the result is transmission bit */
/* by bit from highest- to lowest-order term without requiring any bit */
/* shuffling on our part. Reception works similarly. */
/* The feedback terms table consists of 256, 32-bit entries. Notes: */
/* */
/* 1. The table can be generated at runtime if desired; code to do so */
/* is shown later. It might not be obvious, but the feedback */
/* terms simply represent the results of eight shift/xor opera- */
/* tions for all combinations of data and CRC register values. */
/* */
/* 2. The CRC accumulation logic is the same for all CRC polynomials, */
/* be they sixteen or thirty-two bits wide. You simply choose the */
/* appropriate table. Alternatively, because the table can be */
/* generated at runtime, you can start by generating the table for */
/* the polynomial in question and use exactly the same "updcrc", */
/* if your application needn't simultaneously handle two CRC */
/* polynomials. (Note, however, that XMODEM is strange.) */
/* */
/* 3. For 16-bit CRCs, the table entries need be only 16 bits wide; */
/* of course, 32-bit entries work OK if the high 16 bits are zero. */
/* */
/* 4. The values must be right-shifted by eight bits by the "updcrc" */
/* logic; the shift must be unsigned (bring in zeroes). On some */
/* hardware you could probably optimize the shift in assembler by */
/* using byte-swap instructions. */
static UNS_32_BITS crc_32_tab[] = { /* CRC polynomial 0xedb88320 */
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
#define UPDC32(octet, crc) (crc_32_tab[((crc) ^ (octet)) & 0xff] ^ ((crc) >> 8))
unsigned int idb_crc32(const unsigned int crc, const unsigned char* buf, const size_t len)
{
size_t i;
const unsigned char* p = buf;
unsigned int newcrc = crc ^ 0xffffffff;
for (i = 0; i < len; i++)
newcrc = UPDC32(*p++, newcrc);
return newcrc ^ 0xffffffff;
}
#if 0
int Block = 0; /* Pad file with 032's to multiple of Block */
main(argc, argv)
char **argv;
{
register errors = 0;
if (! strcmp(argv[1], "-x")) {
Block = 128; --argc; ++argv;
}
if (! strcmp(argv[1], "-k")) {
Block = 1024; --argc; ++argv;
}
while( --argc > 0)
errors |= crc32file( *++argv);
exit(errors != 0);
}
crc32file(name)
char *name;
{
register FILE *fin;
register unsigned long oldcrc32;
register unsigned long crc32;
register unsigned long oldcrc;
register c;
register long charcnt;
register long l;
oldcrc32 = 0xFFFFFFFF; charcnt = 0;
#ifdef M_I86SM
if ((fin=fopen(name, "rb"))==NULL)
#else
if ((fin=fopen(name, "r"))==NULL)
#endif
{
perror(name);
return ERROR;
}
while ((c=getc(fin))!=EOF) {
++charcnt;
oldcrc32 = UPDC32(c, oldcrc32);
}
if (ferror(fin)) {
perror(name);
fclose(fin); return ERROR;
}
else {
if (Block) {
for (l = charcnt; l % Block; ++l)
oldcrc32 = UPDC32(032, oldcrc32);
}
crc32 = oldcrc32; oldcrc = oldcrc32 = ~oldcrc32;
printf("%08lX %7ld ", oldcrc, charcnt);
if (Block == 128)
printf("%5ld+%3ld ", charcnt/Block, charcnt%Block);
if (Block == 1024)
printf("%5ld+%4ld ", charcnt/Block, charcnt%Block);
printf(" %s\n", name);
}
fclose(fin); return OK;
}
#endif
/* End of crc.c */

View File

@ -1,555 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include <unistd.h>
#include <string>
#include <iostream>
#include <fstream>
#include <time.h>
using namespace std;
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#include "configcpp.h"
using namespace config;
#include "sedit.h"
#include "idbregistry.h"
using namespace winport;
#include "fixup.h"
namespace
{
int fixupCalpontXML()
{
int rc = -1; // assume the worst
DWORDLONG totalMemSize = 1024ULL * 1024ULL * 1024ULL * 2ULL;
#ifdef _WIN64
totalMemSize *= 4ULL;
#endif
MEMORYSTATUSEX memStat;
memStat.dwLength = sizeof(memStat);
if (GlobalMemoryStatusEx(&memStat) == 0)
// FIXME: Assume 2GB?
(void)0;
else
{
#ifndef _WIN64
memStat.ullTotalPhys = std::min(memStat.ullTotalVirtual, memStat.ullTotalPhys);
#endif
// We now have the total phys mem in bytes
// FIXME: should we use avail phys mem instead?
totalMemSize = memStat.ullTotalPhys;
}
try
{
Config* cf = Config::makeConfig();
string section;
string parm;
string val;
// Fixup ConnectionsPerPrimProc
section = "PrimitiveServers";
parm = "ConnectionsPerPrimProc";
val = cf->getConfig(section, parm);
if (val.empty())
{
val = "2";
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
}
else
{
cf->delConfig(section, parm);
cf->setConfig(section, parm, val);
}
// Fixup PrefetchThreshold
parm = "PrefetchThreshold";
val = cf->getConfig(section, parm);
if (val == "30")
{
val = "5";
cf->setConfig(section, parm, val);
cout << "Fixing " << section << "." << parm << " = " << val << endl;
}
// Fixup Count
parm = "Count";
val = cf->getConfig(section, parm);
if (val.empty())
{
val = "1";
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
}
// Fixup PMS2
section = "PMS2";
parm = "IPAddr";
val = cf->getConfig(section, parm);
if (val.empty())
{
val = "127.0.0.1";
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
parm = "Port";
val = "8620";
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
}
// Fixup UmMaxMemorySmallSide
section = "HashJoin";
parm = "UmMaxMemorySmallSide";
val = cf->getConfig(section, parm);
#ifdef _WIN64
if (val == "4G")
#else
if (val == "256M")
#endif
{
cf->delConfig(section, parm);
cout << "Deleting " << section << "." << parm << endl;
}
// Fixup TotalUmMaxMemorySmallSide
parm = "TotalUmMaxMemorySmallSide";
val = cf->getConfig(section, parm);
#ifdef _WIN64
if (val == "8G")
#else
if (val == "512M")
#endif
{
cf->delConfig(section, parm);
cout << "Deleting " << section << "." << parm << endl;
}
// Fixup TotalUmMemory
parm = "TotalUmMemory";
val = cf->getConfig(section, parm);
if (val.empty())
{
#ifdef _WIN64
totalMemSize /= (1024ULL * 1024ULL * 1024ULL);
if (totalMemSize >= 31)
val = "16G";
else if (totalMemSize >= 15)
val = "8G";
else if (totalMemSize >= 7)
val = "4G";
else
val = "2G";
#else
val = "2G";
#endif
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
}
// Fixup MaxMemoryPerUnion
section = "Union";
parm = "MaxMemoryPerUnion";
val = cf->getConfig(section, parm);
#ifdef _WIN64
if (val == "4G")
#else
if (val == "256M")
#endif
{
cf->delConfig(section, parm);
cout << "Deleting " << section << "." << parm << endl;
}
// Fixup TotalUnionMemory
parm = "TotalUnionMemory";
val = cf->getConfig(section, parm);
#ifdef _WIN64
if (val == "8G")
#else
if (val == "512M")
#endif
{
cf->delConfig(section, parm);
cout << "Deleting " << section << "." << parm << endl;
}
// Fixup RowAggregation.MaxMemory
section = "RowAggregation";
parm = "MaxMemory";
val = cf->getConfig(section, parm);
#ifdef _WIN64
if (val == "1G")
#else
if (val == "128M")
#endif
{
cf->delConfig(section, parm);
cout << "Deleting " << section << "." << parm << endl;
}
// Fixup OrderByLimit.MaxMemory
section = "OrderByLimit";
parm = "MaxMemory";
val = cf->getConfig(section, parm);
#ifdef _WIN64
if (val == "1G")
#else
if (val == "128M")
#endif
{
cf->delConfig(section, parm);
cout << "Deleting " << section << "." << parm << endl;
}
// Fixup Installation.UMStorageType
section = "Installation";
parm = "UMStorageType";
val = cf->getConfig(section, parm);
if (val.empty())
{
val = "internal";
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
}
// Fixup DBRootStorageType
parm = "DBRootStorageType";
val = cf->getConfig(section, parm);
if (val == "local")
{
val = "internal";
cf->setConfig(section, parm, val);
cout << "Fixing " << section << "." << parm << " = " << val << endl;
}
// Fixup TableLockSaveFile
section = "SystemConfig";
parm = "TableLockSaveFile";
val = cf->getConfig(section, parm);
if (val.empty())
{
val = IDBreadRegistry("") + "/dbrm/tablelocks";
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
}
// Fixup SystemModuleConfig
section = "SystemModuleConfig";
parm = "ModuleDBRootCount1-1";
val = cf->getConfig(section, parm);
if (val.empty())
{
val = "0";
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
parm = "ModuleDBRootCount1-2";
val = "0";
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
parm = "ModuleDBRootCount1-3";
val = "1";
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
parm = "ModuleDBRootID1-1-1";
val = "0";
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
parm = "ModuleDBRootID1-1-2";
val = "0";
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
parm = "ModuleDBRootID1-1-3";
val = "1";
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
}
// Fixup NVBF
section = "VersionBuffer";
parm = "NumVersionBufferFiles";
val = cf->getConfig(section, parm);
if (!val.empty())
{
cf->delConfig(section, parm);
cout << "Deleting " << section << "." << parm << endl;
}
// Fixup AllowDiskBasedJoin
section = "HashJoin";
parm = "AllowDiskBasedJoin";
val = cf->getConfig(section, parm);
if (val.empty())
{
val = "N"; // We default to No
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
}
// Fixup TempFilePath
section = "HashJoin";
parm = "TempFilePath";
val = cf->getConfig(section, parm);
if (val.empty())
{
val = "$INSTALLDIR/tmp";
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
}
// Fixup TempFileCompression
section = "HashJoin";
parm = "TempFileCompression";
val = cf->getConfig(section, parm);
if (val.empty())
{
val = "Y";
cf->setConfig(section, parm, val);
cout << "Adding " << section << "." << parm << " = " << val << endl;
}
cf->write();
rc = 0;
}
catch (exception& e)
{
cout << "fixupCalpontXML caught exception: " << e.what() << endl;
}
catch (...)
{
cout << "fixupCalpontXML caught exception (...): " << endl;
}
return rc;
}
int fixupMyIni()
{
return 0;
}
} // namespace
namespace bootstrap
{
int fixupConfig(const string& installDir, const string& mysqlPort)
{
int rc = -1;
string id = installDir;
string::size_type p;
p = id.find('\\');
while (p != string::npos)
{
id[p] = '/';
p = id.find('\\');
}
fs::path cFilePath;
fs::path tmpPath;
ifstream ifs;
ofstream ofs;
string strLine;
bool okayToRename = false;
cFilePath = installDir;
cFilePath /= "etc";
cFilePath /= "Columnstore.xml";
tmpPath = cFilePath;
tmpPath.replace_extension(".tmp");
fs::remove(tmpPath);
ifs.open(cFilePath.string().c_str());
ofs.open(tmpPath.string().c_str());
getline(ifs, strLine);
while (ifs.good())
{
sedit(strLine, "##INSTDIR##", id);
ofs << strLine << endl;
getline(ifs, strLine);
}
if (!ifs.bad() && !ofs.bad())
okayToRename = true;
ofs.close();
ifs.close();
if (okayToRename)
{
try
{
fs::remove(cFilePath);
fs::rename(tmpPath, cFilePath);
}
catch (exception& e)
{
cout << "Failed to remove " << cFilePath.c_str() << e.what() << endl;
}
}
else
return -1;
ifs.clear();
ofs.clear();
okayToRename = false;
cFilePath = installDir;
cFilePath /= "my.ini";
tmpPath = cFilePath;
tmpPath.replace_extension(".tmp");
fs::remove(tmpPath);
ifs.open(cFilePath.string().c_str());
ofs.open(tmpPath.string().c_str());
getline(ifs, strLine);
while (ifs.good())
{
if (strLine[0] != '#')
{
sedit(strLine, "##INSTDIR##", id);
sedit(strLine, "##PORT##", mysqlPort);
}
#ifndef SKIP_MYSQL_SETUP4
sedit(strLine, "#infinidb_compression_type=0", "infinidb_compression_type=2");
sedit(strLine, "infinidb_compression_type=1", "infinidb_compression_type=2");
#endif
ofs << strLine << endl;
getline(ifs, strLine);
}
if (!ifs.bad() && !ofs.bad())
okayToRename = true;
ofs.close();
ifs.close();
if (okayToRename)
{
try
{
fs::remove(cFilePath);
fs::rename(tmpPath, cFilePath);
}
catch (boost::exception const& ex)
{
std::exception const* se = dynamic_cast<std::exception const*>(&ex);
if (se)
{
// will enter here only for my application exception and not for pure boost exception
cerr << se->what() << "my.ini not fixedup" << endl;
}
else
{
cerr << " Boost exception while renaming my.ini: Failed to decode the exception" << endl;
}
}
catch (std::exception const& ex)
{
cerr << ex.what() << "my.ini not fixedup" << endl;
}
catch (...)
{
cerr << "An unknown exception (...) was caught while renaming my.ini" << endl;
}
}
else
return -1;
ifs.clear();
ofs.clear();
// Add install timestamp to CalpontVersion.txt
char szTime[24];
time_t now = time(NULL);
struct tm nowtm;
localtime_s(&nowtm, &now);
strftime(szTime, 24, "%Y-%m-%d %H:%M:%S", &nowtm);
okayToRename = false;
cFilePath = installDir;
cFilePath /= "etc/CalpontVersion.txt";
tmpPath = cFilePath;
tmpPath.replace_extension(".tmp");
fs::remove(tmpPath);
ifs.open(cFilePath.string().c_str());
ofs.open(tmpPath.string().c_str());
getline(ifs, strLine);
while (ifs.good())
{
sedit(strLine, "@@INSTALLDATE@@", szTime);
ofs << strLine << endl;
getline(ifs, strLine);
}
if (!ifs.bad() && !ofs.bad())
okayToRename = true;
ofs.close();
ifs.close();
if (okayToRename)
{
fs::remove(cFilePath);
fs::rename(tmpPath, cFilePath);
}
else
return -1;
ifs.clear();
ofs.clear();
// Now do any final fixups...
rc = fixupMyIni();
if (rc == 0)
rc = fixupCalpontXML();
return rc;
}
} // namespace bootstrap

View File

@ -1,25 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#pragma once
#include <string>
namespace bootstrap
{
extern int fixupConfig(const std::string&, const std::string&);
}

View File

@ -1,104 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
Copyright (C) 1998-2003 Daniel Veillard
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include <io.h>
#include <string.h>
#include "glob.h"
#define ALLOC_SIZE 128
int glob(const char *pattern, int flags,
int errfunc(const char *epath, int eerrno),
glob_t *pglob)
{
size_t nalloc;
intptr_t file;
struct _finddata_t filedata;
if (!(flags & GLOB_APPEND))
{
pglob->gl_pathv = NULL;
pglob->gl_alloccnt = 0;
pglob->gl_pathc = 0;
}
if (pglob->gl_alloccnt == 0)
{
nalloc = pglob->gl_offs / ALLOC_SIZE;
if ((nalloc == 0) || ((pglob->gl_offs % ALLOC_SIZE) != 0))
nalloc++;
nalloc *= ALLOC_SIZE;
nalloc++;
pglob->gl_pathv = calloc(nalloc, sizeof(char*));
if (pglob->gl_pathv == NULL)
return GLOB_NOSPACE;
pglob->gl_alloccnt = nalloc;
}
pglob->gl_pathc += pglob->gl_offs;
file = _findfirst(pattern,&filedata);
if (file != -1)
{
do
{
if (!strcmp(filedata.name, ".") ||
!strcmp(filedata.name, ".."))
continue;
if (pglob->gl_pathc >= pglob->gl_alloccnt)
{
char** tmpv;
nalloc = pglob->gl_alloccnt + ALLOC_SIZE;
tmpv = calloc(nalloc, sizeof(char*));
if (tmpv == NULL)
return GLOB_NOSPACE;
memcpy(tmpv, pglob->gl_pathv, pglob->gl_alloccnt * sizeof(char*));
free(pglob->gl_pathv);
pglob->gl_pathv = tmpv;
pglob->gl_alloccnt = nalloc;
}
pglob->gl_pathv[pglob->gl_pathc] = _strdup(filedata.name);
if (pglob->gl_pathv[pglob->gl_pathc] == NULL)
return GLOB_NOSPACE;
pglob->gl_pathc++;
} while (_findnext(file,&filedata) == 0);
}
_findclose(file);
return (pglob->gl_pathc > pglob->gl_offs ? 0 : GLOB_NOMATCH);
}
void globfree(glob_t *pglob)
{
size_t i;
if (pglob == NULL) return;
for (i = 0; i < pglob->gl_pathc; i++)
if (pglob->gl_pathv[i] != NULL)
free(pglob->gl_pathv[i]);
free(pglob->gl_pathv);
}

View File

@ -1,60 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#pragma once
#include <crtdefs.h>
#define GLOB_ERR 0x0001
#define GLOB_MARK 0x0002
#define GLOB_NOSORT 0x0004
#define GLOB_DOOFFS 0x0008
#define GLOB_NOCHECK 0x0010
#define GLOB_APPEND 0x0020
#define GLOB_NOESCAPE 0x0040
#define GLOB_PERIOD 0x0080
#define GLOB_ALTDIRFUNC 0x0100
#define GLOB_BRACE 0x0200
#define GLOB_NOMAGIC 0x0400
#define GLOB_TILDE 0x0800
#define GLOB_ONLYDIR 0x1000
#define GLOB_MAGCHAR 0x2000
#define GLOB_NOSPACE 0x01
#define GLOB_ABORTED 0x02
#define GLOB_NOMATCH 0x03
typedef struct
{
size_t gl_pathc; /* Count of paths matched so far */
char** gl_pathv; /* List of matched pathnames. */
size_t gl_offs; /* Slots to reserve in gl_pathv. */
size_t gl_alloccnt;
} glob_t;
#ifdef __cplusplus
extern "C"
{
#endif
extern int glob(const char* pattern, int flags, int errfunc(const char* epath, int eerrno), glob_t* pglob);
extern void globfree(glob_t* pglob);
#ifdef __cplusplus
}
#endif

View File

@ -1,49 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include <iostream>
#include <string>
using namespace std;
#include <regex.hpp>
#include "grepit.h"
namespace
{
const int lineLen = 1024;
}
namespace winport
{
bool grepit(istream& is, const string& pattern)
{
std::regex pat(pattern);
string cInput;
getline(is, cInput);
while (is.good())
{
if (std::regex_match(cInput, pat))
return true;
getline(is, cInput);
}
return false;
}
} // namespace winport

View File

@ -1,26 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#pragma once
#include <iostream>
#include <string>
namespace winport
{
extern bool grepit(std::istream&, const std::string&);
}

View File

@ -1,452 +0,0 @@
!include "EnvVarUpdate.nsh"
!include "WordFunc.nsh"
!include nsDialogs.nsh
Name InfiniDB
InstallDir c:\Calpont
InstallDirRegKey HKLM SOFTWARE\Calpont\InfiniDB ""
OutFile InfiniDB64-ent-Debug.exe
!define DISPLAY_URL http://www.infinidb.co/
!define DISPLAY_VERSION "4.6 Debug"
VIAddVersionKey "FileVersion" "4.6-Debug"
VIProductVersion "4.6.0.0"
VIAddVersionKey "ProductVersion" "${DISPLAY_VERSION}"
VIAddVersionKey "CompanyName" "InfiniDB, Inc."
VIAddVersionKey "FileDescription" "InfiniDB Enterprise Windows 64-bit Installer"
VIAddVersionKey "LegalCopyright" "Copyright (c) 2014"
VIAddVersionKey "ProductName" "InfiniDB"
XPStyle on
Var Dialog
Var PortLabel
Var Port
Var PortChoice
Var SvcMode
Var SvcModeChoice
Var ApndSysPath
Var ApndSysPathChoice
Section
ExecWait 'sc.exe stop InfiniDB'
IfFileExists $INSTDIR\bin\svcwait.bat 0 PreInstStopped1
ClearErrors
ExecWait '"$INSTDIR\bin\svcwait.bat" STOPPED 120'
IfErrors PreInstStopped1 0
Delete $INSTDIR\tmp\InfiniDB.pids
PreInstStopped1:
IfFileExists $INSTDIR\bin\winfinidb.exe 0 PreInstStopped2
ExecWait '"$INSTDIR\bin\winfinidb.exe" stop'
Delete $INSTDIR\tmp\InfiniDB.pids
PreInstStopped2:
SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\uninstall.exe
IfFileExists $INSTDIR\my.ini 0 MyIniNotExists
File /oname=$INSTDIR\my_dist.ini my.ini
Goto MyIniExists
MyIniNotExists:
File my.ini
MyIniExists:
SetOutPath $INSTDIR\bin
# Enterprise Release files
File ..\..\..\x64\Debug\databaseSizeReport.exe
File ..\..\..\x64\Debug\dumpcol.exe
File ..\..\..\x64\Debug\oid2file.exe
File ..\..\..\x64\Debug\dumpVss.exe
# Standard Release Files
File ..\..\..\x64\Debug\clearShm.exe
File ..\..\..\x64\Debug\colxml.exe
File ..\..\..\x64\Debug\controllernode.exe
File ..\..\..\x64\Debug\cpimport.exe
File ..\..\..\x64\Debug\dbbuilder.exe
File ..\..\..\x64\Debug\DDLProc.exe
File ..\..\..\x64\Debug\DMLProc.exe
File ..\..\..\x64\Debug\editem.exe
File ..\..\..\x64\Debug\ExeMgr.exe
File ..\..\..\x64\Debug\load_brm.exe
File ..\..\..\x64\Debug\WriteEngineServer.exe
File ..\..\..\x64\Debug\DecomSvr.exe
File ..\..\..\x64\Debug\PrimProc.exe
File ..\..\..\x64\Debug\save_brm.exe
File ..\..\..\x64\Debug\viewtablelock.exe
File ..\..\..\x64\Debug\winfinidb.exe
File ..\..\..\x64\Debug\workernode.exe
File ..\..\..\x64\Debug\cleartablelock.exe
File ..\..\..\x64\Debug\ddlcleanup.exe
File ..\..\..\x64\Debug\getConfig.exe
File ..\..\..\x64\Debug\setConfig.exe
File ..\..\..\x64\Debug\dbrmctl.exe
File ..\..\..\x64\Debug\reset_locks.exe
File ..\..\..\mysql\sql\Debug\mysqld.exe
File ..\..\..\mysql\storage\myisam\Debug\myisam_ftdump.exe
File ..\..\..\mysql\storage\myisam\Debug\myisamchk.exe
File ..\..\..\mysql\storage\myisam\Debug\myisamlog.exe
File ..\..\..\mysql\storage\myisam\Debug\myisampack.exe
File ..\..\..\mysql\client\Debug\mysql.exe
File ..\..\..\mysql\client\Debug\mysql_upgrade.exe
File ..\..\..\mysql\client\Debug\mysqladmin.exe
File ..\..\..\mysql\client\Debug\mysqlbinlog.exe
File ..\..\..\mysql\client\Debug\mysqlcheck.exe
File ..\..\..\mysql\client\Debug\mysqldump.exe
File ..\..\..\mysql\client\Debug\mysqlimport.exe
File ..\..\..\mysql\server-tools\instance-manager\Debug\mysqlmanager.exe
File ..\..\..\mysql\client\Debug\mysqlshow.exe
File ..\..\..\mysql\client\Debug\mysqlslap.exe
File ..\..\..\mysql\client\Debug\mysqltest.exe
File ..\..\..\mysql\storage\archive\Debug\ha_archive.dll
File ..\..\..\mysql\storage\federated\Debug\ha_federated.dll
File ..\..\..\mysql\storage\innodb_plugin\Debug\ha_innodb_plugin.dll
File ..\..\..\mysql\libmysql\Debug\libmysql.dll
File ..\..\..\x64\Debug\libcalmysql.dll
File ..\..\..\x64\Debug\libconfigcpp.dll
File ..\..\..\x64\Debug\libddlpackageproc.dll
File ..\..\..\x64\Debug\libdmlpackageproc.dll
File ..\..\..\x64\Debug\libjoblist.dll
File ..\..\..\x64\Debug\libwriteengine.dll
File ..\..\..\x64\Debug\libudfsdk.dll
File ..\..\..\x64\Debug\libudf_mysql.dll
File ..\..\..\libxml2-2.7.8\libxml2\win32\Debug\libxml2.dll
File ..\..\..\libiconv-1.14\libiconv\Debug\libiconv.dll
File ..\..\oamapps\calpontSupport\calpontSupport.bat
File ..\..\..\vcredist_x64.exe
File ..\..\..\x64\Debug\bootstrap.exe
File svcwait.bat
File idbsvsta.bat
File idbsvsto.bat
File idbmysql.bat
SetOutPath $INSTDIR\bulk\data\import
SetOutPath $INSTDIR\bulk\job
SetOutPath $INSTDIR\bulk\log
SetOutPath $INSTDIR\data1
SetOutPath $INSTDIR\dbrm
SetOutPath $INSTDIR\etc
File win_setup_mysql_part1.sql
File win_setup_mysql_part2.sql
File win_setup_mysql_part3.sql
File win_setup_mysql_part3.1.sql
File win_setup_mysql_part4.sql
File win_setup_mysql_part5.sql
File CalpontVersion.txt
IfFileExists $INSTDIR\etc\Columnstore.xml 0 CfgNotExists
File /oname=$INSTDIR\etc\Calpont_dist.xml Columnstore.xml
Goto CfgExists
CfgNotExists:
File Columnstore.xml
CfgExists:
File ..\..\utils\loggingcpp\ErrorMessage.txt
File ..\..\utils\loggingcpp\MessageFile.txt
SetOutPath $INSTDIR\log
SetOutPath $INSTDIR\local
SetOutPath $INSTDIR\mysqldb
SetOutPath $INSTDIR\share
File /r ..\..\..\mysql\sql\share\charsets
File /r ..\..\..\mysql\sql\share\czech
File /r ..\..\..\mysql\sql\share\danish
File /r ..\..\..\mysql\sql\share\dutch
File /r ..\..\..\mysql\sql\share\english
File /r ..\..\..\mysql\sql\share\estonian
File /r ..\..\..\mysql\sql\share\french
File /r ..\..\..\mysql\sql\share\german
File /r ..\..\..\mysql\sql\share\greek
File /r ..\..\..\mysql\sql\share\hungarian
File /r ..\..\..\mysql\sql\share\italian
File /r ..\..\..\mysql\sql\share\japanese
File /r ..\..\..\mysql\sql\share\japanese-sjis
File /r ..\..\..\mysql\sql\share\korean
File /r ..\..\..\mysql\sql\share\norwegian
File /r ..\..\..\mysql\sql\share\norwegian-ny
File /r ..\..\..\mysql\sql\share\polish
File /r ..\..\..\mysql\sql\share\portuguese
File /r ..\..\..\mysql\sql\share\romanian
File /r ..\..\..\mysql\sql\share\russian
File /r ..\..\..\mysql\sql\share\serbian
File /r ..\..\..\mysql\sql\share\slovak
File /r ..\..\..\mysql\sql\share\spanish
File /r ..\..\..\mysql\sql\share\swedish
File /r ..\..\..\mysql\sql\share\ukrainian
SetOutPath $INSTDIR\tmp
SetOutPath $INSTDIR\sql
File ..\..\dbcon\mysql\dumpcat_mysql.sql
File ..\..\dbcon\mysql\calsetuserpriority.sql
File ..\..\dbcon\mysql\calremoveuserpriority.sql
File ..\..\dbcon\mysql\calshowprocesslist.sql
WriteRegStr HKLM Software\Calpont\InfiniDB "" $INSTDIR
WriteRegStr HKLM Software\Calpont\InfiniDB "CalpontHome" $INSTDIR\etc
WriteRegStr HKLM Software\Calpont\InfiniDB "ConfigFile" $INSTDIR\etc\Columnstore.xml
StrCmp $ApndSysPathChoice 'yes' 0 DontAppendSysPath
Push "PATH"
Push "A"
Push "HKLM"
Push "$INSTDIR\bin"
Call EnvVarUpdate
Pop $0
DontAppendSysPath:
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "DisplayName" "InfiniDB"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "Publisher" "InfiniDB, Inc."
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "HelpLink" "${DISPLAY_URL}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "URLUpdateInfo" "${DISPLAY_URL}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "URLInfoAbout" "${DISPLAY_URL}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "DisplayVersion" "${DISPLAY_VERSION}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "VersionMajor" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "VersionMinor" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "NoRepair" "1"
ExecWait "$INSTDIR\bin\vcredist_x64.exe /quiet /norestart"
ClearErrors
ExecWait "$INSTDIR\bin\bootstrap.exe $PortChoice"
IfErrors 0 BootstrapOK
MessageBox MB_ICONSTOP "Fatal error installing InfiniDB"
Abort
BootstrapOK:
ExecWait '"$INSTDIR\bin\winfinidb.exe" stop'
ClearErrors
ExecWait 'sc.exe create InfiniDB binPath= "$INSTDIR\bin\winfinidb.exe" start= $SvcModeChoice'
ExecWait 'sc.exe description InfiniDB "InfiniDB Database Engine"'
StrCmp $SvcModeChoice 'auto' 0 DontStartSvc
ExecWait 'sc.exe start InfiniDB'
ExecWait '"$INSTDIR\bin\svcwait.bat" RUNNING 120'
DontStartSvc:
ClearErrors
CreateDirectory "$SMPROGRAMS\InfiniDB"
CreateShortCut "$SMPROGRAMS\InfiniDB\SQL Prompt.lnk" "$INSTDIR\bin\mysql.exe" '--defaults-file="$INSTDIR\my.ini" --user=root'
CreateShortCut "$SMPROGRAMS\InfiniDB\Start InfiniDB.lnk" "$INSTDIR\bin\idbsvsta.bat"
CreateShortCut "$SMPROGRAMS\InfiniDB\Stop InfiniDB.lnk" "$INSTDIR\bin\idbsvsto.bat"
WriteINIStr "$SMPROGRAMS\InfiniDB\InfiniDB on the Web.url" "InternetShortcut" "URL" "${DISPLAY_URL}"
ClearErrors
SectionEnd
Section Uninstall
SetRegView 64
ExecWait 'sc.exe stop InfiniDB'
ClearErrors
ExecWait '"$INSTDIR\bin\svcwait.bat" STOPPED 120'
IfErrors PreUninstStopped1 0
Delete $INSTDIR\tmp\InfiniDB.pids
PreUninstStopped1:
ExecWait '"$INSTDIR\bin\winfinidb.exe" stop'
Delete $INSTDIR\tmp\InfiniDB.pids
ExecWait 'sc.exe delete InfiniDB'
Push "PATH"
Push "R"
Push "HKLM"
Push "$INSTDIR\bin"
Call un.EnvVarUpdate
Pop $0
Delete $INSTDIR\uninstall.exe
# Enterprise Release Files
Delete $INSTDIR\bin\databaseSizeReport.exe
Delete $INSTDIR\bin\dumpcol.exe
Delete $INSTDIR\bin\oid2file.exe
Delete $INSTDIR\bin\dumpVss.exe
# Standard Release Files
Delete $INSTDIR\bin\bootstrap.exe
Delete $INSTDIR\bin\clearShm.exe
Delete $INSTDIR\bin\colxml.exe
Delete $INSTDIR\bin\controllernode.exe
Delete $INSTDIR\bin\cpimport.exe
Delete $INSTDIR\bin\dbbuilder.exe
Delete $INSTDIR\bin\DDLProc.exe
Delete $INSTDIR\bin\DMLProc.exe
Delete $INSTDIR\bin\editem.exe
Delete $INSTDIR\bin\ExeMgr.exe
Delete $INSTDIR\bin\libcalmysql.dll
Delete $INSTDIR\bin\libconfigcpp.dll
Delete $INSTDIR\bin\libddlpackageproc.dll
Delete $INSTDIR\bin\libdmlpackageproc.dll
Delete $INSTDIR\bin\libjoblist.dll
Delete $INSTDIR\bin\libwriteengine.dll
Delete $INSTDIR\bin\libudfsdk.dll
Delete $INSTDIR\bin\libudf_mysql.dll
Delete $INSTDIR\bin\libxml2.dll
Delete $INSTDIR\bin\libiconv.dll
Delete $INSTDIR\bin\load_brm.exe
Delete $INSTDIR\bin\myisam_ftdump.exe
Delete $INSTDIR\bin\myisamchk.exe
Delete $INSTDIR\bin\myisamlog.exe
Delete $INSTDIR\bin\myisampack.exe
Delete $INSTDIR\bin\mysql.exe
Delete $INSTDIR\bin\mysql_upgrade.exe
Delete $INSTDIR\bin\mysqladmin.exe
Delete $INSTDIR\bin\mysqlbinlog.exe
Delete $INSTDIR\bin\mysqlcheck.exe
Delete $INSTDIR\bin\mysqld.exe
Delete $INSTDIR\bin\mysqldump.exe
Delete $INSTDIR\bin\mysqlimport.exe
Delete $INSTDIR\bin\mysqlmanager.exe
Delete $INSTDIR\bin\mysqlshow.exe
Delete $INSTDIR\bin\mysqlslap.exe
Delete $INSTDIR\bin\mysqltest.exe
Delete $INSTDIR\bin\DecomSvr.exe
Delete $INSTDIR\bin\PrimProc.exe
Delete $INSTDIR\bin\WriteEngineServer.exe
Delete $INSTDIR\bin\save_brm.exe
Delete $INSTDIR\bin\vcredist_x64.exe
Delete $INSTDIR\bin\viewtablelock.exe
Delete $INSTDIR\bin\winfinidb.exe
Delete $INSTDIR\bin\workernode.exe
Delete $INSTDIR\bin\cleartablelock.exe
Delete $INSTDIR\bin\ddlcleanup.exe
Delete $INSTDIR\bin\getConfig.exe
Delete $INSTDIR\bin\setConfig.exe
Delete $INSTDIR\bin\dbrmctl.exe
Delete $INSTDIR\bin\reset_locks.exe
Delete $INSTDIR\bin\svcwait.bat
Delete $INSTDIR\bin\idbsvsta.bat
Delete $INSTDIR\bin\idbsvsto.bat
Delete $INSTDIR\bin\idbmysql.bat
Delete $INSTDIR\bin\ha_archive.dll
Delete $INSTDIR\bin\ha_federated.dll
Delete $INSTDIR\bin\ha_innodb_plugin.dll
Delete $INSTDIR\bin\libmysql.dll
Delete $INSTDIR\bin\calpontSupport.bat
Delete $INSTDIR\etc\ErrorMessage.txt
Delete $INSTDIR\etc\MessageFile.txt
Delete $INSTDIR\etc\win_setup_mysql_part1.sql
Delete $INSTDIR\etc\win_setup_mysql_part2.sql
Delete $INSTDIR\etc\win_setup_mysql_part3.sql
Delete $INSTDIR\etc\win_setup_mysql_part3.1.sql
Delete $INSTDIR\etc\win_setup_mysql_part4.sql
Delete $INSTDIR\etc\win_setup_mysql_part5.sql
Delete $INSTDIR\etc\Calpont_save.xml
Rename $INSTDIR\etc\Columnstore.xml $INSTDIR\etc\Calpont_save.xml
RMDir /r $INSTDIR\share\charsets
RMDir /r $INSTDIR\share\czech
RMDir /r $INSTDIR\share\danish
RMDir /r $INSTDIR\share\dutch
RMDir /r $INSTDIR\share\english
RMDir /r $INSTDIR\share\estonian
RMDir /r $INSTDIR\share\french
RMDir /r $INSTDIR\share\german
RMDir /r $INSTDIR\share\greek
RMDir /r $INSTDIR\share\hungarian
RMDir /r $INSTDIR\share\italian
RMDir /r $INSTDIR\share\japanese
RMDir /r $INSTDIR\share\japanese-sjis
RMDir /r $INSTDIR\share\korean
RMDir /r $INSTDIR\share\norwegian
RMDir /r $INSTDIR\share\norwegian-ny
RMDir /r $INSTDIR\share\polish
RMDir /r $INSTDIR\share\portuguese
RMDir /r $INSTDIR\share\romanian
RMDir /r $INSTDIR\share\russian
RMDir /r $INSTDIR\share\serbian
RMDir /r $INSTDIR\share\slovak
RMDir /r $INSTDIR\share\spanish
RMDir /r $INSTDIR\share\swedish
RMDir /r $INSTDIR\share\ukrainian
Delete $INSTDIR\sql\dumpcat_mysql.sql
Delete $INSTDIR\sql\calsetuserpriority.sql
Delete $INSTDIR\sql\calremoveuserpriority.sql
Delete $INSTDIR\sql\calshowprocesslist.sql
Delete $INSTDIR\my_save.ini
Rename $INSTDIR\my.ini $INSTDIR\my_save.ini
RMDir /r "$SMPROGRAMS\InfiniDB"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB"
SectionEnd
Function .onInit
SetRegView 64
ClearErrors
userInfo::getAccountType
pop $0
StrCmp $0 "Admin" AdminOK
MessageBox MB_ICONSTOP "Administrator privileges are required to install InfiniDB"
Abort
AdminOK:
#set up defaults for these things we ask the user about.
StrCpy $PortChoice "3306"
StrCpy $SvcModeChoice "auto"
StrCpy $ApndSysPathChoice "yes"
# We need to run the 32 bit version of NSIS until the 8K string patch is available for
# the 64 bit release.
# Since we're running the 32 bit version, InstallDirRegKey looks in the wrong place
# because Windows 64 silently puts all the 32 bit registry stuff in Wow6432Node, which
# is where InstallDirRegKey looks. But we don't put our stuff there.
# For some reason, NSIS won't let SetRegView (which would fix the problem) run until after
# InstallDirRegKey is run. Hence this hack to get our install directory from the registry
SetRegView 64
ClearErrors
ReadRegStr $0 HKLM Software\Calpont\InfiniDB ""
IfErrors GotInstDir
StrCpy $INSTDIR $0
GotInstDir:
FunctionEnd
Function nsDialogsPage
nsDialogs::Create 1018
Pop $Dialog
${NSD_CreateLabel} 0 25u 75u 12u "mysqld port number: "
Pop $PortLabel
${NSD_CreateNumber} 75u 25u 50u 12u "3306"
Pop $Port
${NSD_CreateCheckBox} 0 50u 100% 12u " Start InfiniDB automatically"
Pop $SvcMode
${NSD_SetState} $SvcMode ${BST_CHECKED}
${NSD_CreateCheckBox} 0 75u 100% 12u " Append InfiniDB to system PATH"
Pop $ApndSysPath
${NSD_SetState} $ApndSysPath ${BST_CHECKED}
${NSD_CreateLabel} 12u 88u 100% 12u "CAUTION: if your system PATH is at or near 8K chars in length"
${NSD_CreateLabel} 12u 98u 100% 12u "uncheck this box and set the system PATH manually!"
nsDialogs::Show
FunctionEnd
Function nsDialogsPageLeave
${NSD_GetText} $Port $PortChoice
${NSD_GetState} $SvcMode $9
StrCmp $9 ${BST_UNCHECKED} 0 ModeChecked
StrCpy $SvcModeChoice "demand"
ModeChecked:
${NSD_GetState} $ApndSysPath $9
StrCmp $9 ${BST_UNCHECKED} 0 AppendChecked
StrCpy $ApndSysPathChoice "no"
AppendChecked:
FunctionEnd
Page directory
Page custom nsDialogsPage nsDialogsPageLeave
Page instfiles

View File

@ -1,452 +0,0 @@
!include "EnvVarUpdate.nsh"
!include "WordFunc.nsh"
!include nsDialogs.nsh
Name InfiniDB
InstallDir c:\Calpont
InstallDirRegKey HKLM SOFTWARE\Calpont\InfiniDB ""
OutFile InfiniDB64-ent.exe
!define DISPLAY_URL http://www.infinidb.co/
!define DISPLAY_VERSION "4.6"
VIAddVersionKey "FileVersion" "4.6-0"
VIProductVersion "4.6.0.0"
VIAddVersionKey "ProductVersion" "${DISPLAY_VERSION}"
VIAddVersionKey "CompanyName" "InfiniDB, Inc."
VIAddVersionKey "FileDescription" "InfiniDB Enterprise Windows 64-bit Installer"
VIAddVersionKey "LegalCopyright" "Copyright (c) 2014"
VIAddVersionKey "ProductName" "InfiniDB"
XPStyle on
Var Dialog
Var PortLabel
Var Port
Var PortChoice
Var SvcMode
Var SvcModeChoice
Var ApndSysPath
Var ApndSysPathChoice
Section
ExecWait 'sc.exe stop InfiniDB'
IfFileExists $INSTDIR\bin\svcwait.bat 0 PreInstStopped1
ClearErrors
ExecWait '"$INSTDIR\bin\svcwait.bat" STOPPED 120'
IfErrors PreInstStopped1 0
Delete $INSTDIR\tmp\InfiniDB.pids
PreInstStopped1:
IfFileExists $INSTDIR\bin\winfinidb.exe 0 PreInstStopped2
ExecWait '"$INSTDIR\bin\winfinidb.exe" stop'
Delete $INSTDIR\tmp\InfiniDB.pids
PreInstStopped2:
SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\uninstall.exe
IfFileExists $INSTDIR\my.ini 0 MyIniNotExists
File /oname=$INSTDIR\my_dist.ini my.ini
Goto MyIniExists
MyIniNotExists:
File my.ini
MyIniExists:
SetOutPath $INSTDIR\bin
# Enterprise Release files
File ..\..\..\x64\EnterpriseRelease\databaseSizeReport.exe
File ..\..\..\x64\EnterpriseRelease\dumpcol.exe
File ..\..\..\x64\EnterpriseRelease\oid2file.exe
File ..\..\..\x64\EnterpriseRelease\dumpVss.exe
# Standard Release Files
File ..\..\..\x64\EnterpriseRelease\clearShm.exe
File ..\..\..\x64\EnterpriseRelease\colxml.exe
File ..\..\..\x64\EnterpriseRelease\controllernode.exe
File ..\..\..\x64\EnterpriseRelease\cpimport.exe
File ..\..\..\x64\EnterpriseRelease\dbbuilder.exe
File ..\..\..\x64\EnterpriseRelease\DDLProc.exe
File ..\..\..\x64\EnterpriseRelease\DMLProc.exe
File ..\..\..\x64\EnterpriseRelease\editem.exe
File ..\..\..\x64\EnterpriseRelease\ExeMgr.exe
File ..\..\..\x64\EnterpriseRelease\load_brm.exe
File ..\..\..\x64\EnterpriseRelease\WriteEngineServer.exe
File ..\..\..\x64\EnterpriseRelease\DecomSvr.exe
File ..\..\..\x64\EnterpriseRelease\PrimProc.exe
File ..\..\..\x64\EnterpriseRelease\save_brm.exe
File ..\..\..\x64\EnterpriseRelease\viewtablelock.exe
File ..\..\..\x64\EnterpriseRelease\winfinidb.exe
File ..\..\..\x64\EnterpriseRelease\workernode.exe
File ..\..\..\x64\EnterpriseRelease\cleartablelock.exe
File ..\..\..\x64\EnterpriseRelease\ddlcleanup.exe
File ..\..\..\x64\EnterpriseRelease\getConfig.exe
File ..\..\..\x64\EnterpriseRelease\setConfig.exe
File ..\..\..\x64\EnterpriseRelease\dbrmctl.exe
File ..\..\..\x64\EnterpriseRelease\reset_locks.exe
File ..\..\..\mysql\sql\Release\mysqld.exe
File ..\..\..\mysql\storage\myisam\Release\myisam_ftdump.exe
File ..\..\..\mysql\storage\myisam\Release\myisamchk.exe
File ..\..\..\mysql\storage\myisam\Release\myisamlog.exe
File ..\..\..\mysql\storage\myisam\Release\myisampack.exe
File ..\..\..\mysql\client\Release\mysql.exe
File ..\..\..\mysql\client\Release\mysql_upgrade.exe
File ..\..\..\mysql\client\Release\mysqladmin.exe
File ..\..\..\mysql\client\Release\mysqlbinlog.exe
File ..\..\..\mysql\client\Release\mysqlcheck.exe
File ..\..\..\mysql\client\Release\mysqldump.exe
File ..\..\..\mysql\client\Release\mysqlimport.exe
File ..\..\..\mysql\server-tools\instance-manager\Release\mysqlmanager.exe
File ..\..\..\mysql\client\Release\mysqlshow.exe
File ..\..\..\mysql\client\Release\mysqlslap.exe
File ..\..\..\mysql\client\Release\mysqltest.exe
File ..\..\..\mysql\storage\archive\Release\ha_archive.dll
File ..\..\..\mysql\storage\federated\Release\ha_federated.dll
File ..\..\..\mysql\storage\innodb_plugin\Release\ha_innodb_plugin.dll
File ..\..\..\mysql\libmysql\Release\libmysql.dll
File ..\..\..\x64\EnterpriseRelease\libcalmysql.dll
File ..\..\..\x64\EnterpriseRelease\libconfigcpp.dll
File ..\..\..\x64\EnterpriseRelease\libddlpackageproc.dll
File ..\..\..\x64\EnterpriseRelease\libdmlpackageproc.dll
File ..\..\..\x64\EnterpriseRelease\libjoblist.dll
File ..\..\..\x64\EnterpriseRelease\libwriteengine.dll
File ..\..\..\x64\EnterpriseRelease\libudfsdk.dll
File ..\..\..\x64\EnterpriseRelease\libudf_mysql.dll
File ..\..\..\libxml2-2.7.8\libxml2\win32\Release\libxml2.dll
File ..\..\..\libiconv-1.14\libiconv\Release\libiconv.dll
File ..\..\oamapps\calpontSupport\calpontSupport.bat
File ..\..\..\vcredist_x64.exe
File ..\..\..\x64\EnterpriseRelease\bootstrap.exe
File svcwait.bat
File idbsvsta.bat
File idbsvsto.bat
File idbmysql.bat
SetOutPath $INSTDIR\bulk\data\import
SetOutPath $INSTDIR\bulk\job
SetOutPath $INSTDIR\bulk\log
SetOutPath $INSTDIR\data1
SetOutPath $INSTDIR\dbrm
SetOutPath $INSTDIR\etc
File win_setup_mysql_part1.sql
File win_setup_mysql_part2.sql
File win_setup_mysql_part3.sql
File win_setup_mysql_part3.1.sql
File win_setup_mysql_part4.sql
File win_setup_mysql_part5.sql
File CalpontVersion.txt
IfFileExists $INSTDIR\etc\Columnstore.xml 0 CfgNotExists
File /oname=$INSTDIR\etc\Calpont_dist.xml Columnstore.xml
Goto CfgExists
CfgNotExists:
File Columnstore.xml
CfgExists:
File ..\..\utils\loggingcpp\ErrorMessage.txt
File ..\..\utils\loggingcpp\MessageFile.txt
SetOutPath $INSTDIR\log
SetOutPath $INSTDIR\local
SetOutPath $INSTDIR\mysqldb
SetOutPath $INSTDIR\share
File /r ..\..\..\mysql\sql\share\charsets
File /r ..\..\..\mysql\sql\share\czech
File /r ..\..\..\mysql\sql\share\danish
File /r ..\..\..\mysql\sql\share\dutch
File /r ..\..\..\mysql\sql\share\english
File /r ..\..\..\mysql\sql\share\estonian
File /r ..\..\..\mysql\sql\share\french
File /r ..\..\..\mysql\sql\share\german
File /r ..\..\..\mysql\sql\share\greek
File /r ..\..\..\mysql\sql\share\hungarian
File /r ..\..\..\mysql\sql\share\italian
File /r ..\..\..\mysql\sql\share\japanese
File /r ..\..\..\mysql\sql\share\japanese-sjis
File /r ..\..\..\mysql\sql\share\korean
File /r ..\..\..\mysql\sql\share\norwegian
File /r ..\..\..\mysql\sql\share\norwegian-ny
File /r ..\..\..\mysql\sql\share\polish
File /r ..\..\..\mysql\sql\share\portuguese
File /r ..\..\..\mysql\sql\share\romanian
File /r ..\..\..\mysql\sql\share\russian
File /r ..\..\..\mysql\sql\share\serbian
File /r ..\..\..\mysql\sql\share\slovak
File /r ..\..\..\mysql\sql\share\spanish
File /r ..\..\..\mysql\sql\share\swedish
File /r ..\..\..\mysql\sql\share\ukrainian
SetOutPath $INSTDIR\tmp
SetOutPath $INSTDIR\sql
File ..\..\dbcon\mysql\dumpcat_mysql.sql
File ..\..\dbcon\mysql\calsetuserpriority.sql
File ..\..\dbcon\mysql\calremoveuserpriority.sql
File ..\..\dbcon\mysql\calshowprocesslist.sql
WriteRegStr HKLM Software\Calpont\InfiniDB "" $INSTDIR
WriteRegStr HKLM Software\Calpont\InfiniDB "CalpontHome" $INSTDIR\etc
WriteRegStr HKLM Software\Calpont\InfiniDB "ConfigFile" $INSTDIR\etc\Columnstore.xml
StrCmp $ApndSysPathChoice 'yes' 0 DontAppendSysPath
Push "PATH"
Push "A"
Push "HKLM"
Push "$INSTDIR\bin"
Call EnvVarUpdate
Pop $0
DontAppendSysPath:
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "DisplayName" "InfiniDB"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "Publisher" "InfiniDB, Inc."
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "HelpLink" "${DISPLAY_URL}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "URLUpdateInfo" "${DISPLAY_URL}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "URLInfoAbout" "${DISPLAY_URL}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "DisplayVersion" "${DISPLAY_VERSION}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "VersionMajor" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "VersionMinor" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "NoRepair" "1"
ExecWait "$INSTDIR\bin\vcredist_x64.exe /quiet /norestart"
ClearErrors
ExecWait "$INSTDIR\bin\bootstrap.exe $PortChoice"
IfErrors 0 BootstrapOK
MessageBox MB_ICONSTOP "Fatal error installing InfiniDB"
Abort
BootstrapOK:
ExecWait '"$INSTDIR\bin\winfinidb.exe" stop'
ClearErrors
ExecWait 'sc.exe create InfiniDB binPath= "$INSTDIR\bin\winfinidb.exe" start= $SvcModeChoice'
ExecWait 'sc.exe description InfiniDB "InfiniDB Database Engine"'
StrCmp $SvcModeChoice 'auto' 0 DontStartSvc
ExecWait 'sc.exe start InfiniDB'
ExecWait '"$INSTDIR\bin\svcwait.bat" RUNNING 120'
DontStartSvc:
ClearErrors
CreateDirectory "$SMPROGRAMS\InfiniDB"
CreateShortCut "$SMPROGRAMS\InfiniDB\SQL Prompt.lnk" "$INSTDIR\bin\mysql.exe" '--defaults-file="$INSTDIR\my.ini" --user=root'
CreateShortCut "$SMPROGRAMS\InfiniDB\Start InfiniDB.lnk" "$INSTDIR\bin\idbsvsta.bat"
CreateShortCut "$SMPROGRAMS\InfiniDB\Stop InfiniDB.lnk" "$INSTDIR\bin\idbsvsto.bat"
WriteINIStr "$SMPROGRAMS\InfiniDB\InfiniDB on the Web.url" "InternetShortcut" "URL" "${DISPLAY_URL}"
ClearErrors
SectionEnd
Section Uninstall
SetRegView 64
ExecWait 'sc.exe stop InfiniDB'
ClearErrors
ExecWait '"$INSTDIR\bin\svcwait.bat" STOPPED 120'
IfErrors PreUninstStopped1 0
Delete $INSTDIR\tmp\InfiniDB.pids
PreUninstStopped1:
ExecWait '"$INSTDIR\bin\winfinidb.exe" stop'
Delete $INSTDIR\tmp\InfiniDB.pids
ExecWait 'sc.exe delete InfiniDB'
Push "PATH"
Push "R"
Push "HKLM"
Push "$INSTDIR\bin"
Call un.EnvVarUpdate
Pop $0
Delete $INSTDIR\uninstall.exe
# Enterprise Release Files
Delete $INSTDIR\bin\databaseSizeReport.exe
Delete $INSTDIR\bin\dumpcol.exe
Delete $INSTDIR\bin\oid2file.exe
Delete $INSTDIR\bin\dumpVss.exe
# Standard Release Files
Delete $INSTDIR\bin\bootstrap.exe
Delete $INSTDIR\bin\clearShm.exe
Delete $INSTDIR\bin\colxml.exe
Delete $INSTDIR\bin\controllernode.exe
Delete $INSTDIR\bin\cpimport.exe
Delete $INSTDIR\bin\dbbuilder.exe
Delete $INSTDIR\bin\DDLProc.exe
Delete $INSTDIR\bin\DMLProc.exe
Delete $INSTDIR\bin\editem.exe
Delete $INSTDIR\bin\ExeMgr.exe
Delete $INSTDIR\bin\libcalmysql.dll
Delete $INSTDIR\bin\libconfigcpp.dll
Delete $INSTDIR\bin\libddlpackageproc.dll
Delete $INSTDIR\bin\libdmlpackageproc.dll
Delete $INSTDIR\bin\libjoblist.dll
Delete $INSTDIR\bin\libwriteengine.dll
Delete $INSTDIR\bin\libudfsdk.dll
Delete $INSTDIR\bin\libudf_mysql.dll
Delete $INSTDIR\bin\libxml2.dll
Delete $INSTDIR\bin\libiconv.dll
Delete $INSTDIR\bin\load_brm.exe
Delete $INSTDIR\bin\myisam_ftdump.exe
Delete $INSTDIR\bin\myisamchk.exe
Delete $INSTDIR\bin\myisamlog.exe
Delete $INSTDIR\bin\myisampack.exe
Delete $INSTDIR\bin\mysql.exe
Delete $INSTDIR\bin\mysql_upgrade.exe
Delete $INSTDIR\bin\mysqladmin.exe
Delete $INSTDIR\bin\mysqlbinlog.exe
Delete $INSTDIR\bin\mysqlcheck.exe
Delete $INSTDIR\bin\mysqld.exe
Delete $INSTDIR\bin\mysqldump.exe
Delete $INSTDIR\bin\mysqlimport.exe
Delete $INSTDIR\bin\mysqlmanager.exe
Delete $INSTDIR\bin\mysqlshow.exe
Delete $INSTDIR\bin\mysqlslap.exe
Delete $INSTDIR\bin\mysqltest.exe
Delete $INSTDIR\bin\DecomSvr.exe
Delete $INSTDIR\bin\PrimProc.exe
Delete $INSTDIR\bin\WriteEngineServer.exe
Delete $INSTDIR\bin\save_brm.exe
Delete $INSTDIR\bin\vcredist_x64.exe
Delete $INSTDIR\bin\viewtablelock.exe
Delete $INSTDIR\bin\winfinidb.exe
Delete $INSTDIR\bin\workernode.exe
Delete $INSTDIR\bin\cleartablelock.exe
Delete $INSTDIR\bin\ddlcleanup.exe
Delete $INSTDIR\bin\getConfig.exe
Delete $INSTDIR\bin\setConfig.exe
Delete $INSTDIR\bin\dbrmctl.exe
Delete $INSTDIR\bin\reset_locks.exe
Delete $INSTDIR\bin\svcwait.bat
Delete $INSTDIR\bin\idbsvsta.bat
Delete $INSTDIR\bin\idbsvsto.bat
Delete $INSTDIR\bin\idbmysql.bat
Delete $INSTDIR\bin\ha_archive.dll
Delete $INSTDIR\bin\ha_federated.dll
Delete $INSTDIR\bin\ha_innodb_plugin.dll
Delete $INSTDIR\bin\libmysql.dll
Delete $INSTDIR\bin\calpontSupport.bat
Delete $INSTDIR\etc\ErrorMessage.txt
Delete $INSTDIR\etc\MessageFile.txt
Delete $INSTDIR\etc\win_setup_mysql_part1.sql
Delete $INSTDIR\etc\win_setup_mysql_part2.sql
Delete $INSTDIR\etc\win_setup_mysql_part3.sql
Delete $INSTDIR\etc\win_setup_mysql_part3.1.sql
Delete $INSTDIR\etc\win_setup_mysql_part4.sql
Delete $INSTDIR\etc\win_setup_mysql_part5.sql
Delete $INSTDIR\etc\Calpont_save.xml
Rename $INSTDIR\etc\Columnstore.xml $INSTDIR\etc\Calpont_save.xml
RMDir /r $INSTDIR\share\charsets
RMDir /r $INSTDIR\share\czech
RMDir /r $INSTDIR\share\danish
RMDir /r $INSTDIR\share\dutch
RMDir /r $INSTDIR\share\english
RMDir /r $INSTDIR\share\estonian
RMDir /r $INSTDIR\share\french
RMDir /r $INSTDIR\share\german
RMDir /r $INSTDIR\share\greek
RMDir /r $INSTDIR\share\hungarian
RMDir /r $INSTDIR\share\italian
RMDir /r $INSTDIR\share\japanese
RMDir /r $INSTDIR\share\japanese-sjis
RMDir /r $INSTDIR\share\korean
RMDir /r $INSTDIR\share\norwegian
RMDir /r $INSTDIR\share\norwegian-ny
RMDir /r $INSTDIR\share\polish
RMDir /r $INSTDIR\share\portuguese
RMDir /r $INSTDIR\share\romanian
RMDir /r $INSTDIR\share\russian
RMDir /r $INSTDIR\share\serbian
RMDir /r $INSTDIR\share\slovak
RMDir /r $INSTDIR\share\spanish
RMDir /r $INSTDIR\share\swedish
RMDir /r $INSTDIR\share\ukrainian
Delete $INSTDIR\sql\dumpcat_mysql.sql
Delete $INSTDIR\sql\calsetuserpriority.sql
Delete $INSTDIR\sql\calremoveuserpriority.sql
Delete $INSTDIR\sql\calshowprocesslist.sql
Delete $INSTDIR\my_save.ini
Rename $INSTDIR\my.ini $INSTDIR\my_save.ini
RMDir /r "$SMPROGRAMS\InfiniDB"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB"
SectionEnd
Function .onInit
SetRegView 64
ClearErrors
userInfo::getAccountType
pop $0
StrCmp $0 "Admin" AdminOK
MessageBox MB_ICONSTOP "Administrator privileges are required to install InfiniDB"
Abort
AdminOK:
#set up defaults for these things we ask the user about.
StrCpy $PortChoice "3306"
StrCpy $SvcModeChoice "auto"
StrCpy $ApndSysPathChoice "yes"
# We need to run the 32 bit version of NSIS until the 8K string patch is available for
# the 64 bit release.
# Since we're running the 32 bit version, InstallDirRegKey looks in the wrong place
# because Windows 64 silently puts all the 32 bit registry stuff in Wow6432Node, which
# is where InstallDirRegKey looks. But we don't put our stuff there.
# For some reason, NSIS won't let SetRegView (which would fix the problem) run until after
# InstallDirRegKey is run. Hence this hack to get our install directory from the registry
SetRegView 64
ClearErrors
ReadRegStr $0 HKLM Software\Calpont\InfiniDB ""
IfErrors GotInstDir
StrCpy $INSTDIR $0
GotInstDir:
FunctionEnd
Function nsDialogsPage
nsDialogs::Create 1018
Pop $Dialog
${NSD_CreateLabel} 0 25u 75u 12u "mysqld port number: "
Pop $PortLabel
${NSD_CreateNumber} 75u 25u 50u 12u "3306"
Pop $Port
${NSD_CreateCheckBox} 0 50u 100% 12u " Start InfiniDB automatically"
Pop $SvcMode
${NSD_SetState} $SvcMode ${BST_CHECKED}
${NSD_CreateCheckBox} 0 75u 100% 12u " Append InfiniDB to system PATH"
Pop $ApndSysPath
${NSD_SetState} $ApndSysPath ${BST_CHECKED}
${NSD_CreateLabel} 12u 88u 100% 12u "CAUTION: if your system PATH is at or near 8K chars in length"
${NSD_CreateLabel} 12u 98u 100% 12u "uncheck this box and set the system PATH manually!"
nsDialogs::Show
FunctionEnd
Function nsDialogsPageLeave
${NSD_GetText} $Port $PortChoice
${NSD_GetState} $SvcMode $9
StrCmp $9 ${BST_UNCHECKED} 0 ModeChecked
StrCpy $SvcModeChoice "demand"
ModeChecked:
${NSD_GetState} $ApndSysPath $9
StrCmp $9 ${BST_UNCHECKED} 0 AppendChecked
StrCpy $ApndSysPathChoice "no"
AppendChecked:
FunctionEnd
Page directory
Page custom nsDialogsPage nsDialogsPageLeave
Page instfiles

View File

@ -1,443 +0,0 @@
!include "EnvVarUpdate.nsh"
!include "WordFunc.nsh"
!include nsDialogs.nsh
Name InfiniDB
InstallDir c:\Calpont
InstallDirRegKey HKLM SOFTWARE\Calpont\InfiniDB ""
OutFile InfiniDB64.exe
!define DISPLAY_URL http://www.infinidb.co/
!define DISPLAY_VERSION "4.6"
VIAddVersionKey "FileVersion" "4.6-0"
VIProductVersion "4.6.0.0"
VIAddVersionKey "ProductVersion" "${DISPLAY_VERSION}"
VIAddVersionKey "CompanyName" "InfiniDB, Inc."
VIAddVersionKey "FileDescription" "InfiniDB Standard Windows 64-bit Installer"
VIAddVersionKey "LegalCopyright" "Copyright (c) 2014"
VIAddVersionKey "ProductName" "InfiniDB"
XPStyle on
Var Dialog
Var PortLabel
Var Port
Var PortChoice
Var SvcMode
Var SvcModeChoice
Var ApndSysPath
Var ApndSysPathChoice
Section
ExecWait 'sc.exe stop InfiniDB'
IfFileExists $INSTDIR\bin\svcwait.bat 0 PreInstStopped1
ClearErrors
ExecWait '"$INSTDIR\bin\svcwait.bat" STOPPED 120'
IfErrors PreInstStopped1 0
Delete $INSTDIR\tmp\InfiniDB.pids
PreInstStopped1:
IfFileExists $INSTDIR\bin\winfinidb.exe 0 PreInstStopped2
ExecWait '"$INSTDIR\bin\winfinidb.exe" stop'
Delete $INSTDIR\tmp\InfiniDB.pids
PreInstStopped2:
SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\uninstall.exe
IfFileExists $INSTDIR\my.ini 0 MyIniNotExists
File /oname=$INSTDIR\my_dist.ini my.ini
Goto MyIniExists
MyIniNotExists:
File my.ini
MyIniExists:
SetOutPath $INSTDIR\bin
# Enterprise Release files that need to be removed for standard release
Delete $INSTDIR\bin\databaseSizeReport.exe
Delete $INSTDIR\bin\dumpcol.exe
Delete $INSTDIR\bin\oid2file.exe
Delete $INSTDIR\bin\dumpVss.exe
File ..\..\..\x64\EnterpriseRelease\clearShm.exe
File ..\..\..\x64\EnterpriseRelease\colxml.exe
File ..\..\..\x64\EnterpriseRelease\controllernode.exe
File ..\..\..\x64\EnterpriseRelease\cpimport.exe
File ..\..\..\x64\EnterpriseRelease\dbbuilder.exe
File ..\..\..\x64\EnterpriseRelease\DDLProc.exe
File ..\..\..\x64\EnterpriseRelease\DMLProc.exe
File ..\..\..\x64\EnterpriseRelease\editem.exe
File ..\..\..\x64\EnterpriseRelease\ExeMgr.exe
File ..\..\..\x64\EnterpriseRelease\load_brm.exe
File ..\..\..\x64\EnterpriseRelease\WriteEngineServer.exe
File ..\..\..\x64\EnterpriseRelease\DecomSvr.exe
File ..\..\..\x64\EnterpriseRelease\PrimProc.exe
File ..\..\..\x64\EnterpriseRelease\save_brm.exe
File ..\..\..\x64\EnterpriseRelease\viewtablelock.exe
File ..\..\..\x64\EnterpriseRelease\winfinidb.exe
File ..\..\..\x64\EnterpriseRelease\workernode.exe
File ..\..\..\x64\EnterpriseRelease\cleartablelock.exe
File ..\..\..\x64\EnterpriseRelease\ddlcleanup.exe
File ..\..\..\x64\EnterpriseRelease\getConfig.exe
File ..\..\..\x64\EnterpriseRelease\setConfig.exe
File ..\..\..\x64\EnterpriseRelease\dbrmctl.exe
File ..\..\..\x64\EnterpriseRelease\reset_locks.exe
File ..\..\..\mysql\sql\Release\mysqld.exe
File ..\..\..\mysql\storage\myisam\Release\myisam_ftdump.exe
File ..\..\..\mysql\storage\myisam\Release\myisamchk.exe
File ..\..\..\mysql\storage\myisam\Release\myisamlog.exe
File ..\..\..\mysql\storage\myisam\Release\myisampack.exe
File ..\..\..\mysql\client\Release\mysql.exe
File ..\..\..\mysql\client\Release\mysql_upgrade.exe
File ..\..\..\mysql\client\Release\mysqladmin.exe
File ..\..\..\mysql\client\Release\mysqlbinlog.exe
File ..\..\..\mysql\client\Release\mysqlcheck.exe
File ..\..\..\mysql\client\Release\mysqldump.exe
File ..\..\..\mysql\client\Release\mysqlimport.exe
File ..\..\..\mysql\server-tools\instance-manager\Release\mysqlmanager.exe
File ..\..\..\mysql\client\Release\mysqlshow.exe
File ..\..\..\mysql\client\Release\mysqlslap.exe
File ..\..\..\mysql\client\Release\mysqltest.exe
File ..\..\..\mysql\storage\archive\Release\ha_archive.dll
File ..\..\..\mysql\storage\federated\Release\ha_federated.dll
File ..\..\..\mysql\storage\innodb_plugin\Release\ha_innodb_plugin.dll
File ..\..\..\mysql\libmysql\Release\libmysql.dll
File ..\..\oamapps\calpontSupport\calpontSupport.bat
File ..\..\..\x64\EnterpriseRelease\libcalmysql.dll
File ..\..\..\x64\EnterpriseRelease\libconfigcpp.dll
File ..\..\..\x64\EnterpriseRelease\libddlpackageproc.dll
File ..\..\..\x64\EnterpriseRelease\libdmlpackageproc.dll
File ..\..\..\x64\EnterpriseRelease\libjoblist.dll
File ..\..\..\x64\EnterpriseRelease\libwriteengine.dll
File ..\..\..\x64\EnterpriseRelease\libudfsdk.dll
File ..\..\..\x64\EnterpriseRelease\libudf_mysql.dll
File ..\..\..\libxml2-2.7.8\libxml2\win32\Release\libxml2.dll
File ..\..\..\libiconv-1.14\libiconv\Release\libiconv.dll
File ..\..\..\vcredist_x64.exe
File ..\..\..\x64\EnterpriseRelease\bootstrap.exe
File svcwait.bat
File idbsvsta.bat
File idbsvsto.bat
File idbmysql.bat
SetOutPath $INSTDIR\bulk\data\import
SetOutPath $INSTDIR\bulk\job
SetOutPath $INSTDIR\bulk\log
SetOutPath $INSTDIR\data1
SetOutPath $INSTDIR\dbrm
SetOutPath $INSTDIR\etc
File win_setup_mysql_part1.sql
File win_setup_mysql_part2.sql
File win_setup_mysql_part3.sql
File win_setup_mysql_part3.1.sql
File win_setup_mysql_part4.sql
File win_setup_mysql_part5.sql
File CalpontVersion.txt
IfFileExists $INSTDIR\etc\Columnstore.xml 0 CfgNotExists
File /oname=$INSTDIR\etc\Calpont_dist.xml Columnstore.xml
Goto CfgExists
CfgNotExists:
File Columnstore.xml
CfgExists:
File ..\..\utils\loggingcpp\ErrorMessage.txt
File ..\..\utils\loggingcpp\MessageFile.txt
SetOutPath $INSTDIR\log
SetOutPath $INSTDIR\local
SetOutPath $INSTDIR\mysqldb
SetOutPath $INSTDIR\share
File /r ..\..\..\mysql\sql\share\charsets
File /r ..\..\..\mysql\sql\share\czech
File /r ..\..\..\mysql\sql\share\danish
File /r ..\..\..\mysql\sql\share\dutch
File /r ..\..\..\mysql\sql\share\english
File /r ..\..\..\mysql\sql\share\estonian
File /r ..\..\..\mysql\sql\share\french
File /r ..\..\..\mysql\sql\share\german
File /r ..\..\..\mysql\sql\share\greek
File /r ..\..\..\mysql\sql\share\hungarian
File /r ..\..\..\mysql\sql\share\italian
File /r ..\..\..\mysql\sql\share\japanese
File /r ..\..\..\mysql\sql\share\japanese-sjis
File /r ..\..\..\mysql\sql\share\korean
File /r ..\..\..\mysql\sql\share\norwegian
File /r ..\..\..\mysql\sql\share\norwegian-ny
File /r ..\..\..\mysql\sql\share\polish
File /r ..\..\..\mysql\sql\share\portuguese
File /r ..\..\..\mysql\sql\share\romanian
File /r ..\..\..\mysql\sql\share\russian
File /r ..\..\..\mysql\sql\share\serbian
File /r ..\..\..\mysql\sql\share\slovak
File /r ..\..\..\mysql\sql\share\spanish
File /r ..\..\..\mysql\sql\share\swedish
File /r ..\..\..\mysql\sql\share\ukrainian
SetOutPath $INSTDIR\tmp
SetOutPath $INSTDIR\sql
File ..\..\dbcon\mysql\dumpcat_mysql.sql
File ..\..\dbcon\mysql\calsetuserpriority.sql
File ..\..\dbcon\mysql\calremoveuserpriority.sql
File ..\..\dbcon\mysql\calshowprocesslist.sql
WriteRegStr HKLM Software\Calpont\InfiniDB "" $INSTDIR
WriteRegStr HKLM Software\Calpont\InfiniDB "CalpontHome" $INSTDIR\etc
WriteRegStr HKLM Software\Calpont\InfiniDB "ConfigFile" $INSTDIR\etc\Columnstore.xml
StrCmp $ApndSysPathChoice 'yes' 0 DontAppendSysPath
Push "PATH"
Push "A"
Push "HKLM"
Push "$INSTDIR\bin"
Call EnvVarUpdate
Pop $0
DontAppendSysPath:
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "DisplayName" "InfiniDB"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "Publisher" "InfiniDB, Inc."
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "HelpLink" "${DISPLAY_URL}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "URLUpdateInfo" "${DISPLAY_URL}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "URLInfoAbout" "${DISPLAY_URL}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "DisplayVersion" "${DISPLAY_VERSION}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "VersionMajor" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "VersionMinor" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB" "NoRepair" "1"
ExecWait "$INSTDIR\bin\vcredist_x64.exe /q"
ClearErrors
ExecWait "$INSTDIR\bin\bootstrap.exe $PortChoice"
IfErrors 0 BootstrapOK
MessageBox MB_ICONSTOP "Fatal error installing InfiniDB"
Abort
BootstrapOK:
ExecWait '"$INSTDIR\bin\winfinidb.exe" stop'
ClearErrors
ExecWait 'sc.exe create InfiniDB binPath= "$INSTDIR\bin\winfinidb.exe" start= $SvcModeChoice'
ExecWait 'sc.exe description InfiniDB "InfiniDB Database Engine"'
StrCmp $SvcModeChoice 'auto' 0 DontStartSvc
ExecWait 'sc.exe start InfiniDB'
ExecWait '"$INSTDIR\bin\svcwait.bat" RUNNING 120'
DontStartSvc:
ClearErrors
CreateDirectory "$SMPROGRAMS\InfiniDB"
CreateShortCut "$SMPROGRAMS\InfiniDB\SQL Prompt.lnk" "$INSTDIR\bin\mysql.exe" '--defaults-file="$INSTDIR\my.ini" --user=root'
CreateShortCut "$SMPROGRAMS\InfiniDB\Start InfiniDB.lnk" "$INSTDIR\bin\idbsvsta.bat"
CreateShortCut "$SMPROGRAMS\InfiniDB\Stop InfiniDB.lnk" "$INSTDIR\bin\idbsvsto.bat"
WriteINIStr "$SMPROGRAMS\InfiniDB\InfiniDB on the Web.url" "InternetShortcut" "URL" "${DISPLAY_URL}"
ClearErrors
SectionEnd
Section Uninstall
SetRegView 64
ExecWait 'sc.exe stop InfiniDB'
ClearErrors
ExecWait '"$INSTDIR\bin\svcwait.bat" STOPPED 120'
IfErrors PreUninstStopped1 0
Delete $INSTDIR\tmp\InfiniDB.pids
PreUninstStopped1:
ExecWait '"$INSTDIR\bin\winfinidb.exe" stop'
Delete $INSTDIR\tmp\InfiniDB.pids
ExecWait 'sc.exe delete InfiniDB'
Push "PATH"
Push "R"
Push "HKLM"
Push "$INSTDIR\bin"
Call un.EnvVarUpdate
Pop $0
Delete $INSTDIR\uninstall.exe
Delete $INSTDIR\bin\bootstrap.exe
Delete $INSTDIR\bin\clearShm.exe
Delete $INSTDIR\bin\colxml.exe
Delete $INSTDIR\bin\controllernode.exe
Delete $INSTDIR\bin\cpimport.exe
Delete $INSTDIR\bin\dbbuilder.exe
Delete $INSTDIR\bin\DDLProc.exe
Delete $INSTDIR\bin\DMLProc.exe
Delete $INSTDIR\bin\editem.exe
Delete $INSTDIR\bin\ExeMgr.exe
Delete $INSTDIR\bin\libcalmysql.dll
Delete $INSTDIR\bin\libconfigcpp.dll
Delete $INSTDIR\bin\libddlpackageproc.dll
Delete $INSTDIR\bin\libdmlpackageproc.dll
Delete $INSTDIR\bin\libjoblist.dll
Delete $INSTDIR\bin\libwriteengine.dll
Delete $INSTDIR\bin\libudfsdk.dll
Delete $INSTDIR\bin\libudf_mysql.dll
Delete $INSTDIR\bin\libxml2.dll
Delete $INSTDIR\bin\libiconv.dll
Delete $INSTDIR\bin\load_brm.exe
Delete $INSTDIR\bin\myisam_ftdump.exe
Delete $INSTDIR\bin\myisamchk.exe
Delete $INSTDIR\bin\myisamlog.exe
Delete $INSTDIR\bin\myisampack.exe
Delete $INSTDIR\bin\mysql.exe
Delete $INSTDIR\bin\mysql_upgrade.exe
Delete $INSTDIR\bin\mysqladmin.exe
Delete $INSTDIR\bin\mysqlbinlog.exe
Delete $INSTDIR\bin\mysqlcheck.exe
Delete $INSTDIR\bin\mysqld.exe
Delete $INSTDIR\bin\mysqldump.exe
Delete $INSTDIR\bin\mysqlimport.exe
Delete $INSTDIR\bin\mysqlmanager.exe
Delete $INSTDIR\bin\mysqlshow.exe
Delete $INSTDIR\bin\mysqlslap.exe
Delete $INSTDIR\bin\mysqltest.exe
Delete $INSTDIR\bin\DecomSvr.exe
Delete $INSTDIR\bin\PrimProc.exe
Delete $INSTDIR\bin\WriteEngineServer.exe
Delete $INSTDIR\bin\save_brm.exe
Delete $INSTDIR\bin\vcredist_x64.exe
Delete $INSTDIR\bin\viewtablelock.exe
Delete $INSTDIR\bin\winfinidb.exe
Delete $INSTDIR\bin\workernode.exe
Delete $INSTDIR\bin\cleartablelock.exe
Delete $INSTDIR\bin\ddlcleanup.exe
Delete $INSTDIR\bin\getConfig.exe
Delete $INSTDIR\bin\setConfig.exe
Delete $INSTDIR\bin\dbrmctl.exe
Delete $INSTDIR\bin\reset_locks.exe
Delete $INSTDIR\bin\svcwait.bat
Delete $INSTDIR\bin\idbsvsta.bat
Delete $INSTDIR\bin\idbsvsto.bat
Delete $INSTDIR\bin\idbmysql.bat
Delete $INSTDIR\bin\ha_archive.dll
Delete $INSTDIR\bin\ha_federated.dll
Delete $INSTDIR\bin\ha_innodb_plugin.dll
Delete $INSTDIR\bin\libmysql.dll
Delete $INSTDIR\bin\calpontSupport.bat
Delete $INSTDIR\etc\ErrorMessage.txt
Delete $INSTDIR\etc\MessageFile.txt
Delete $INSTDIR\etc\win_setup_mysql_part1.sql
Delete $INSTDIR\etc\win_setup_mysql_part2.sql
Delete $INSTDIR\etc\win_setup_mysql_part3.sql
Delete $INSTDIR\etc\win_setup_mysql_part3.1.sql
Delete $INSTDIR\etc\win_setup_mysql_part4.sql
Delete $INSTDIR\etc\win_setup_mysql_part5.sql
Delete $INSTDIR\etc\Calpont_save.xml
Rename $INSTDIR\etc\Columnstore.xml $INSTDIR\etc\Calpont_save.xml
RMDir /r $INSTDIR\share\charsets
RMDir /r $INSTDIR\share\czech
RMDir /r $INSTDIR\share\danish
RMDir /r $INSTDIR\share\dutch
RMDir /r $INSTDIR\share\english
RMDir /r $INSTDIR\share\estonian
RMDir /r $INSTDIR\share\french
RMDir /r $INSTDIR\share\german
RMDir /r $INSTDIR\share\greek
RMDir /r $INSTDIR\share\hungarian
RMDir /r $INSTDIR\share\italian
RMDir /r $INSTDIR\share\japanese
RMDir /r $INSTDIR\share\japanese-sjis
RMDir /r $INSTDIR\share\korean
RMDir /r $INSTDIR\share\norwegian
RMDir /r $INSTDIR\share\norwegian-ny
RMDir /r $INSTDIR\share\polish
RMDir /r $INSTDIR\share\portuguese
RMDir /r $INSTDIR\share\romanian
RMDir /r $INSTDIR\share\russian
RMDir /r $INSTDIR\share\serbian
RMDir /r $INSTDIR\share\slovak
RMDir /r $INSTDIR\share\spanish
RMDir /r $INSTDIR\share\swedish
RMDir /r $INSTDIR\share\ukrainian
Delete $INSTDIR\sql\dumpcat_mysql.sql
Delete $INSTDIR\sql\calsetuserpriority.sql
Delete $INSTDIR\sql\calremoveuserpriority.sql
Delete $INSTDIR\sql\calshowprocesslist.sql
Delete $INSTDIR\my_save.ini
Rename $INSTDIR\my.ini $INSTDIR\my_save.ini
RMDir /r "$SMPROGRAMS\InfiniDB"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\InfiniDB"
SectionEnd
Function .onInit
SetRegView 64
ClearErrors
userInfo::getAccountType
pop $0
StrCmp $0 "Admin" AdminOK
MessageBox MB_ICONSTOP "Administrator privileges are required to install InfiniDB"
Abort
AdminOK:
#set up defaults for these things we ask the user about.
StrCpy $PortChoice "3306"
StrCpy $SvcModeChoice "auto"
StrCpy $ApndSysPathChoice "yes"
# We need to run the 32 bit version of NSIS until the 8K string patch is available for
# the 64 bit release.
# Since we're running the 32 bit version, InstallDirRegKey looks in the wrong place
# because Windows 64 silently puts all the 32 bit registry stuff in Wow6432Node, which
# is where InstallDirRegKey looks. But we don't put our stuff there.
# For some reason, NSIS won't let SetRegView (which would fix the problem) run until after
# InstallDirRegKey is run. Hence this hack to get our install directory from the registry
SetRegView 64
ClearErrors
ReadRegStr $0 HKLM Software\Calpont\InfiniDB ""
IfErrors GotInstDir
StrCpy $INSTDIR $0
GotInstDir:
FunctionEnd
Function nsDialogsPage
nsDialogs::Create 1018
Pop $Dialog
${NSD_CreateLabel} 0 25u 75u 12u "mysqld port number: "
Pop $PortLabel
${NSD_CreateNumber} 75u 25u 50u 12u "3306"
Pop $Port
${NSD_CreateCheckBox} 0 50u 100% 12u " Start InfiniDB automatically"
Pop $SvcMode
${NSD_SetState} $SvcMode ${BST_CHECKED}
${NSD_CreateCheckBox} 0 75u 100% 12u " Append InfiniDB to system PATH"
Pop $ApndSysPath
${NSD_SetState} $ApndSysPath ${BST_CHECKED}
${NSD_CreateLabel} 12u 88u 100% 12u "CAUTION: if your system PATH is at or near 8K chars in length"
${NSD_CreateLabel} 12u 98u 100% 12u "uncheck this box and set the system PATH manually!"
nsDialogs::Show
FunctionEnd
Function nsDialogsPageLeave
${NSD_GetText} $Port $PortChoice
${NSD_GetState} $SvcMode $9
StrCmp $9 ${BST_UNCHECKED} 0 ModeChecked
StrCpy $SvcModeChoice "demand"
ModeChecked:
${NSD_GetState} $ApndSysPath $9
StrCmp $9 ${BST_UNCHECKED} 0 AppendChecked
StrCpy $ApndSysPathChoice "no"
AppendChecked:
FunctionEnd
Page directory
Page custom nsDialogsPage nsDialogsPageLeave
Page instfiles

View File

@ -1,208 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
// $Id: idb_getopt.cpp 3495 2013-01-21 14:09:51Z rdempsey $
#include <set>
#include <cctype>
using namespace std;
#include "idb_getopt.h"
struct GetOptData
{
bool initialized;
set<char> opSet;
set<char> opWithArgSet;
char* nextchar;
GetOptData() : initialized(false), nextchar(0)
{
}
};
/* Same as GNU interface. For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
char* optarg;
/* Same as GNU interface. Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far.*/
/* 1003.2 says this must be 1 before any call.*/
int optind = 1;
/* Same as GNU interface. Callers store zero here to inhibit the error message
for unrecognized options. */
int opterr = 1;
/* Same as GNU interface. Set to an option character which was unrecognized.
This must be initialized on some systems to avoid linking in the
system's own getopt implementation. */
int optopt = '?';
namespace
{
/* Keep a global copy of all internal members of getopt_data. */
GetOptData getopt_data;
// only looks at alphabet and numeric in optstring. The other characters
// will be ignored
void initialize_opt(const char* optstring)
{
for (unsigned i = 0; i < strlen(optstring); i++)
{
if (isalnum(optstring[i]))
{
if ((i < strlen(optstring) - 1) && (optstring[i + 1] == ':'))
{
getopt_data.opWithArgSet.insert(optstring[i]);
i++;
}
else
{
getopt_data.opSet.insert(optstring[i]);
}
}
}
getopt_data.initialized = true;
}
} // namespace
int getopt(int argc, char* const* argv, const char* optstring)
{
if (argc < 1)
return -1;
if (!getopt_data.initialized)
initialize_opt(optstring);
int retchar = 0;
char* arg = 0;
bool newArg = false;
int curind = optind;
if (optind < argc)
{
if (getopt_data.nextchar == 0)
{
arg = argv[optind];
newArg = true;
}
else
{
arg = getopt_data.nextchar;
}
// all valid op should be started with '-', with or without arg following.
// stop process when hitting the first non '-' arg that does not belong to a
// previous option.
if (newArg && (strlen(arg) <= 1 || *arg != '-'))
return -1;
if (newArg && (strcmp(arg, "--") == 0))
{
optind++;
return -1;
}
if (newArg && *arg == '-')
arg++;
if (arg != 0)
{
// option without arg
if (getopt_data.opSet.find(*arg) != getopt_data.opSet.end())
{
retchar = *arg;
if (*(arg + 1) == 0) // "-a"
{
optind++;
getopt_data.nextchar = 0;
}
else // "-abc"
{
getopt_data.nextchar = arg + 1;
}
}
// option with arg
else if (getopt_data.opWithArgSet.find(*arg) != getopt_data.opWithArgSet.end())
{
getopt_data.nextchar = 0;
if (*(arg + 1) == 0) // "-c foo" next arg is arg of c
{
if (optind < argc - 1)
{
retchar = *arg;
optind++;
optarg = argv[optind++];
}
else // error. no arg provided for argop. this option is invalid
{
optopt = *arg;
optind++;
retchar = '?';
}
}
else // "-cfoo" arg is in the string right after option letter
{
retchar = *arg;
optarg = arg + 1;
optind++;
}
}
else // invalid option
{
optopt = *arg;
retchar = '?';
if (*(arg + 1) == 0) // "-x"
{
optind++;
getopt_data.nextchar = 0;
}
else // "-xbc"
{
getopt_data.nextchar = arg + 1;
}
}
}
}
if (optind == argc && retchar == 0)
{
optind = curind;
return -1;
}
return retchar;
}

View File

@ -1,50 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
// $Id: idb_getopt.h 3495 2013-01-21 14:09:51Z rdempsey $
#pragma once
/* Same as GNU interface. For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char* optarg;
/* Same as GNU interface. Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Same as GNU interface. Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Same as GNU interface. Set to an option character which was unrecognized. */
extern int optopt;
extern int getopt(int, char* const*, const char*);

View File

@ -1,2 +0,0 @@
@echo off
mysql --user=root %1 %2 %3 %4 %5 %6 %7 %8 %9

View File

@ -1,54 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "idbregistry.h"
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#include <string>
using namespace std;
const string IDBreadRegistry(const string& name, bool returnShortName)
{
HKEY hkResult;
LONG lResult;
lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Calpont\\InfiniDB", 0, KEY_READ, &hkResult);
if (lResult != ERROR_SUCCESS)
return string();
DWORD cbData = 1024;
TCHAR CfnameBuf[1024];
lResult = RegQueryValueEx(hkResult, name.c_str(), 0, 0, (LPBYTE)CfnameBuf, &cbData);
CloseHandle(hkResult);
if (lResult != ERROR_SUCCESS)
return string();
if (!returnShortName)
return string(CfnameBuf);
cbData = 1024;
TCHAR snbuffer[1024];
lResult = GetShortPathName(CfnameBuf, snbuffer, cbData);
if (lResult == 0 || lResult > 1024)
return string();
return string(snbuffer);
}

View File

@ -1,22 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#pragma once
#include <string>
const std::string IDBreadRegistry(const std::string& name, bool returnShortName = false);

View File

@ -1,2 +0,0 @@
sc start InfiniDB
svcwait RUNNING 120

View File

@ -1,2 +0,0 @@
sc stop InfiniDB
svcwait STOPPED 120

View File

@ -1,28 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#pragma once
typedef int key_t;
typedef int pid_t;
typedef int mode_t;
typedef int clockid_t;
typedef int uid_t;
typedef __int64 ssize_t;
#ifndef HAVE_UINT
typedef unsigned int uint32_t;
#endif

View File

@ -1,96 +0,0 @@
#include <iostream>
//#include <unistd.h>
//#define NDEBUG
#include <cassert>
#include <cstring>
#include <string>
using namespace std;
#include "idb_getopt.h"
/*
int getopt1(int argc, char * const argv[],
const char *optstring) __THROW;
extern char *optarg;
extern int optind, opterr, optopt;
*/
int main(int argc, char** argv)
{
opterr = 0;
int c;
bool invalid = false;
bool aflg = false;
bool bflg = false;
bool cflg = false;
bool dflg = false;
string dval;
bool eflg = false;
string eval;
char invchar = 0;
#if defined(TEST1)
char* opts = "";
char* av[] = {0};
#elif defined(TEST2)
char* opts = "-a+bcd:e:";
// char* av[] = { "prg", "-ab", "-dfoo", "-xe", "bar", "file1", "file2", 0 };
// char* av[] = {"prg", "file1", "file2"};
#else
#error Need a test to run!
#endif
// int ac = sizeof(av) / sizeof(av[0]) - 1;
while ((c = getopt(argc, argv, opts)) != -1)
switch (c)
{
case 'a': aflg = true; break;
case 'b': bflg = true; break;
case 'c': cflg = true; break;
case 'd':
dflg = true;
dval = optarg;
break;
case 'e':
eflg = true;
eval = optarg;
break;
case '?':
invalid = true;
invchar = optopt;
break;
default:
invalid = true;
invchar = 0;
break;
}
#if defined(TEST1)
assert(!invalid && !aflg && !bflg && !cflg);
assert(optind == 1);
#elif defined(TEST2)
/* cout << "optind=" << optind << endl;
assert(invalid && aflg && bflg && !cflg);
assert((ac - optind) == 2);
assert(string(av[optind+0]) == "file1");
assert(string(av[optind+1]) == "file2");
assert(dflg);
assert(dval == "foo");
assert(eflg);
assert(eval == "bar");
assert(invchar == 'x');*/
cout << "aflag=" << aflg << " bflag=" << bflg << " cflg=" << cflg << " dflag=" << dflg << " eflag=" << eflg
<< endl;
cout << " eval=" << eval << " dval=" << dval << endl;
cout << " invchar=" << invchar << endl;
cout << " final optind=" << optind << endl;
#endif
return 0;
}

View File

@ -1,224 +0,0 @@
# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows you should keep this file in the installation directory
# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To
# make sure the server reads the config file use the startup option
# "--defaults-file".
#
# To run run the server from the command line, execute this in a
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# To install the server as a Windows service manually, execute this in a
# command line shell, e.g.
# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# And then execute this in a command line shell to start the server, e.g.
# net start MySQLXY
#
#
# Guildlines for editing this file
# ----------------------------------------------------------------------
#
# In this file, you can use all long options that the program supports.
# If you want to know the options a program supports, start the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#
#
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]
port=##PORT##
[mysql]
# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]
plugin_dir="##INSTDIR##/bin"
# The TCP/IP Port the MySQL Server will listen on
port=##PORT##
#Path to installation directory. All paths are usually resolved relative to this.
basedir="##INSTDIR##/"
#Path to the database root
datadir="##INSTDIR##/mysqldb"
# The default character set that will be used when a new schema or table is
# created and no character set is defined
character-set-server=latin1
# The default storage engine that will be used when create new tables when
default-storage-engine=MyISAM
# Set the SQL mode to strict
### sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections=100
# Query cache is used to cache SELECT results and later return them
# without actual executing the same query once again. Having the query
# cache enabled may result in significant speed improvements, if your
# have a lot of identical queries and rarely changing tables. See the
# "Qcache_lowmem_prunes" status variable to check if the current value
# is high enough for your load.
# Note: In case your tables change very often or if your queries are
# textually different every time, the query cache may result in a
# slowdown instead of a performance improvement.
### query_cache_size=0
# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
table_cache=256
# Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them.
tmp_table_size=17M
# How many threads we should keep in a cache for reuse. When a client
# disconnects, the client's threads are put in the cache if there aren't
# more than thread_cache_size threads from before. This greatly reduces
# the amount of thread creations needed if you have a lot of new
# connections. (Normally this doesn't give a notable performance
# improvement if you have a good thread implementation.)
### thread_cache_size=8
#*** MyISAM Specific options
# The maximum size of the temporary file MySQL is allowed to use while
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size=100G
# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method. This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_sort_buffer_size=34M
# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
# Do not set it larger than 30% of your available memory, as some memory
# is also required by the OS to cache rows. Even if you're not using
# MyISAM tables, you should still set it to 8-64M as it will also be
# used for internal temporary disk tables.
key_buffer_size=25M
# Size of the buffer used for doing full table scans of MyISAM tables.
# Allocated per thread, if a full scan is needed.
### read_buffer_size=64K
### read_rnd_buffer_size=256K
# This buffer is allocated when MySQL needs to rebuild the index in
# REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE
# into an empty table. It is allocated per thread so be careful with
# large settings.
### sort_buffer_size=256K
## InfiniDB Specific options
sort_buffer_size = 4M
read_buffer_size = 4M
read_rnd_buffer_size = 16M
thread_cache_size = 8
query_cache_size = 0
thread_stack = 512K
join_buffer_size = 128M
#infinidb_compression_type=0
#*** INNODB Specific options ***
ignore_builtin_innodb
plugin_load=innodb=ha_innodb_plugin.dll
# Use this option if you have a MySQL server with InnoDB support enabled
# but you do not plan to use it. This will save memory and disk space
# and speed up some things.
skip-innodb
# Additional memory pool that is used by InnoDB to store metadata
# information. If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS. As this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size=2M
# If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit=1
# The size of the buffer InnoDB uses for buffering log data. As soon as
# it is full, InnoDB will have to flush it to disk. As it is flushed
# once per second anyway, it does not make sense to have it very large
# (even with long transactions).
innodb_log_buffer_size=1M
# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
# row data. The bigger you set this the less disk I/O is needed to
# access data in tables. On a dedicated database server you may set this
# parameter up to 80% of the machine physical memory size. Do not set it
# too large, though, because competition of the physical memory may
# cause paging in the operating system. Note that on 32bit systems you
# might be limited to 2-3.5G of user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size=46M
# Size of each log file in a log group. You should set the combined size
# of log files to about 25%-100% of your buffer pool size to avoid
# unneeded buffer pool flush activity on log file overwrite. However,
# note that a larger logfile size will increase the time needed for the
# recovery process.
innodb_log_file_size=23M
# Number of threads allowed inside the InnoDB kernel. The optimal value
# depends highly on the application, hardware as well as the OS
# scheduler properties. A too high value may lead to thread thrashing.
innodb_thread_concurrency=8

View File

@ -1,313 +0,0 @@
/*---------------------------------------------------------------------------*\
$Id$
NAME
poll - select(2)-based poll() emulation function for BSD systems.
SYNOPSIS
#include "poll.h"
struct pollfd
{
int fd;
short events;
short revents;
}
int poll (struct pollfd *pArray, unsigned long n_fds, int timeout)
DESCRIPTION
This file, and the accompanying "poll.h", implement the System V
poll(2) system call for BSD systems (which typically do not provide
poll()). Poll() provides a method for multiplexing input and output
on multiple open file descriptors; in traditional BSD systems, that
capability is provided by select(). While the semantics of select()
differ from those of poll(), poll() can be readily emulated in terms
of select() -- which is how this function is implemented.
REFERENCES
Stevens, W. Richard. Unix Network Programming. Prentice-Hall, 1990.
NOTES
1. This software requires an ANSI C compiler.
LICENSE
This software is released under the following license:
Copyright (c) 1995-2002 Brian M. Clapper
All rights reserved.
Redistribution and use in source and binary forms are
permitted provided that: (1) source distributions retain
this entire copyright notice and comment; (2) modifications
made to the software are prominently mentioned, and a copy
of the original software (or a pointer to its location) are
included; and (3) distributions including binaries display
the following acknowledgement: "This product includes
software developed by Brian M. Clapper <bmc@clapper.org>"
in the documentation or other materials provided with the
distribution. The name of the author may not be used to
endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE.
Effectively, this means you can do what you want with the software
except remove this notice or take advantage of the author's name.
If you modify the software and redistribute your modified version,
you must indicate that your version is a modification of the
original, and you must provide either a pointer to or a copy of the
original.
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
Includes
\*---------------------------------------------------------------------------*/
//#include "unistd.h" /* standard Unix definitions */
#include <stdio.h>
#include <io.h>
#define WIN32_LEAN_AND_MEAN
#define __STDC__ 1
#define NOMINMAX
#include <windows.h>
#include <process.h>
#include <winsock2.h>
typedef unsigned long nfds_t;
#include <sys/types.h> /* system types */
//#include <sys/time.h> /* time definitions */
#include <assert.h> /* assertion macros */
#include <string.h> /* string functions */
//#include "poll.h" /* this package */
/*---------------------------------------------------------------------------*\
Macros
\*---------------------------------------------------------------------------*/
#ifndef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
/*---------------------------------------------------------------------------*\
Private Functions
\*---------------------------------------------------------------------------*/
static int map_poll_spec
#if __STDC__ > 0
(struct pollfd *pArray,
nfds_t n_fds,
fd_set *pReadSet,
fd_set *pWriteSet,
fd_set *pExceptSet)
#else
(pArray, n_fds, pReadSet, pWriteSet, pExceptSet)
struct pollfd *pArray;
nfds_t n_fds,
fd_set *pReadSet;
fd_set *pWriteSet;
fd_set *pExceptSet;
#endif
{
register nfds_t i; /* loop control */
register struct pollfd *pCur; /* current array element */
register int max_fd = -1; /* return value */
/*
Map the poll() structures into the file descriptor sets required
by select().
*/
for (i = 0, pCur = pArray; i < n_fds; i++, pCur++)
{
/* Skip any bad FDs in the array. */
if (pCur->fd < 0)
continue;
if (pCur->events & POLLIN)
{
/* "Input Ready" notification desired. */
FD_SET (pCur->fd, pReadSet);
}
if (pCur->events & POLLOUT)
{
/* "Output Possible" notification desired. */
FD_SET (pCur->fd, pWriteSet);
}
if (pCur->events & POLLPRI)
{
/*
"Exception Occurred" notification desired. (Exceptions
include out of band data.
*/
FD_SET (pCur->fd, pExceptSet);
}
max_fd = (int)MAX(max_fd, pCur->fd);
}
return max_fd;
}
static struct timeval *map_timeout
#if __STDC__ > 0
(int poll_timeout, struct timeval *pSelTimeout)
#else
(poll_timeout, pSelTimeout)
int poll_timeout;
struct timeval *pSelTimeout;
#endif
{
struct timeval *pResult;
/*
Map the poll() timeout value into a select() timeout. The possible
values of the poll() timeout value, and their meanings, are:
VALUE MEANING
-1 wait indefinitely (until signal occurs)
0 return immediately, don't block
>0 wait specified number of milliseconds
select() uses a "struct timeval", which specifies the timeout in
seconds and microseconds, so the milliseconds value has to be mapped
accordingly.
*/
assert (pSelTimeout != (struct timeval *) NULL);
switch (poll_timeout)
{
case -1:
/*
A NULL timeout structure tells select() to wait indefinitely.
*/
pResult = (struct timeval *) NULL;
break;
case 0:
/*
"Return immediately" (test) is specified by all zeros in
a timeval structure.
*/
pSelTimeout->tv_sec = 0;
pSelTimeout->tv_usec = 0;
pResult = pSelTimeout;
break;
default:
/* Wait the specified number of milliseconds. */
pSelTimeout->tv_sec = poll_timeout / 1000; /* get seconds */
poll_timeout %= 1000; /* remove seconds */
pSelTimeout->tv_usec = poll_timeout * 1000; /* get microseconds */
pResult = pSelTimeout;
break;
}
return pResult;
}
static void map_select_results
#if __STDC__ > 0
(struct pollfd *pArray,
unsigned long n_fds,
fd_set *pReadSet,
fd_set *pWriteSet,
fd_set *pExceptSet)
#else
(pArray, n_fds, pReadSet, pWriteSet, pExceptSet)
struct pollfd *pArray;
unsigned long n_fds;
fd_set *pReadSet;
fd_set *pWriteSet;
fd_set *pExceptSet;
#endif
{
register unsigned long i; /* loop control */
register struct pollfd *pCur; /* current array element */
for (i = 0, pCur = pArray; i < n_fds; i++, pCur++)
{
/* Skip any bad FDs in the array. */
if (pCur->fd < 0)
continue;
/* Exception events take priority over input events. */
pCur->revents = 0;
if (FD_ISSET (pCur->fd, pExceptSet))
pCur->revents |= POLLPRI;
else if (FD_ISSET (pCur->fd, pReadSet))
pCur->revents |= POLLIN;
if (FD_ISSET (pCur->fd, pWriteSet))
pCur->revents |= POLLOUT;
}
return;
}
/*---------------------------------------------------------------------------*\
Public Functions
\*---------------------------------------------------------------------------*/
int poll
#if __STDC__ > 0
(struct pollfd *pArray, unsigned long n_fds, int timeout)
#else
(pArray, n_fds, timeout)
struct pollfd *pArray;
unsigned long n_fds;
int timeout;
#endif
{
fd_set read_descs; /* input file descs */
fd_set write_descs; /* output file descs */
fd_set except_descs; /* exception descs */
struct timeval stime; /* select() timeout value */
int ready_descriptors; /* function result */
int max_fd; /* maximum fd value */
struct timeval *pTimeout; /* actually passed */
FD_ZERO (&read_descs);
FD_ZERO (&write_descs);
FD_ZERO (&except_descs);
assert (pArray != (struct pollfd *) NULL);
/* Map the poll() file descriptor list in the select() data structures. */
max_fd = map_poll_spec (pArray, n_fds,
&read_descs, &write_descs, &except_descs);
/* Map the poll() timeout value in the select() timeout structure. */
pTimeout = map_timeout (timeout, &stime);
/* Make the select() call. */
ready_descriptors = select (max_fd + 1, &read_descs, &write_descs,
&except_descs, pTimeout);
if (ready_descriptors >= 0)
{
map_select_results (pArray, n_fds,
&read_descs, &write_descs, &except_descs);
}
return ready_descriptors;
}

View File

@ -1,100 +0,0 @@
/*---------------------------------------------------------------------------*\
$Id$
NAME
poll - select(2)-based poll() emulation function for BSD systems.
SYNOPSIS
#include "poll.h"
struct pollfd
{
int fd;
short events;
short revents;
}
int poll (struct pollfd *pArray, unsigned long n_fds, int timeout)
DESCRIPTION
This file, and the accompanying "poll.c", implement the System V
poll(2) system call for BSD systems (which typically do not provide
poll()). Poll() provides a method for multiplexing input and output
on multiple open file descriptors; in traditional BSD systems, that
capability is provided by select(). While the semantics of select()
differ from those of poll(), poll() can be readily emulated in terms
of select() -- which is how this function is implemented.
REFERENCES
Stevens, W. Richard. Unix Network Programming. Prentice-Hall, 1990.
NOTES
1. This software requires an ANSI C compiler.
LICENSE
This software is released under the following license:
Copyright (c) 1995-2002 Brian M. Clapper
All rights reserved.
Redistribution and use in source and binary forms are
permitted provided that: (1) source distributions retain
this entire copyright notice and comment; (2) modifications
made to the software are prominently mentioned, and a copy
of the original software (or a pointer to its location) are
included; and (3) distributions including binaries display
the following acknowledgement: "This product includes
software developed by Brian M. Clapper <bmc@clapper.org>"
in the documentation or other materials provided with the
distribution. The name of the author may not be used to
endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE.
Effectively, this means you can do what you want with the software
except remove this notice or take advantage of the author's name.
If you modify the software and redistribute your modified version,
you must indicate that your version is a modification of the
original, and you must provide either a pointer to or a copy of the
original.
\*---------------------------------------------------------------------------*/
#pragma once
#define POLLIN 0x01
#define POLLPRI 0x02
#define POLLOUT 0x04
#define POLLERR 0x08
#define POLLHUP 0x10
#define POLLNVAL 0x20
struct pollfd
{
int fd;
short events;
short revents;
};
typedef unsigned long nfds_t;
#ifdef __cplusplus
extern "C"
{
#endif
#if (__STDC__ > 0) || defined(__cplusplus)
extern int poll(struct pollfd* pArray, nfds_t n_fds, int timeout);
#else
extern int poll();
#endif
#ifdef __cplusplus
}
#endif

View File

@ -1,14 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by winfinidb.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -1,50 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include <string>
using namespace std;
#include "sedit.h"
namespace winport
{
bool sedit(string& line, const string& find, const string& replace)
{
string::size_type idx;
idx = line.find(find);
if (idx == string::npos)
return false;
line.replace(idx, find.length(), replace);
return true;
}
const string sedit2(const string& line, const string& find, const string& replace)
{
string::size_type idx;
idx = line.find(find);
if (idx == string::npos)
return line;
string nline(line);
nline.replace(idx, find.length(), replace);
return nline;
}
} // namespace winport

View File

@ -1,26 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#pragma once
#include <string>
namespace winport
{
extern bool sedit(std::string& line, const std::string& find, const std::string& replace);
extern const string sedit2(const std::string& line, const std::string& find, const std::string& replace);
} // namespace winport

View File

@ -1,30 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
// $Id$
#include <stdlib.h>
#include "unistd.h"
#if _MSC_VER < 1800
long long atoll(const char* nptr)
{
return strtoll(nptr, 0, 0);
}
#endif

View File

@ -1,60 +0,0 @@
@echo off
rem wait for InfiniDB service to go to state %1 (RUNNING)
rem dont wait more than about %2 (10) seconds
setlocal
set gotit=0
set count=0
set notinst=0
if x%1 equ x goto :defarg1
set state=%1
goto :gotarg1
:defarg1
set state=RUNNING
:gotarg1
if x%2 equ x goto :defarg2
set max=%2
goto :gotarg2
:defarg2
set max=10
:gotarg2
for /f "usebackq tokens=3" %%a in (`sc.exe query InfiniDB`) do call :checkinst %%a
if %notinst% equ 1 goto :notinst
:mainloop
call :checkstate
if %gotit% equ 1 goto :eof
rem echo waiting...
ping 127.0.0.1 -n 2 -w 1000 > nul
set /a count+=1
if %count% geq %max% goto :timedout
goto :mainloop
:checkstate
for /f "usebackq tokens=1-4" %%a in (`sc.exe query InfiniDB`) do call :cshelper %%a %%d
goto :eof
:cshelper
if %1 neq STATE goto :eof
if %2 neq %state% goto :eof
set gotit=1
goto :eof
:checkinst
if %1 neq FAILED goto :eof
set notinst=1
goto :eof
:timedout
echo Timed-out waiting for InfiniDB to go to state %state%!
exit /b 1
goto :eof
:notinst
exit /b 2
goto :eof

View File

@ -1,20 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#ifndef _SYS_TIME_H
#define _SYS_TIME_H 1
#endif

View File

@ -1,94 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* include the various windows libraries for compile */
// Don't include half the development libraries into the bot, they're not needed
#define WIN32_LEAN_AND_MEAN
// Stop windows.h from including winsock.h since winsock.h and winsock2.h are incompatible
#define _WINSOCKAPI_
#include <windows.h>
#include <TlHelp32.h>
#include "sysinfo.h"
// Since windows doesn't seem to have a simple "Number of current processes" available
// we'll just have to make our own >:(
inline int GetProcessList()
{
HANDLE hProcessSnap;
PROCESSENTRY32 pe32;
long Processes = 0;
// Snapshot the current processes and make sure it's valid
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hProcessSnap == INVALID_HANDLE_VALUE)
return Processes;
// Set the size of the structure before using it.
pe32.dwSize = sizeof(PROCESSENTRY32);
// Retrieve information about the first process,
// and exit if unsuccessful
if (!Process32First(hProcessSnap, &pe32))
{
CloseHandle(hProcessSnap); // clean the snapshot object
return Processes;
}
// Count the total number of processes
do
{
Processes++;
} while (Process32Next(hProcessSnap, &pe32));
CloseHandle(hProcessSnap);
return Processes;
}
int sysinfo(struct sysinfo* info)
{
SYSTEM_INFO si;
MEMORYSTATUSEX statex;
ZeroMemory(&si, sizeof(SYSTEM_INFO));
statex.dwLength = sizeof(statex);
GetSystemInfo(&si);
if (!GlobalMemoryStatusEx(&statex))
return -1;
// System Uptime
info->uptime = GetTickCount64() / 1000 % 60;
// Load times - windows does not have this so say -1 or 0 or nothing basically
info->loads[0] = -1;
info->loads[1] = -1;
info->loads[2] = -1;
// Ram usages - note that these may not be exact to what linux has
info->freeram = statex.ullAvailPhys;
info->freeswap = statex.ullAvailVirtual;
info->sharedram = 0;
info->totalram = statex.ullTotalPhys;
info->bufferram = statex.ullTotalPageFile;
info->totalswap = statex.ullTotalVirtual;
// Processes
info->procs = GetProcessList();
return 0;
}

View File

@ -1,37 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#pragma once
// System info stuff
struct sysinfo
{
long uptime; /* Seconds since boot */
unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
unsigned long totalram; /* Total usable main memory size */
unsigned long freeram; /* Available memory size */
unsigned long sharedram; /* Amount of shared memory */
unsigned long bufferram; /* Memory used by buffers */
unsigned long totalswap; /* Total swap space size */
unsigned long freeswap; /* swap space still available */
unsigned short procs; /* Number of current processes */
unsigned long totalhigh; /* Total high memory size */
unsigned long freehigh; /* Available high memory size */
unsigned int mem_unit; /* Memory unit size in bytes */
char _f[20 - 2 * sizeof(long) - sizeof(int)]; /* Padding to 64 bytes */
};
extern int sysinfo(sysinfo*);

View File

@ -1,58 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#pragma once
/* From sys/syslog.h */
#define LOG_EMERG 0 /* system is unusable */
#define LOG_ALERT 1 /* action must be taken immediately */
#define LOG_CRIT 2 /* critical conditions */
#define LOG_ERR 3 /* error conditions */
#define LOG_WARNING 4 /* warning conditions */
#define LOG_NOTICE 5 /* normal but significant condition */
#define LOG_INFO 6 /* informational */
#define LOG_DEBUG 7 /* debug-level messages */
#define LOG_PID 0x01 /* log the pid with each message */
#define LOG_CONS 0x02 /* log on the console if errors in sending */
#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
#define LOG_NDELAY 0x08 /* don't delay open */
#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
#define LOG_PERROR 0x20 /* log to stderr as well */
#define LOG_KERN (0 << 3) /* kernel messages */
#define LOG_USER (1 << 3) /* random user-level messages */
#define LOG_MAIL (2 << 3) /* mail system */
#define LOG_DAEMON (3 << 3) /* system daemons */
#define LOG_AUTH (4 << 3) /* security/authorization messages */
#define LOG_SYSLOG (5 << 3) /* messages generated internally by syslogd */
#define LOG_LPR (6 << 3) /* line printer subsystem */
#define LOG_NEWS (7 << 3) /* network news subsystem */
#define LOG_UUCP (8 << 3) /* UUCP subsystem */
#define LOG_CRON (9 << 3) /* clock daemon */
#define LOG_AUTHPRIV (10 << 3) /* security/authorization messages (private) */
#define LOG_FTP (11 << 3) /* ftp daemon */
#define LOG_LOCAL0 (16 << 3) /* reserved for local use */
#define LOG_LOCAL1 (17 << 3) /* reserved for local use */
#define LOG_LOCAL2 (18 << 3) /* reserved for local use */
#define LOG_LOCAL3 (19 << 3) /* reserved for local use */
#define LOG_LOCAL4 (20 << 3) /* reserved for local use */
#define LOG_LOCAL5 (21 << 3) /* reserved for local use */
#define LOG_LOCAL6 (22 << 3) /* reserved for local use */
#define LOG_LOCAL7 (23 << 3) /* reserved for local use */

View File

@ -1,151 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#pragma once
#include <stdio.h>
#include <io.h>
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#include <process.h>
#include <winsock2.h>
#include <inaddr.h>
#include <stdint.h>
#include <time.h>
#include "inttypes.h"
#ifdef __cplusplus
#include <string>
extern "C"
{
#endif
#if _MSC_VER < 1800
extern unsigned long long strtoull(const char*, char**, int);
extern long long atoll(const char*);
#if _MSC_VER < 1600
extern lldiv_t lldiv(const long long, const long long);
#endif
#endif
extern unsigned int sleep(unsigned int);
#define strerror_r(e, b, l) strerror_s((b), (l), (e))
#ifndef F_OK
#define F_OK 00
#define W_OK 02
#define R_OK 04
#define X_OK 00
#endif
#ifndef F_RDLCK
#define F_RDLCK 1
#define F_SETLKW 2
#define F_UNLCK 3
#define F_WRLCK 4
#define F_SETLK 5
#endif
#ifndef LOCK_SH
#define LOCK_SH 0
#define LOCK_UN 1
#define LOCK_EX 2
#endif
struct flock
{
int l_type;
int l_whence;
int l_start;
int l_len;
int l_pid;
};
extern int flock(int, int);
extern int fcntl(int, int, ...);
#ifndef _my_pthread_h
struct timespec
{
long tv_sec;
long tv_nsec;
};
#endif
int poll(struct pollfd*, unsigned long, int);
#ifndef SHUT_RDWR
#define SHUT_RDWR SD_BOTH
#endif
extern int inet_aton(const char*, struct in_addr*);
struct timezone
{
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
};
extern int gettimeofday(struct timeval*, struct timezone*);
#define ctime_r(tp, b) ctime_s((b), sizeof(b), (tp))
// These are also in MySQL, so we need to fudge them...
#ifndef _my_pthread_h
#define localtime_r idb_localtime_r
extern struct tm* idb_localtime_r(const time_t*, struct tm*);
#define strtoll _strtoi64
#define strtoull _strtoui64
#define crc32 idb_crc32
extern unsigned int idb_crc32(const unsigned int, const unsigned char*, const size_t);
#endif
#define CLOCK_REALTIME 1
#define CLOCK_MONOTONIC 2
extern long clock_gettime(clockid_t, struct timespec*);
extern int syslog(int, const char*, ...);
#ifdef __cplusplus
extern int closelog(...);
extern int openlog(...);
#else
extern int closelog();
extern int openlog();
#endif
extern int usleep(unsigned int);
extern int fork();
extern int getpagesize();
extern int pipe(int[2]);
extern pid_t getppid();
extern pid_t waitpid(pid_t, int*, int);
#define WIFEXITED(x) 0
#define WEXITSTATUS(x) 0
#define WIFSIGNALED(x) 0
#define WTERMSIG(x) 0
#define WNOHANG 0x01
#define WUNTRACED 0x02
#define WCONTINUED 0x04
extern int kill(pid_t, int);
extern int setuid(uid_t);
#define snprintf _snprintf
#ifdef __cplusplus
}
extern int getopt(int argc, char* const* argv, const char* optstring);
extern char* optarg;
extern int optind;
extern int opterr;
extern int optopt;
extern std::string IDBSysErrorStr(DWORD err);
#endif

File diff suppressed because one or more lines are too long

View File

@ -1,61 +0,0 @@
INSTALL PLUGIN infinidb SONAME 'libcalmysql.dll';
CREATE FUNCTION calgetstats RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION calsettrace RETURNS INTEGER SONAME 'libcalmysql.dll';
CREATE FUNCTION calsetparms RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION calflushcache RETURNS INTEGER SONAME 'libcalmysql.dll';
CREATE FUNCTION calgettrace RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION calgetversion RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION calonlinealter RETURNS INTEGER SONAME 'libcalmysql.dll';
CREATE FUNCTION calviewtablelock RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION calcleartablelock RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION calgetsqlcount RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION mcssystemready RETURNS INTEGER SONAME 'libcalmysql.dll';
CREATE FUNCTION mcssystemreadonly RETURNS INTEGER SONAME 'libcalmysql.dll';
create database if not exists calpontsys;
use calpontsys;
drop table if exists systable restrict;
drop table if exists syscolumn restrict;
-- SYSTABLE
create table if not exists systable (
tablename varchar(128),
`schema` varchar(128),
objectid int,
createdate date,
lastupdate date,
init int,
next int,
numofrows int,
avgrowlen int,
numofblocks int,
autoincrement int
) engine=infinidb comment='SCHEMA SYNC ONLY';
-- SYSCOLUMN
create table if not exists syscolumn (
`schema` varchar(128),
tablename varchar(128),
columnname varchar(128),
objectid int,
dictobjectid int,
listobjectid int,
treeobjectid int,
datatype int,
columnlength int,
columnposition int,
lastupdate date,
defaultvalue varchar(64),
nullable int,
scale int,
prec int,
autoincrement char(1),
distcount int,
nullcount int,
minvalue varchar(64),
maxvalue varchar(64),
compressiontype int,
nextvalue bigint
) engine=infinidb comment='SCHEMA SYNC ONLY';

View File

@ -1,12 +0,0 @@
use calpontsys;
select calonlinealter(
'alter table systable add (autoincrement int)') as xxx;
alter table systable add (autoincrement int);
update systable set autoincrement=0 where autoincrement is null;
select calonlinealter(
'alter table syscolumn add (nextvalue bigint)') as xxx;
alter table syscolumn add (nextvalue bigint);
update syscolumn set nextvalue=1 where nextvalue is null;
update syscolumn set autoincrement='n' where autoincrement is null;

View File

@ -1,6 +0,0 @@
use calpontsys;
select calonlinealter(
'alter table syscolumn add (compressiontype int)') as xxx;
alter table syscolumn add (compressiontype int);
update syscolumn set compressiontype=0 where compressiontype is null;

View File

@ -1,22 +0,0 @@
CREATE FUNCTION caldisablepartitions RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION calenablepartitions RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION caldroppartitions RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION calshowpartitions RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION callastinsertid RETURNS INTEGER SONAME 'libcalmysql.dll';
CREATE FUNCTION caldroppartitionsbyvalue RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION caldisablepartitionsbyvalue RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION calenablepartitionsbyvalue RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION calshowpartitionsbyvalue RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION idbpm RETURNS INTEGER soname 'libcalmysql.dll';
CREATE FUNCTION idbdbroot RETURNS INTEGER soname 'libcalmysql.dll';
CREATE FUNCTION idbsegment RETURNS INTEGER soname 'libcalmysql.dll';
CREATE FUNCTION idbsegmentdir RETURNS INTEGER soname 'libcalmysql.dll';
CREATE FUNCTION idbextentrelativerid RETURNS INTEGER soname 'libcalmysql.dll';
CREATE FUNCTION idbblockid RETURNS INTEGER soname 'libcalmysql.dll';
CREATE FUNCTION idbextentid RETURNS INTEGER soname 'libcalmysql.dll';
CREATE FUNCTION idbextentmin RETURNS STRING soname 'libcalmysql.dll';
CREATE FUNCTION idbextentmax RETURNS STRING soname 'libcalmysql.dll';
CREATE FUNCTION idbpartition RETURNS STRING soname 'libcalmysql.dll';
CREATE FUNCTION idblocalpm RETURNS INTEGER soname 'libcalmysql.dll';
CREATE AGGREGATE FUNCTION regr_avgx RETURNS REAL soname 'libcalmysql.dll';

View File

@ -1,44 +0,0 @@
create database if not exists infinidb_vtable;
create database if not exists infinidb_querystats;
create table if not exists infinidb_querystats.querystats
(
queryID bigint NOT NULL AUTO_INCREMENT,
sessionID bigint DEFAULT NULL,
host varchar(50) DEFAULT NULL,
user varchar(50) DEFAULT NULL,
priority char(20) DEFAULT NULL,
queryType char(25),
query varchar(8000),
startTime timestamp NOT NULL,
endTime timestamp NOT NULL,
rows bigint,
errno int,
phyIO bigint,
cacheIO bigint,
blocksTouched bigint,
CPBlocksSkipped bigint,
msgInUM bigint,
msgOutUm bigint,
maxMemPct int,
blocksChanged bigint,
numTempFiles bigint,
tempFileSpace bigint,
PRIMARY KEY (queryID)
);
create table if not exists infinidb_querystats.user_priority
(
host varchar(50),
user varchar(50),
priority char(20)
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
create table if not exists infinidb_querystats.priority
(
priority char(20) primary key,
priority_level int
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
insert ignore into infinidb_querystats.priority
values ('High', 100), ('Medium', 66), ('Low', 33);

View File

@ -1,586 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#include <conio.h>
#include <malloc.h>
#include <unistd.h>
#include <io.h>
#include <direct.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <psapi.h>
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <sstream>
//#define NDEBUG
#include <cassert>
#include <unistd.h>
using namespace std;
#include <boost/algorithm/string/predicate.hpp>
namespace ba = boost::algorithm;
#include "idbregistry.h"
#include "syslog.h"
namespace
{
bool vFlg;
bool useSCMAPI;
SERVICE_STATUS_HANDLE svcStatusHandle;
SERVICE_STATUS svcStatus;
HANDLE svcStopEvent;
struct ProcInfo
{
ProcInfo()
{
}
ProcInfo(const string& name) : pName(name)
{
}
string pName;
string pCmdLine;
};
typedef vector<ProcInfo> ProcInfoVec;
const int interProcessSleepTime = 2;
const size_t cmdLineLen = 128;
string installDir;
bool shuttingDown = false;
int runIt(const string& pName)
{
int rc = 0;
char* cmdLine = (char*)alloca(cmdLineLen);
strncpy_s(cmdLine, cmdLineLen, pName.c_str(), pName.size());
PROCESS_INFORMATION pInfo;
ZeroMemory(&pInfo, sizeof(pInfo));
STARTUPINFO sInfo;
ZeroMemory(&sInfo, sizeof(sInfo));
try
{
if (CreateProcess(0, cmdLine, 0, 0, false, 0, 0, 0, &sInfo, &pInfo) == 0)
return -1;
}
catch (exception& e)
{
cout << e.what() << endl;
}
if (WaitForSingleObject(pInfo.hProcess, INFINITE) != WAIT_OBJECT_0)
{
rc = -1;
goto out;
}
DWORD exitCode;
if (GetExitCodeProcess(pInfo.hProcess, &exitCode) == 0)
{
rc = -1;
goto out;
}
if (exitCode != 0)
rc = -1;
out:
CloseHandle(pInfo.hProcess);
return rc;
}
int loadBRM()
{
// if no save file just return
string saveFile = installDir + "\\dbrm\\BRM_saves_current";
if (GetFileAttributes(saveFile.c_str()) == INVALID_FILE_ATTRIBUTES)
return 0;
// read contents of save file
ifstream ifs(saveFile.c_str());
if (!ifs)
return -1;
string saveFilePfx;
getline(ifs, saveFilePfx);
if (saveFilePfx.empty())
return 0;
// run load_brm and wait for it to finish
string brmCmd = "load_brm \"" + saveFilePfx + "\"";
if (runIt(brmCmd))
return -1;
return 0;
}
void ReportSvcStatus(DWORD currentState, DWORD win32ExitCode, DWORD waitHint)
{
static DWORD checkPoint = 1;
svcStatus.dwCurrentState = currentState;
svcStatus.dwWin32ExitCode = win32ExitCode;
svcStatus.dwWaitHint = waitHint;
if (currentState == SERVICE_START_PENDING)
svcStatus.dwControlsAccepted = 0;
else
svcStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
if (currentState == SERVICE_RUNNING || currentState == SERVICE_STOPPED)
svcStatus.dwCheckPoint = 0;
else
svcStatus.dwCheckPoint = checkPoint++;
SetServiceStatus(svcStatusHandle, &svcStatus);
}
extern "C" DWORD WINAPI procRunner(LPVOID);
int startUp()
{
int rc;
syslog(LOG_INFO, "System is starting");
if (runIt("clearShm"))
return -1;
rc = loadBRM();
if (rc)
return rc;
ProcInfoVec procInfo;
procInfo.push_back(ProcInfo("workernode DBRM_Worker1 fg"));
procInfo.push_back(ProcInfo("controllernode fg"));
procInfo.push_back(ProcInfo("DecomSvr"));
procInfo.push_back(ProcInfo("PrimProc"));
procInfo.push_back(ProcInfo("WriteEngineServer"));
procInfo.push_back(ProcInfo("ExeMgr"));
procInfo.push_back(ProcInfo("DDLProc"));
procInfo.push_back(ProcInfo("DMLProc"));
string mysqldCmd = "mysqld --defaults-file=" + installDir + "\\my.ini";
procInfo.push_back(ProcInfo(mysqldCmd));
const ProcInfoVec::size_type numProcs = procInfo.size();
for (unsigned pidx = 0; pidx < numProcs; pidx++)
{
cout << "Starting " << procInfo[pidx].pName << "...";
HANDLE thd;
DWORD tid;
thd = CreateThread(0, 0, procRunner, &procInfo[pidx], 0, &tid);
if (thd == NULL)
{
LPTSTR lpBuffer;
LPTSTR* lppBuffer = &lpBuffer;
DWORD fmRes = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, 0,
GetLastError(), 0, (LPSTR)lppBuffer, 0, 0);
cerr << endl;
ostringstream ostr;
ostr << "Failed to start process runner thread for " << procInfo[pidx].pName << ": ";
if (fmRes > 0)
ostr << lpBuffer;
else
ostr << "Unknown error";
cerr << ostr.str() << endl;
syslog(LOG_ERR, ostr.str().c_str());
return -1;
}
Sleep(interProcessSleepTime * 1000);
cout << endl;
if (useSCMAPI)
ReportSvcStatus(SERVICE_START_PENDING, NO_ERROR,
interProcessSleepTime * (static_cast<DWORD>(numProcs) - pidx - 1) * 1000);
}
return 0;
}
DWORD WINAPI procRunner(LPVOID parms)
{
ProcInfo* pip = reinterpret_cast<ProcInfo*>(parms);
ProcInfo pi = *pip;
char* cmdLine = (char*)alloca(cmdLineLen);
strncpy_s(cmdLine, cmdLineLen, pi.pName.c_str(), pi.pName.size());
BOOL cpRc;
PROCESS_INFORMATION pInfo;
STARTUPINFO sInfo;
for (;;)
{
ZeroMemory(&sInfo, sizeof(sInfo));
ZeroMemory(&pInfo, sizeof(pInfo));
cpRc = CreateProcess(0, cmdLine, 0, 0, false, 0, 0, 0, &sInfo, &pInfo);
if (cpRc == 0)
{
LPTSTR lpBuffer;
LPTSTR* lppBuffer = &lpBuffer;
DWORD fmRes = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, 0,
GetLastError(), 0, (LPSTR)lppBuffer, 0, 0);
ostringstream ostr;
cerr << endl;
ostr << "Failed to start process " << pi.pName << ": ";
if (fmRes > 0)
ostr << lpBuffer;
else
ostr << "Unknown error";
cerr << ostr.str() << endl;
syslog(LOG_ERR, ostr.str().c_str());
return -1;
}
else
{
ostringstream ostr;
ostr << pi.pName << " started ";
cerr << ostr.str() << endl;
syslog(LOG_INFO, ostr.str().c_str());
}
WaitForSingleObject(pInfo.hProcess, INFINITE);
ostringstream ostr;
ostr << pi.pName;
if (shuttingDown)
{
ostr << " shut down";
syslog(LOG_INFO, ostr.str().c_str());
}
else
{
ostr << " has died unexpectedly";
syslog(LOG_ERR, ostr.str().c_str());
}
cerr << ostr.str() << endl;
CloseHandle(pInfo.hProcess);
if (shuttingDown)
return 0;
Sleep(10 * 1000);
}
return -1;
}
int killProcByPid(DWORD pid)
{
int rc = -1;
HANDLE hProc;
hProc = OpenProcess(PROCESS_TERMINATE, false, pid);
if (hProc != NULL)
{
if (TerminateProcess(hProc, 0) != 0)
rc = 0;
CloseHandle(hProc);
}
return rc;
}
DWORD maxPids = 64;
DWORD* pids = 0;
int killProcByName(const string& pname)
{
if (!pids)
pids = (DWORD*)malloc(maxPids * sizeof(DWORD));
DWORD needed = 0;
if (EnumProcesses(pids, maxPids * sizeof(DWORD), &needed) == 0)
return -1;
while (needed == maxPids * sizeof(DWORD))
{
maxPids *= 2;
pids = (DWORD*)realloc(pids, maxPids * sizeof(DWORD));
if (EnumProcesses(pids, maxPids * sizeof(DWORD), &needed) == 0)
return -1;
}
int rc = -1;
DWORD numPids = needed / sizeof(DWORD);
DWORD i;
for (i = 0; i < numPids; i++)
{
bool found = false;
if (pids[i] != 0)
{
TCHAR szProcessName[MAX_PATH] = TEXT("<unknown>");
// Get a handle to the process.
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pids[i]);
// Get the process name.
if (NULL != hProcess)
{
HMODULE hMod;
DWORD cbNeeded;
if (EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded))
{
GetModuleBaseName(hProcess, hMod, szProcessName, sizeof(szProcessName) / sizeof(TCHAR));
}
}
if (pname == szProcessName)
found = true;
CloseHandle(hProcess);
}
if (found)
{
rc = killProcByPid(pids[i]);
break;
}
}
return rc;
}
int shutDown()
{
shuttingDown = true;
syslog(LOG_INFO, "System is shutting down");
vector<string> pList;
pList.push_back("mysqld.exe");
pList.push_back("DMLProc.exe");
pList.push_back("DDLProc.exe");
pList.push_back("ExeMgr.exe");
pList.push_back("WriteEngineServer.exe");
pList.push_back("PrimProc.exe");
pList.push_back("DecomSvr.exe");
pList.push_back("controllernode.exe");
pList.push_back("workernode.exe");
vector<string>::iterator iter = pList.begin();
vector<string>::iterator end = pList.end();
vector<string>::size_type i = pList.size();
while (iter != end)
{
if (killProcByName(*iter) == 0)
Sleep(interProcessSleepTime * 1000);
if (useSCMAPI)
ReportSvcStatus(SERVICE_STOP_PENDING, NO_ERROR, static_cast<DWORD>(--i) * interProcessSleepTime * 1000);
++iter;
}
if (runIt("save_brm") == 0)
runIt("clearShm");
if (useSCMAPI)
ReportSvcStatus(SERVICE_STOP_PENDING, NO_ERROR, 0);
return 0;
}
void svcStop()
{
useSCMAPI = true;
ReportSvcStatus(SERVICE_STOP_PENDING, NO_ERROR, 20 * 1000);
SetEvent(svcStopEvent);
}
extern "C" VOID WINAPI svcMain(DWORD, LPSTR*);
// The SCM has asked us to start as a service
int svcStart()
{
SERVICE_TABLE_ENTRY st[] = {
{"InfiniDB", svcMain},
{0, 0},
};
// This call returns when the service has stopped
StartServiceCtrlDispatcher(st);
return 0;
}
extern "C" VOID WINAPI svcCtrlHandler(DWORD);
VOID WINAPI svcMain(DWORD dwArgc, LPSTR* lpszArgv)
{
useSCMAPI = true;
svcStatusHandle = RegisterServiceCtrlHandler("InfiniDB", svcCtrlHandler);
svcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
svcStatus.dwServiceSpecificExitCode = 0;
ReportSvcStatus(SERVICE_START_PENDING, NO_ERROR, interProcessSleepTime * 7 * 1000);
svcStopEvent = CreateEvent(0, 1, 0, 0);
if (startUp() != 0)
{
ReportSvcStatus(SERVICE_STOPPED, 1, 0);
return;
}
ReportSvcStatus(SERVICE_RUNNING, NO_ERROR, 0);
WaitForSingleObject(svcStopEvent, INFINITE);
shutDown();
CloseHandle(svcStopEvent);
ReportSvcStatus(SERVICE_STOPPED, NO_ERROR, 0);
}
VOID WINAPI svcCtrlHandler(DWORD dwCtrl)
{
// Handle the requested control code.
switch (dwCtrl)
{
case SERVICE_CONTROL_STOP: // Notifies a service that it should stop
case SERVICE_CONTROL_SHUTDOWN: // Notifies a service that the system is shutting down so the service can
// perform cleanup tasks
svcStop();
break;
case SERVICE_CONTROL_INTERROGATE: // Notifies a service that it should report its current status
// information to the service control manager
break;
case SERVICE_CONTROL_CONTINUE: // Notifies a paused service that it should resume
break;
case SERVICE_CONTROL_PARAMCHANGE: // Notifies a service that its startup parameters have changed. The
// service should reread its startup parameters
break;
case SERVICE_CONTROL_PAUSE: // Notifies a service that it should pause
break;
default: break;
}
}
} // namespace
int main(int argc, char** argv)
{
opterr = 0;
vFlg = false;
int c;
int rc;
useSCMAPI = false;
while ((c = getopt(argc, argv, "v")) != EOF)
switch (c)
{
case 'v': vFlg = true; break;
case '?':
default: break;
}
if (!vFlg)
{
_close(0);
_close(1);
_close(2);
int fd = -1;
_sopen_s(&fd, "NUL", _O_TEXT | _O_RDONLY, _SH_DENYNO, _S_IREAD);
assert(fd == 0);
fd = -1;
_sopen_s(&fd, "NUL", _O_TEXT | _O_APPEND | _O_WRONLY, _SH_DENYNO, _S_IWRITE);
assert(fd == 1);
fd = -1;
_sopen_s(&fd, "NUL", _O_TEXT | _O_APPEND | _O_WRONLY, _SH_DENYNO, _S_IWRITE);
assert(fd == 2);
}
int (*cmdFp)();
string command;
if (argc - optind < 1)
command = "svcstart";
else
command = argv[optind];
if (ba::istarts_with(command, "sta"))
{
cmdFp = startUp;
}
else if (ba::istarts_with(command, "sto") || ba::istarts_with(command, "sh"))
{
cmdFp = shutDown;
}
else if (ba::istarts_with(command, "sv"))
{
cmdFp = svcStart;
}
else
{
cerr << "Unknown command " << command << " (try 'start' or 'shutdown')" << endl;
return 1;
}
installDir = IDBreadRegistry("", true);
string newDir = installDir + "\\bin";
rc = _chdir(newDir.c_str());
rc = cmdFp();
return (rc ? 1 : 0);
}

View File

@ -1,102 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB, Inc."
VALUE "FileDescription", "InfiniDB Windows Service Manager"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "winfinidb"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "winfinidb.exe"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,219 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include <time.h>
#include <string>
#include <sys/types.h>
#include <map>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
namespace fs = boost::filesystem;
using namespace std;
#include "unistd.h"
#include "stdint.h"
#include "sys/time.h"
#include "syslog.h"
#include "idbregistry.h"
#include "WinSyslog.h"
#include "io.h"
// This is the number of msecs between 1601 and 1970 (+/-)
//#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
// This is the number of 100-nsec intvls btwn 1601 and 1970 (+/-)
const unsigned __int64 EPOCH_DELTA = ((1970Ui64 - 1601Ui64) * 365Ui64 + ((1970Ui64 - 1601Ui64) / 4Ui64) -
((1970Ui64 - 1601Ui64) / 100Ui64) + ((1970Ui64 - 1601Ui64) / 400Ui64)) *
86400Ui64 * 1000Ui64 * 1000Ui64 * 10Ui64;
// returns the secs+usecs since the epoch
int gettimeofday(struct timeval* tvp, struct timezone* tzp)
{
FILETIME ft;
unsigned __int64 tmpres = 0;
static int tzflag;
if (0 != tvp)
{
// returns the current time as the number of 100-nanosecond intervals since January 1, 1601 (UTC)
GetSystemTimeAsFileTime(&ft);
tmpres |= ft.dwHighDateTime;
tmpres <<= 32;
tmpres |= ft.dwLowDateTime;
/*converting file time to unix epoch*/
tmpres -= EPOCH_DELTA;
tmpres /= 10; /*convert into microseconds*/
tvp->tv_sec = (long)(tmpres / 1000000UL);
tvp->tv_usec = (long)(tmpres % 1000000UL);
}
if (0 != tzp)
{
if (!tzflag)
{
_tzset();
tzflag++;
}
tzp->tz_minuteswest = _timezone / 60;
tzp->tz_dsttime = _daylight;
}
return 0;
}
int closelog(...)
{
return 0;
}
int openlog(...)
{
return 0;
}
int syslog(int priority, const char* format, ...)
{
int rtn;
va_list args;
va_start(args, format);
rtn = WinSyslog::instance()->Log(priority, format, args);
va_end(args);
return rtn;
}
int fcntl(int i1, int i2, ...)
{
return 0;
}
int inet_aton(const char* c, struct in_addr* p)
{
p->S_un.S_addr = inet_addr(c);
return 1;
}
int flock(int i1, int i2)
{
return 0;
}
int usleep(unsigned int usecs)
{
unsigned int msecs;
// cvt usecs to msecs
msecs = usecs / 1000;
if (msecs == 0)
msecs++;
Sleep(msecs);
return 0;
}
int fork()
{
return -1;
}
int getpagesize()
{
return 4096;
}
struct tm* idb_localtime_r(const time_t* tp, struct tm* tmp)
{
time_t t = *tp;
errno_t p = 0;
p = localtime_s(tmp, &t);
if (p != 0)
memset(tmp, 0, sizeof(struct tm));
return tmp;
}
// FIXME: need a better impl!
long clock_gettime(clockid_t, struct timespec* tp)
{
SYSTEMTIME st;
GetSystemTime(&st);
tp->tv_sec = st.wHour * 3600 + st.wMinute * 60 + st.wSecond;
tp->tv_nsec = st.wMilliseconds * 1000000;
return 0;
}
#if _MSC_VER < 1600
lldiv_t lldiv(const long long numer, const long long denom)
{
lldiv_t ret;
ret.quot = numer / denom;
ret.rem = numer % denom;
return ret;
}
#endif
unsigned int sleep(unsigned int secs)
{
Sleep(secs * 1000);
return 0;
}
int pipe(int fds[2])
{
return -1;
}
pid_t getppid()
{
return -1;
}
pid_t waitpid(pid_t, int*, int)
{
return -1;
}
int kill(pid_t, int)
{
return -1;
}
int setuid(uid_t)
{
return -1;
}
string IDBSysErrorStr(DWORD err)
{
// Retrieve the system error message for the last-error code
string errstr;
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL);
// Display the error message and exit the process
errstr = (LPCTSTR)lpMsgBuf;
LocalFree(lpMsgBuf);
return errstr;
}

View File

@ -1,22 +0,0 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#pragma once
#ifdef _MSC_VER
typedef unsigned int uint;
#endif