Changes of Revision 18
[-] [+] | Changed | cego.changes |
[-] [+] | Changed | cego.spec ^ |
[-] [+] | Deleted | cego-2.11.2.tar.bz2/TODO~ ^ |
@@ -1,8 +0,0 @@ -In CegoAction, make the following distribution ready -- show systemspace -- check index -- create, list set, drop counter -Manage append mode also for distributed queries -Idea : With session request append mode is set up - -- read performance can be improved by replacing XML protocol by native encoding model | ||
[-] [+] | Deleted | cego-2.11.2.tar.bz2/configure.ac~ ^ |
@@ -1,143 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_DEFUN([AX_CHECK_COMPILER_FLAGS], -[AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX -AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1]) -dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: -AS_LITERAL_IF([$1], - [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1), [ - ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$1" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], - AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes, - AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no) - _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])], - [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$1" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], - eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes, - eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no) - _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS]) -eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1) -AC_MSG_RESULT($ax_check_compiler_flags) -if test "x$ax_check_compiler_flags" = xyes; then - m4_default([$2], :) -else - m4_default([$3], :) -fi -])dnl AX_CHECK_COMPILER_FLAGS - - - -# AC_MINGW32 -# ---------- -# Check for mingw32. This is another way to set the right value for -# EXEEXT. -AU_DEFUN([AC_MINGW32], -[AC_REQUIRE([AC_CANONICAL_HOST])[]dnl -AC_DIAGNOSE([obsolete], - [$0 is obsolete: use AC_CANONICAL_HOST and $host_os])dnl -case $host_os in - *mingw32* ) MINGW32=yes;; - * ) MINGW32=no;; -esac -])# AC_MINGW32 - - - -AC_PREREQ(2.57) -AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS) -AC_CONFIG_SRCDIR([config.h.in]) -AC_CONFIG_HEADER([config.h]) - -# Checks for programs. -AC_PROG_CXX -AC_PROG_CC -AC_PROG_MAKE_SET -AC_PROG_INSTALL -AC_PROG_RANLIB - -# AC_CANONICAL_HOST -AC_MINGW32 - -if [[ "$MINGW32" = "yes" ]] -then - CFLAGS="$CFLAGS -DHAVE_MINGW32" - LDFLAGS="$LDFLAGS -mthreads" -fi - -if [[ "$SHLIBOPT" = "" ]] -then - case "$host_os" in - *darwin* ) - AC_SUBST(CGSHLIBOPT, ["-dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1."]) - AC_SUBST(WPSHLIBOPT, ["-dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1."]) - ;; - *solaris* ) - AC_SUBST(WPSHLIBOPT, ["-shared -W1,-soname,libcgwrap.so.1"]) - AC_SUBST(CGSHLIBOPT, ["-shared -W1,-soname,libcego.so.1"]) - ;; - *freebsd* ) - AC_SUBST(WPSHLIBOPT, ["-shared"]) - AC_SUBST(CGSHLIBOPT, ["-shared"]) - ;; - *linux* ) - AC_SUBST(WPSHLIBOPT, ["-shared"]) - AC_SUBST(CGSHLIBOPT, ["-shared"]) - esac -else - AC_SUBST(WPSHLIBOPT, $SHLIBOPT) - AC_SUBST(CGSHLIBOPT, $SHLIBOPT) -fi - -# Check -mt option required for Sun's Forte CC compiler -# AX_CHECK_COMPILER_FLAGS([-mt], [CXXFLAGS="${CXXFLAGS} -mt"], [CXXFLAGS="${CXXFLAGS} -NO_MT_FLAG"]) -AX_CHECK_COMPILER_FLAGS([-mt], [CXXFLAGS="${CXXFLAGS} -mt"]) - -# Checks for libraries. -# FIXME: Replace `main' with a function in `-lhistory': -AC_CHECK_LIB([history], [add_history]) -# FIXME: Replace `main' with a function in `-lncurses': -AC_CHECK_LIB([ncurses], [main]) -# FIXME: Replace `main' with a function in `-lreadline': -AC_CHECK_LIB([readline], [rl_bind_key]) -# FIXME: Replace `main' with a function in `-lnsl': -AC_CHECK_LIB([nsl], [main]) -# FIXME: Replace `main' with a function in `-lnsl': -AC_CHECK_LIB([socket], [main]) -AC_CHECK_LIB([curses], [main]) -AC_CHECK_LIB([pthread], [main]) -AC_CHECK_LIB([rt], [main]) -AC_CHECK_LIB([crypt], [main]) -AC_CHECK_LIB([ws2_32], [main]) - - -AC_PATH_PROG(STRIP, strip, /usr/bin/strip, $PATH:/bin:/usr/bin:/usr/local/bin) - -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([stdlib.h string.h]) - -AC_CHECK_TOOL(AR,ar) - -# Checks for typedefs, structures, and compiler characteristics. -AC_HEADER_STDBOOL -AC_C_CONST -AC_STRUCT_TM - -AC_MSG_CHECKING(for union semun) -AC_TRY_LINK([#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/sem.h>], -[union semun semun;], -AC_DEFINE(HAVE_UNION_SEMUN) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) - -# Checks for library functions. -AC_FUNC_MALLOC - -AC_CONFIG_FILES([Makefile - src/Makefile] - samples/cgwtest/Makefile - samples/cgplustest/Makefile) -AC_OUTPUT | ||
[-] [+] | Deleted | cego-2.11.2.tar.bz2/samples/chkdb/check007.sql~ ^ |
@@ -1,13 +0,0 @@ --- --- ### Transaction checks --- - -create table t1 ( a int, b string(30)); - -start transaction; -insert into t1 values ( 1, 'xxx'); -insert into t1 values ( 2, 'yyy'); -insert into t1 values ( 3, 'zzz'); -commit; - -drop table t1; | ||
[-] [+] | Deleted | cego-2.11.2.tar.bz2/samples/chkdb/check029.sql~ ^ |
@@ -1,25 +0,0 @@ --- --- ### Counter checks --- --- and basic table creation / retrieval --- - -drop if exists table fico_account; -drop if exists counter 'accid'; - -create table fico_account ( primary aid int not null, accountname string(20)); -create counter 'accid'; -insert into fico_account values ( nextcount('accid'), 'MyAccount'); -insert into fico_account values ( nextcount('accid'), 'YourAccount'); -set counter 'accid' to 1000; -insert into fico_account values ( nextcount('accid'), 'XAccount'); -insert into fico_account values ( nextcount('accid'), 'YAccount'); - - - -set b = nextcount('accid'); - -insert into fico_account values ( setcount('accid', 10000), 'MoreAccount'); - -insert into fico_account values ( nextcount('accid'), 'LastAccount'); -select * from fico_account; | ||
[-] [+] | Deleted | cego-2.11.2.tar.bz2/samples/chkdb/exp.cgadm ^ |
@@ -1 +0,0 @@ -xml export tableset TS1 to 'XXX.xml'; | ||
[-] [+] | Deleted | cego-2.11.2.tar.bz2/samples/chkdb/mkdb~ ^ |
@@ -1,134 +0,0 @@ -#!/bin/sh - -if [ $# -ne 1 ] -then - echo "Usage : mkdb <TS>,<TS>,.." - exit 1 -fi - -TSLIST=`echo $1 | sed 's/,/ /g'` - -############### -# database defs -############### -DBXML=chkdb.xml -DBNAME=chkdb -PAGESIZE=16384 -ADMPORT=2000 -DBPORT=2200 -LOGPORT=3000 -PIDFILE=./db/pid -ADMINUSER=cgadm -ADMINPWD=cgadm - -# DEBUGLEVEL=DEBUG -DEBUGLEVEL=NOTICE - -### end of customizing ### - -rm -rf db -mkdir db -rm -f $DBXML - -echo "Creating xml ..." -cat > $DBXML <<EOF -<?xml version="1.0" ?> -<!DOCTYPE CEGO_DB_SPEC> -<DATABASE NAME="$DBNAME" PAGESIZE="$PAGESIZE" ADMINPORT="$ADMPORT" LOGPORT="$LOGPORT" DATAPORT="$DBPORT" -PIDFILE="$PIDFILE" MAXFID="1" MAXTSID="1" -NUMRECSEMA="1000" NUMSYSPAGESEMA="41" NUMDATAPAGESEMA="41" -NUMIDXPAGESEMA="41" NUMRBPAGESEMA="41" NUMDATAFILESEMA="11" NUMBUFFERPOOLSEMA="11" -MAXFIXTRIES="30" - CSMODE="ON" QESCMODE="ON" LOGMNGPROG="./cglogmng"> -<MODULE NAME="ALL" LEVEL="$DEBUGLEVEL"></MODULE> -</DATABASE> -EOF - -# <MODULE NAME="CegoTableManager" LEVEL="NOTICE"></MODULE> -# <MODULE NAME="CegoAdminThreadPool" LEVEL="NOTICE"></MODULE> -# <MODULE NAME="CegoSelect" LEVEL="NOTICE"></MODULE> - -echo "Creating admin user ...\c" -../../src/cego --mode=adduser --dbxml=${DBXML} --user=${ADMINUSER}/${ADMINPWD} --role=admin - -if [ $? -eq 0 ] -then - echo "... operation ok" -else - echo "... operation failed" - exit 1 -fi - -echo "Creating role ...\c" -../../src/cego --mode=addrole --dbxml=${DBXML} --role=ALL - -if [ $? -eq 0 ] -then - echo "... operation ok" -else - echo "... operation failed" - exit 1 -fi - -for TS in $TSLIST -do - - echo "Creating role ...\c" - ../../src/cego --mode=addperm --dbxml=${DBXML} --permid=${TS}_P --role=ALL --tableset=$TS --filter="ALL" --perm="ALL" - - if [ $? -eq 0 ] - then - echo "... operation ok" - else - echo "... operation failed" - exit 1 - fi -done - - -for TS in $TSLIST -do - - TSROOT=./db - TSTICKET=$TSROOT/${TS}ticket.xml - SYSSIZE=100 - TMPSIZE=3000 - LOGFILESIZE=1000000 - LOGFILENUM=3 - APPFILE=$TSROOT/${TS}data01.dbf - APPSIZE=3000 - SORTAREASIZE=10000000 - DBUSER=lemke - DBPWD=lemke - - - echo "Defining tableset $TS...\c" - ../../src/cego --mode=define --tableset=${TS} -dbxml=${DBXML} --tsdef=tsroot:${TSROOT},tsticket:${TSTICKET},syssize:${SYSSIZE},tmpsize:${TMPSIZE},logfilesize:${LOGFILESIZE},logfilenum:${LOGFILENUM},appfile:${APPFILE},appsize:${APPSIZE},sortareasize:${SORTAREASIZE} - if [ $? -eq 0 ] - then - echo "... operation ok" - else - echo "... operation failed" - exit 1 - fi - - echo "Creating database user for $TS ...\c" - ../../src/cego --mode=adduser --dbxml=${DBXML} --user=${DBUSER}/${DBPWD} --role=ALL - if [ $? -eq 0 ] - then - echo "... operation ok" - else - echo "... operation failed" - exit 1 - fi - - echo "Creating tableset $TS...\c" - ../../src/cego --mode=create --dbxml=${DBXML} --tableset=${TS} - if [ $? -eq 0 ] - then - echo "... operation ok" - else - echo "... operation failed" - exit 1 - fi -done | ||
[-] [+] | Deleted | cego-2.11.2.tar.bz2/samples/chkdb/u.sql ^ |
@@ -1,4 +0,0 @@ -update t1 set b = 'XXXXXX'; -update t1 set b = 'YYYYYY'; -reorganize table t1; -reorganize index i1; | ||
[-] [+] | Deleted | cego-2.11.2.tar.bz2/samples/chkdb/x.exp ^ |
@@ -1,3 +0,0 @@ -<?xml version="1.0" ?> -<!DOCTYPE CEGO_EXPORT> -<TABLESET NAME="TS1"></TABLESET> | ||
[-] [+] | Deleted | cego-2.11.2.tar.bz2/samples/chkdb/x.sql ^ |
@@ -1,25 +0,0 @@ -drop if exists table t1; -create table t1 ( a int, b string(10)); -create index i1 on t1 ( a ); --- create index i2 on t1 ( b ); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -update t1 set b = 'XXXXX' where a = 1; -update t1 set b = 'YYYYYYYYY' where a = 1; -select * from t1 where a = 1; -update t1 set b = 'XXXXX' where a = 1; -select * from t1 where a = 1; - -update t1 set b = 'YYYYYYYYY' where a = 1; -update t1 set b = 'XXXXX' where a = 1; -update t1 set b = 'YYYYYYYYY' where a = 1; -update t1 set b = 'XXXXX' where a = 1; -update t1 set b = 'YYYYYYYYY' where a = 1; \ No newline at end of file | ||
[-] [+] | Deleted | cego-2.11.2.tar.bz2/samples/chkdb/x.sql~ ^ |
@@ -1,21 +0,0 @@ -create table t1 ( a int, b string(10)); -create index i1 on t1 ( 1 ); -create index i2 on t1 ( b ); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -insert into t1 values ( 1 , 'XXXXXXX'); -update t1 set b = 'XXXXX' where a = 1; -update t1 set b = 'YYYYYYYYY' where a = 1; -update t1 set b = 'XXXXX' where a = 1; -update t1 set b = 'YYYYYYYYY' where a = 1; -update t1 set b = 'XXXXX' where a = 1; -update t1 set b = 'YYYYYYYYY' where a = 1; -update t1 set b = 'XXXXX' where a = 1; -update t1 set b = 'YYYYYYYYY' where a = 1; \ No newline at end of file | ||
[-] [+] | Deleted | cego-2.11.2.tar.bz2/src/CegoTransactionManager.cc.old ^ |
@@ -1,985 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// CegoTransactionManager.cc -// ------------------------- -// Cego transaction manager implementation -// -// Design and Implementation by Bjoern Lemke -// -// (C)opyright 2000-2010 Bjoern Lemke -// -// 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; either version 2, or (at your option) -// any later version. -// -// 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; see the file COPYING. If not, write to -// the Free Software Foundation, 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. -// -// IMPLEMENTATION MODULE -// -// Class: CegoTransactionManager -// -// Description: -// -// Status: QG-2.6 -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _REENTRANT -#define _REENTRANT /* basic 3-lines for threads */ -#endif - -// base includes -#include <lfc/Exception.h> -#include <lfc/Sleeper.h> -#include <lfc/ThreadLock.h> - -// cego includes -#include "CegoTransactionManager.h" - -// system includes -#include <string.h> -#include <stdlib.h> - -#include "CegoDataType.h" -#include "CegoTupleState.h" -#include "CegoTableManager.h" -#include "CegoIndexManager.h" - -#define SYS_RBCATLOG "rbcatlog" -#define SYS_UPDTAB "updtab" - -#define SYS_RBCATLOG_TID "tid" -#define SYS_RBCATLOG_FILEID "fileid" -#define SYS_RBCATLOG_PAGEID "pageid" -#define SYS_RBCATLOG_OFFSET "offset" -#define SYS_RBCATLOG_TABLE "table" -#define SYS_RBCATLOG_RB_FILEID "rb_fileid" -#define SYS_RBCATLOG_RB_PAGEID "rb_pageid" -#define SYS_RBCATLOG_RB_OFFSET "rb_offset" - -#define SYS_UPDTAB_TID "tid" -#define SYS_UPDTAB_FILEID "fileid" -#define SYS_UPDTAB_PAGEID "pageid" -#define SYS_UPDTAB_OFFSET "offset" - -static ThreadLock taLock[TABMNG_MAXTABSET]; -extern bool __lockStatOn; - -CegoTransactionManager::CegoTransactionManager(CegoTableManager *pTM) -{ - _pTM = pTM; - - CegoFieldValue defVal; - _rbcatSchema.Insert(CegoField(SYS_RBCATLOG, SYS_RBCATLOG, SYS_RBCATLOG_TID, INT_TYPE, sizeof(int), defVal, true, 1)); - _rbcatSchema.Insert(CegoField(SYS_RBCATLOG, SYS_RBCATLOG, SYS_RBCATLOG_FILEID, INT_TYPE, sizeof(int), defVal, true, 2)); - _rbcatSchema.Insert(CegoField(SYS_RBCATLOG, SYS_RBCATLOG, SYS_RBCATLOG_PAGEID, INT_TYPE, sizeof(int), defVal, true, 3)); - _rbcatSchema.Insert(CegoField(SYS_RBCATLOG, SYS_RBCATLOG, SYS_RBCATLOG_OFFSET, INT_TYPE, sizeof(int), defVal, true, 4)); - _rbcatSchema.Insert(CegoField(SYS_RBCATLOG, SYS_RBCATLOG, SYS_RBCATLOG_TABLE, VARCHAR_TYPE, MAX_OBJNAME_LEN, defVal, false, 5)); - - _updSchema.Insert(CegoField(SYS_UPDTAB, SYS_UPDTAB, SYS_UPDTAB_TID, INT_TYPE, sizeof(int), defVal, true, 1)); - _updSchema.Insert(CegoField(SYS_UPDTAB, SYS_UPDTAB, SYS_UPDTAB_FILEID, INT_TYPE, sizeof(int), defVal, true, 2)); - _updSchema.Insert(CegoField(SYS_UPDTAB, SYS_UPDTAB, SYS_UPDTAB_PAGEID, INT_TYPE, sizeof(int), defVal, true, 3)); - _updSchema.Insert(CegoField(SYS_UPDTAB, SYS_UPDTAB, SYS_UPDTAB_OFFSET, INT_TYPE, sizeof(int), defVal, true, 4)); - - _pDBMng = pTM->getDBMng(); - - _modId = _pDBMng->getModId("CegoTransactionManager"); -} - -CegoTransactionManager::~CegoTransactionManager() -{ - for ( int i=0; i < TABMNG_MAXTABSET; i++) - { - if ( _pRBPage[i].isFixed() ) - { - _pDBMng->bufferUnfix(_pRBPage[i], true, _pTM->getLockHandler()); - } - } -} - -void CegoTransactionManager::release(int tabSetId) -{ - if ( _pRBPage[tabSetId].isFixed() ) - { - _pDBMng->bufferUnfix(_pRBPage[tabSetId], true, _pTM->getLockHandler()); - } -} - -void CegoTransactionManager::reorgSystemSpace(int tabSetId) -{ - - try - { - taLock[tabSetId].writeLock(TS_LOCKTIMEOUT); - } - catch ( Exception e ) - { - - Chain tableSet = _pTM->getDBMng()->getTabSetName(tabSetId); - Chain msg = Chain("System space busy for tableset <") + tableSet + Chain(">, aborting reorganization"); - _pDBMng->log(_modId, Logger::NOTICE, msg); - return; - } - - try - { - _pTM->reorgObject(tabSetId, SYS_RBCATLOG, CegoObject::RBSEG); - _pTM->reorgObject(tabSetId, SYS_UPDTAB, CegoObject::RBSEG); - } - catch ( Exception e ) - { - taLock[tabSetId].unlock(); - throw Exception(EXLOC, Chain("Reorganization failed"), e); - } - taLock[tabSetId].unlock(); - -} - -void CegoTransactionManager::initLock(int tabSetId) -{ - taLock[tabSetId].init(LCKMNG_LOCKWAITDELAY, __lockStatOn); - Chain tableSet = _pTM->getDBMng()->getTabSetName(tabSetId); - taLock[tabSetId].setId(tableSet + Chain("-TA")); -} - -void CegoTransactionManager::createSystemSpace(int tabSetId) -{ - _pTM->createDataTable(tabSetId, SYS_UPDTAB, CegoObject::RBSEG, _updSchema); - _pTM->createDataTable(tabSetId, SYS_RBCATLOG, CegoObject::RBSEG, _rbcatSchema); -} - -void CegoTransactionManager::newRBEntry(int tabSetId, int tid, int fileId, int pageId, int offset, const Chain& tableName) -{ - - if ( _pRBPage[tabSetId].isFixed() == false ) - { - _pTM->getObjectWithFix(tabSetId, SYS_RBCATLOG, CegoObject::RBSEG, _rbe[tabSetId], _pRBPage[tabSetId]); - _rbEntry[tabSetId] = CegoDataPointer(_pRBPage[tabSetId].getFileId(), _pRBPage[tabSetId].getPageId(), _pRBPage[tabSetId].getEntryPos()); - } - - CegoFieldValue fv1(INT_TYPE, &tid, sizeof(int)); - CegoField f1(CegoField(SYS_RBCATLOG, SYS_RBCATLOG, SYS_RBCATLOG_TID, INT_TYPE, sizeof(int), fv1, false, 1)); - - CegoFieldValue fv2(INT_TYPE, &fileId, sizeof(int)); - CegoField f2(CegoField(SYS_RBCATLOG, SYS_RBCATLOG, SYS_RBCATLOG_FILEID, INT_TYPE, sizeof(int), fv2, true, 2)); - - CegoFieldValue fv3(INT_TYPE, &pageId, sizeof(int)); - CegoField f3(CegoField(SYS_RBCATLOG, SYS_RBCATLOG, SYS_RBCATLOG_PAGEID, INT_TYPE, sizeof(int), fv3, true, 3)); - - - CegoFieldValue fv4(INT_TYPE, &offset, sizeof(int)); - CegoField f4(CegoField(SYS_RBCATLOG, SYS_RBCATLOG, SYS_RBCATLOG_OFFSET, INT_TYPE, sizeof(int), fv4, true, 4)); - - CegoFieldValue fv5(VARCHAR_TYPE, (char*)tableName, tableName.length()); - CegoField f5(CegoField(SYS_RBCATLOG, SYS_RBCATLOG, SYS_RBCATLOG_TABLE, VARCHAR_TYPE, MAX_OBJNAME_LEN, fv5, false, 5)); - - ListT<CegoField> fl; - fl.Insert(f1); - fl.Insert(f2); - fl.Insert(f3); - fl.Insert(f4); - fl.Insert(f5); - - - int rbtid = 0; - int rbtastep = 0; - CegoTupleState ts = COMMITTED; - - char *pBufBase = 0; - int buflen = 0; - - _qh.encodeFVL(rbtid, rbtastep, ts, fl, pBufBase, buflen); - - try - { - taLock[tabSetId].readLock(TS_LOCKTIMEOUT); - CegoDataPointer dp = _pTM->insertData(_rbEntry[tabSetId], _rbe[tabSetId], pBufBase, buflen, true); - } - catch ( Exception e ) - { - taLock[tabSetId].unlock(); - free (pBufBase); - throw Exception(EXLOC, Chain("Cannot make rollback entry"), e); - } - taLock[tabSetId].unlock(); - free (pBufBase); - -} - -void CegoTransactionManager::getTransactionAffectedTables(int tabSetId, int tid, SetT<Chain>& tableList) -{ - - taLock[tabSetId].readLock(TS_LOCKTIMEOUT); - - try - { - - CegoObjectCursor *pOC = _pTM->getObjectCursor(tabSetId, SYS_RBCATLOG, SYS_RBCATLOG, CegoObject::RBSEG); - - ListT<CegoField> schema = _rbcatSchema; - - try - { - - CegoDataPointer dp; - bool moreTuple = _pTM->getFirstTuple(pOC, schema, dp); - - while (moreTuple) - { - - CegoField *pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_TID)); - if (pF) - { - int val; - memcpy(&val, pF->getValue().getValue(), sizeof(int)); - if (val == tid) - { - Chain tableName; - pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_TABLE)); - if (pF) - { - tableName = Chain((char*)pF->getValue().getValue()); - tableList.Insert(tableName); - } - } - } - - moreTuple = _pTM->getNextTuple(pOC, schema, dp); - } - - } - - catch ( Exception e ) - { - pOC->abort(); - delete pOC; - throw Exception(EXLOC, Chain("Cannot get affected tables"), e); - } - - pOC->abort(); - delete pOC; - - } - catch ( Exception e ) - { - taLock[tabSetId].unlock(); - throw Exception(EXLOC, Chain("Cannot get affected tables"), e); - } - - taLock[tabSetId].unlock(); - -} - -long CegoTransactionManager::commitTransaction(int tabSetId, int tid) -{ - - long opCount = 0; - - taLock[tabSetId].readLock(TS_LOCKTIMEOUT); - - try - { - - CegoObjectCursor *pOC = _pTM->getObjectCursor(tabSetId, SYS_RBCATLOG, SYS_RBCATLOG, CegoObject::RBSEG); - - ListT<CegoField> schema = _rbcatSchema; - - // Step 1 : Committing all attached tuples - - try { - - - CegoDataPointer dp; - bool moreTuple = _pTM->getFirstTuple(pOC, schema, dp); - - - Chain cachedTable; - ListT<CegoField> cachedFvl; - ListT<CegoTableObject> cachedIdxList; - ListT<CegoKeyObject> cachedKeyList; - ListT<CegoCheckObject> cachedCheckList; - - - while (moreTuple) - { - - CegoField *pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_TID)); - if (pF) - { - int val; - memcpy(&val, pF->getValue().getValue(), sizeof(int)); - if (val == tid) - // if (*(int*)(pF->getValue().getValue()) == tid) - { - - int fileId, pageId, offset; - - pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_FILEID)); - if (pF) - memcpy(&fileId, pF->getValue().getValue(), sizeof(int)); - // fileId = *(int*)pF->getValue().getValue(); - - pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_PAGEID)); - if (pF) - memcpy(&pageId, pF->getValue().getValue(), sizeof(int)); - // pageId = *(int*)pF->getValue().getValue(); - - pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_OFFSET)); - if (pF) - memcpy(&offset, pF->getValue().getValue(), sizeof(int)); - // offset = *(int*)pF->getValue().getValue(); - - CegoDataPointer dp(fileId, pageId, offset); - - int tid; - int tastep; - CegoTupleState ts; - - _pTM->getTupleInfo(tabSetId, dp, tid, tastep, ts); - _pTM->setTupleInfo(tabSetId, dp, 0, 0, COMMITTED); - opCount++; - if ( ts == DELETED || ts == OBSOLETE ) - { - - Chain tableName; - - pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_TABLE)); - if (pF) - tableName = Chain((char*)pF->getValue().getValue()); - - - if ( cachedTable != tableName ) - { - CegoTableObject oe; - _pTM->getObject(tabSetId, tableName, CegoObject::TABLE, oe); - cachedFvl = oe.getSchema(); - cachedTable = tableName; - cachedIdxList.Empty(); - cachedKeyList.Empty(); - cachedCheckList.Empty(); - _pTM->getObjectListByTable(tabSetId, cachedTable, cachedIdxList, cachedKeyList, cachedCheckList); - - } - - char* p; - int len; - unsigned long lockId; - - try - { - lockId = _pTM->claimDataPtr(tabSetId, CegoLockHandler::READ, CegoBufferPool::SYNC, dp, p, len); - - int tid; - int tastep; - CegoTupleState ts; - _qh.decodeFVL(cachedFvl, p, len, tid, tastep, ts); - - _pTM->deleteDataTable(tabSetId, cachedTable, CegoObject::TABLE, dp, cachedFvl, cachedIdxList, cachedKeyList, false); - - } - catch ( Exception e) - { - _pTM->releaseDataPtr(lockId); - throw Exception(EXLOC, Chain("Cannot commit transaction"), e ); - } - _pTM->releaseDataPtr(lockId); - } - } - } - else - { - throw Exception(EXLOC, "Cannot get tid entry"); - } - - moreTuple = _pTM->getNextTuple(pOC, schema, dp); - } - } - catch ( Exception e ) - { - pOC->abort(); - delete pOC; - throw Exception(EXLOC, Chain("Cannot commit transaction"), e); - } - - - pOC->abort(); - delete pOC; - - // Step 2 : Cleaning up rollback segment - - pOC = _pTM->getObjectCursor(tabSetId, SYS_RBCATLOG, SYS_RBCATLOG, CegoObject::RBSEG); - - try { - - CegoDataPointer dp; - bool moreTuple = _pTM->getFirstTuple(pOC, schema, dp); - - while (moreTuple) - { - - CegoField *pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_TID)); - if (pF) - { - if (*(int*)(pF->getValue().getValue()) == tid) - { - CegoDataPointer ddp = dp; - moreTuple = _pTM->getNextTuple(pOC, schema, dp); - - _pTM->deleteData(CegoObject::RBSEG, tabSetId, ddp); - - } - else - { - moreTuple = _pTM->getNextTuple(pOC, schema, dp); - } - } - else - { - throw Exception(EXLOC, "Cannot get tid entry"); - } - } - } - catch ( Exception e ) - { - if ( pOC ) - { - pOC->abort(); - delete pOC; - } - throw Exception(EXLOC, Chain("Cannot commit transaction"), e); - } - - pOC->abort(); - delete pOC; - - } - catch ( Exception e ) - { - taLock[tabSetId].unlock(); - throw Exception(EXLOC, Chain("Cannot commit transaction"), e); - } - - taLock[tabSetId].unlock(); - - return opCount; -} - -long CegoTransactionManager::rollbackTransaction(int tabSetId, int tid) -{ - - long opCount = 0; - - taLock[tabSetId].readLock(TS_LOCKTIMEOUT); - - try - { - - CegoObjectCursor *pOC = _pTM->getObjectCursor(tabSetId, SYS_RBCATLOG, SYS_RBCATLOG, CegoObject::RBSEG); - - ListT<CegoField> schema = _rbcatSchema; - - // step 1 ( tid setting ) - - try - { - - CegoDataPointer dp; - bool moreTuple = _pTM->getFirstTuple(pOC, schema, dp); - - Chain cachedTable; - ListT<CegoField> cachedFvl; - ListT<CegoTableObject> cachedIdxList; - ListT<CegoKeyObject> cachedKeyList; - ListT<CegoCheckObject> cachedCheckList; - - while (moreTuple) - { - CegoField *pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_TID)); - if (pF) - { - - // if (*(int*)(pF->getValue().getValue()) == tid) - - int val; - memcpy(&val, pF->getValue().getValue(), sizeof(int)); - if (val == tid) - { - - int fileId, pageId, offset; - Chain tableName; - - pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_FILEID)); - if (pF) - memcpy(&fileId, pF->getValue().getValue(), sizeof(int)); - // fileId = *(int*)pF->getValue().getValue(); - - pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_PAGEID)); - if (pF) - memcpy(&pageId, pF->getValue().getValue(), sizeof(int)); - // pageId = *(int*)pF->getValue().getValue(); - - pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_OFFSET)); - if (pF) - memcpy(&offset, pF->getValue().getValue(), sizeof(int)); - // offset = *(int*)pF->getValue().getValue(); - - pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_TABLE)); - if (pF) - tableName = Chain((char*)pF->getValue().getValue()); - - - CegoDataPointer dp(fileId, pageId, offset); - - int tid; - int tastep; - CegoTupleState ts; - - _pTM->getTupleInfo(tabSetId, dp, tid, tastep, ts); - _pTM->setTupleInfo(tabSetId, dp, 0, 0, COMMITTED); - opCount++; - - if ( ts == INSERTED || ts == OBSOLETE ) - { - - if ( cachedTable != tableName ) - { - CegoTableObject oe; - _pTM->getObject(tabSetId, tableName, CegoObject::TABLE, oe); - cachedFvl = oe.getSchema(); - cachedTable = tableName; - cachedIdxList.Empty(); - cachedKeyList.Empty(); - cachedCheckList.Empty(); - _pTM->getObjectListByTable(tabSetId, cachedTable, cachedIdxList, cachedKeyList, cachedCheckList); - - } - - char* p; - int len; - unsigned long lockId; - - try - { - lockId = _pTM->claimDataPtr(tabSetId, CegoLockHandler::READ, CegoBufferPool::SYNC, dp, p, len); - - int tid; - CegoTupleState ts; - _qh.decodeFVL(cachedFvl, p, len, tid, tastep, ts); - - _pTM->deleteDataTable(tabSetId, tableName, CegoObject::TABLE, dp, cachedFvl, cachedIdxList, cachedKeyList, false, true); - - } - catch ( Exception e) - { - _pTM->releaseDataPtr(lockId); - - Chain msg; - e.pop(msg); - - // _pDBMng->log(_modId, Logger::NOTICE, Chain("Incomplete rollback for table ") + tableName + Chain(" : ") + msg); - throw Exception(EXLOC, Chain("Cannot delete entry for table"), e); - } - _pTM->releaseDataPtr(lockId); - - } - } - moreTuple = _pTM->getNextTuple(pOC, schema, dp); - } - else - { - throw Exception(EXLOC, "Cannot get tid entry"); - } - } - } - catch ( Exception e ) - { - if ( pOC ) - { - pOC->abort(); - delete pOC; - } - throw Exception(EXLOC, Chain("Cannot rollback transaction"), e); - } - - pOC->abort(); - delete pOC; - - // step 2 ( Purging) - - pOC = _pTM->getObjectCursor(tabSetId, SYS_RBCATLOG, SYS_RBCATLOG, CegoObject::RBSEG); - - try - { - - CegoDataPointer dp; - bool moreTuple = _pTM->getFirstTuple(pOC, schema, dp); - - while (moreTuple) - { - - CegoDataPointer ddp = dp; - moreTuple = _pTM->getNextTuple(pOC, schema, dp); - - _pTM->deleteData(CegoObject::RBSEG, tabSetId, ddp); - - } - } - catch ( Exception e ) - { - if ( pOC ) - { - pOC->abort(); - delete pOC; - } - throw Exception(EXLOC, Chain("Cannot rollback transaction"), e); - } - - pOC->abort(); - delete pOC; - - } - catch ( Exception e ) - { - taLock[tabSetId].unlock(); - throw Exception(EXLOC, Chain("Cannot rollback transaction"), e); - } - - taLock[tabSetId].unlock(); - - return opCount; -} - -void CegoTransactionManager::getOpenTid(int tabSetId, SetT<int>& tidSet) -{ - taLock[tabSetId].readLock(TS_LOCKTIMEOUT); - - try - { - CegoObjectCursor *pOC; - - pOC = _pTM->getObjectCursor(tabSetId, SYS_RBCATLOG, SYS_RBCATLOG, CegoObject::RBSEG); - - try { - - ListT<CegoField> schema = _rbcatSchema; - - CegoDataPointer dp; - bool moreTuple = _pTM->getFirstTuple(pOC, schema, dp); - - while (moreTuple) - { - - CegoField *pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_TID)); - if (pF) - { - int tid; - memcpy(&tid, pF->getValue().getValue(), sizeof(int)); - tidSet.Insert(tid); - // tidSet.Insert ( *(int*)(pF->getValue().getValue())); - } - moreTuple = _pTM->getNextTuple(pOC, schema, dp); - } - } - catch ( Exception e ) - { - pOC->abort(); - delete pOC; - throw Exception(EXLOC, Chain("Cannot get open tid"), e); - } - - pOC->abort(); - delete pOC; - - - pOC = _pTM->getObjectCursor(tabSetId, SYS_UPDTAB, SYS_UPDTAB, CegoObject::RBSEG); - - try - { - ListT<CegoField> schema = _updSchema; - - CegoDataPointer updp; - bool moreTuple = _pTM->getFirstTuple(pOC, schema, updp); - - while (moreTuple) - { - - CegoField *pF = schema.Find(CegoField(SYS_UPDTAB, SYS_UPDTAB_TID)); - - if (pF) - { - int tid; - memcpy(&tid, pF->getValue().getValue(), sizeof(int)); - tidSet.Insert(tid); - - // tidSet.Insert ( *(int*)(pF->getValue().getValue())); - } - moreTuple = _pTM->getNextTuple(pOC, schema, updp); - } - } - catch ( Exception e ) - { - pOC->abort(); - delete pOC; - throw Exception(EXLOC, Chain("Cannot get open tid"), e); - } - - pOC->abort(); - delete pOC; - - } - catch ( Exception e ) - { - taLock[tabSetId].unlock(); - throw Exception(EXLOC, Chain("Cannot get open tid"), e); - } - - taLock[tabSetId].unlock(); - -} - -void CegoTransactionManager::recordUpdate(int tabSetId, int tid, const CegoDataPointer& dp ) -{ - - int fileId = dp.getFileId(); - int pageId = dp.getPageId(); - int offset = dp.getOffset(); - - CegoFieldValue fv1(INT_TYPE, &tid, sizeof(int)); - CegoField f1(CegoField(SYS_UPDTAB, SYS_UPDTAB, SYS_UPDTAB_TID, INT_TYPE, sizeof(int), fv1, true, 1)); - - CegoFieldValue fv2(INT_TYPE, &fileId, sizeof(int)); - CegoField f2(CegoField(SYS_UPDTAB, SYS_UPDTAB, SYS_UPDTAB_FILEID, INT_TYPE, sizeof(int), fv2, true, 2)); - - CegoFieldValue fv3(INT_TYPE, &pageId, sizeof(int)); - CegoField f3(CegoField(SYS_UPDTAB, SYS_UPDTAB, SYS_UPDTAB_PAGEID, INT_TYPE, sizeof(int), fv3, true, 3)); - - CegoFieldValue fv4(INT_TYPE, &offset, sizeof(int)); - CegoField f4(CegoField(SYS_UPDTAB, SYS_UPDTAB, SYS_UPDTAB_OFFSET, INT_TYPE, sizeof(int), fv4, true, 4)); - - ListT<CegoField> fl; - fl.Insert(f1); - fl.Insert(f2); - fl.Insert(f3); - fl.Insert(f4); - - CegoTableObject oe; - _pTM->getObject(tabSetId, SYS_UPDTAB, CegoObject::RBSEG, oe); - - CegoDataPointer idp; - _pTM->insertDataTable(oe, fl, idp, false); - -} - -void CegoTransactionManager::commitUpdate(int tabSetId, const Chain& idxName, int tid, bool doAppend) -{ - - CegoObjectCursor *pOC = _pTM->getObjectCursor(tabSetId, SYS_UPDTAB, SYS_UPDTAB, CegoObject::RBSEG); - - ListT<CegoField> schema = _updSchema; - - CegoDataPointer updp; - bool moreTuple = _pTM->getFirstTuple(pOC, schema, updp); - - while (moreTuple) - { - - CegoField *pF = schema.Find(CegoField(SYS_UPDTAB, SYS_UPDTAB_TID)); - - if (pF) - { - - // if ( *(int*)pF->getValue().getValue() == tid ) - int val; - memcpy(&val, pF->getValue().getValue(), sizeof(int)); - if (val == tid) - { - - pOC->abort(); - delete pOC; - - int fileId, pageId, offset; - - CegoField *pF = schema.Find(CegoField(SYS_UPDTAB, SYS_UPDTAB_FILEID)); - if (pF) - fileId = *(int*)pF->getValue().getValue(); - - pF = schema.Find(CegoField(SYS_UPDTAB, SYS_UPDTAB_PAGEID)); - if (pF) - pageId = *(int*)pF->getValue().getValue(); - - pF = schema.Find(CegoField(SYS_UPDTAB, SYS_UPDTAB_OFFSET)); - if (pF) - offset = *(int*)pF->getValue().getValue(); - - CegoDataPointer dp(fileId, pageId, offset); - - ListT<CegoTableObject> idxList; - - CegoTableObject ioe; - - CegoBufferPage bp; - _pTM->getObjectWithFix(tabSetId, idxName, CegoObject::INDEX, ioe, bp); - - ListT<CegoField> fvl = ioe.getSchema(); - - char* p; - int len; - - CegoDataPointer sysEntry(bp.getFileId(), bp.getPageId(), bp.getEntryPos()); - - unsigned long lockId = _pTM->claimDataPtr(tabSetId, CegoLockHandler::READ, CegoBufferPool::SYNC, dp, p, len); - - int tid; - int tastep; - CegoTupleState ts; - _qh.decodeFVL(fvl, p, len, tid, tastep, ts); - - char ip[TABMNG_MAXINDEXVALUE]; - int ilen = TABMNG_MAXINDEXVALUE; - int idxLen; - CegoDataPointer ritp; - - _pTM->extractIndexValue(fvl, ioe.getSchema(), ip, ilen, idxLen); - - bool resolveIt = true; - - try - { - CegoIndexManager idxMng(_pTM, ioe.getType()); - idxMng.insertNativeIndexTable(ioe, dp, ip, idxLen, tid, ritp, sysEntry, doAppend); - } - catch ( Exception e ) - { - - _pTM->releaseDataPtr(lockId); - _pTM->getDBMng()->bufferUnfix(bp, true, _pTM->getLockHandler()); - - throw Exception(EXLOC, Chain("Cannot commit update"), e); - - } - - _pTM->releaseDataPtr(lockId); - - // now we can release the index root page - _pTM->getDBMng()->bufferUnfix(bp, true, _pTM->getLockHandler()); - - _pTM->deleteData( CegoObject::RBSEG, tabSetId, updp); - - pOC = _pTM->getObjectCursor(tabSetId, SYS_UPDTAB, SYS_UPDTAB, CegoObject::RBSEG); - - moreTuple = _pTM->getFirstTuple(pOC, schema, updp); - - } - else - { - moreTuple = _pTM->getNextTuple(pOC, schema, updp); - } - } - else - { - pOC->abort(); - delete pOC; - throw Exception(EXLOC, "Cannot get tid entry"); - } - } - pOC->abort(); - delete pOC; - -} - -void CegoTransactionManager::getTransactionInfo(int tabSetId, int tid, int& undoop, int& updop) -{ - - CegoObjectCursor *pOC; - - pOC = _pTM->getObjectCursor(tabSetId, SYS_RBCATLOG, SYS_RBCATLOG, CegoObject::RBSEG); - - try { - - ListT<CegoField> schema = _rbcatSchema; - - CegoDataPointer dp; - bool moreTuple = _pTM->getFirstTuple(pOC, schema, dp); - - undoop=0; - while (moreTuple) - { - - CegoField *pF = schema.Find(CegoField(SYS_RBCATLOG, SYS_RBCATLOG_TID)); - if (pF) - { - // if (*(int*)(pF->getValue().getValue()) == tid) - - int val; - memcpy(&val, pF->getValue().getValue(), sizeof(int)); - if (val == tid) - { - undoop++; - } - } - moreTuple = _pTM->getNextTuple(pOC, schema, dp); - } - } - catch ( Exception e ) - { - pOC->abort(); - delete pOC; - throw Exception(EXLOC, Chain("Cannot get transaction info"), e); - } - - pOC->abort(); - delete pOC; - - - pOC = _pTM->getObjectCursor(tabSetId, SYS_UPDTAB, SYS_UPDTAB, CegoObject::RBSEG); - - try - { - ListT<CegoField> schema = _updSchema; - - CegoDataPointer updp; - bool moreTuple = _pTM->getFirstTuple(pOC, schema, updp); - - updop=0; - while (moreTuple) - { - - CegoField *pF = schema.Find(CegoField(SYS_UPDTAB, SYS_UPDTAB_TID)); - - if (pF) - { - - // if ( *(int*)pF->getValue().getValue() == tid ) - - int val; - memcpy(&val, pF->getValue().getValue(), sizeof(int)); - if (val == tid) - { - updop++; - } - } - - moreTuple = _pTM->getNextTuple(pOC, schema, updp); - - } - } - catch ( Exception e ) - { - pOC->abort(); - delete pOC; - throw Exception(EXLOC, Chain("Cannot get transaction info"), e); - } - - pOC->abort(); - delete pOC; - -} | ||
[-] [+] | Deleted | cego-2.11.2.tar.bz2/src/CegoTransactionManager.h.old ^ |
@@ -1,103 +0,0 @@ -#ifndef _CEGOTRANSACTIONMANAGER_H_INCLUDED_ -#define _CEGOTRANSACTIONMANAGER_H_INCLUDED_ -/////////////////////////////////////////////////////////////////////////////// -// -// CegoTransactionManager.h -// ------------------------ -// Cego transaction manager class definition -// -// Design and Implementation by Bjoern Lemke -// -// (C)opyright 2000-2010 Bjoern Lemke -// -// 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; either version 2, or (at your option) -// any later version. -// -// 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; see the file COPYING. If not, write to -// the Free Software Foundation, 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. -// -// INTERFACE MODULE -// -// Class: CegoTransactionManager -// -// Description: Transaction handling -// -// Status: QG-2.6 -// -/////////////////////////////////////////////////////////////////////////////// - -// base includes -#include <lfc/SetT.h> -#include <lfc/Chain.h> - -// cego includes -#include "CegoDefs.h" -#include "CegoTableManager.h" -#include "CegoTableObject.h" -#include "CegoQueryHelper.h" - -// forward declaration -class CegoTableManager; - -class CegoTransactionManager { - - public: - - CegoTransactionManager(CegoTableManager* pTM); - ~CegoTransactionManager(); - - void createSystemSpace(int tabSetId); - - void release(int tabSetId); - - void initLock(int tabSetId); - void reorgSystemSpace(int tabSetId); - - void recordUpdate(int tabSetId, int tid, const CegoDataPointer& dp ); - void commitUpdate(int tabSetId, const Chain& idxName, int tid, bool doAppend); - - void getRBDataPtr(int tabSetId, int tid, int fileId, int pageId, int offset, int& rbfileId, int& rbpageId, int& rboffset); - - void newRBEntry(int tabSetId, int tid, int fileId, int pageId, int offset, const Chain& tableName); - - long commitTransaction(int tabSetId, int tid); - - void getTransactionAffectedTables(int tabSetId, int tid, SetT<Chain>& tableList); - - long rollbackTransaction(int tabSetId, int tid); - - void getOpenTid(int tabSetId, SetT<int>& tidList); - - void getTransactionInfo(int tabSetId, int tid, int& undoop, int& updop); - - private: - - CegoDatabaseManager *_pDBMng; - CegoTableManager* _pTM; - - ListT<CegoField> _updSchema; - ListT<CegoField> _rbcatSchema; - - CegoBufferPage _pRBPage[TABMNG_MAXTABSET]; - CegoTableObject _rbe[TABMNG_MAXTABSET]; - CegoDataPointer _rbEntry[TABMNG_MAXTABSET]; - - CegoQueryHelper _qh; - - unsigned long _modId; -}; - -#endif - - - - | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/README ^ |
@@ -4,7 +4,7 @@ ---- A relational and transactional database system - Version 2.11.2 + Version 2.11.3 (C)opyright 2006,2007,2008,2009,2010,2011 by Bjoern Lemke | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/TODO ^ |
@@ -6,5 +6,11 @@ Idea : With session request append mode is set up - read performance can be improved by replacing XML protocol by native encoding model -- transaction performance can be improved - ( e.g. CegoTransactionManager..commitUpdate object cursor is not used very well ) \ No newline at end of file + +- transaction exception handling should be improved + ( idea : before commit or rollback, rename rb-file to commitTID or rollbackTID, + so if an exception occurs during commit or rollback, it can be decided to commit or rollback + the transaction again ) + + +- user management with new role concept should be adapted for distributed mode | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/samples/chkdb/check027.sql ^ |
@@ -21,7 +21,13 @@ select * from t1; -update t1 set a = 1000 where a in ( select a from t2 where b = 'XXX'); +select a from t2 where b = 'XXX'; + +update t1 set a = 2000 where a = 1000; + +update t1 set a = 2000 where a = 1; + +-- in ( select a from t2 where b = 'XXX'); select * from t1; | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/samples/chkdb/mkdb ^ |
@@ -21,8 +21,8 @@ ADMINUSER=cgadm ADMINPWD=cgadm -# DEBUGLEVEL=DEBUG -DEBUGLEVEL=NOTICE +DEBUGLEVEL=DEBUG +# DEBUGLEVEL=NOTICE ### end of customizing ### | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/src/CegoAction.cc ^ |
@@ -141,7 +141,7 @@ _pC++; if ( *_pC == '\'') { - _stringBuf[i] = '\''; + _stringBuf[i] = '\''; i++; } else @@ -149,12 +149,39 @@ moreChar = false; } } + else if ( *_pC == '\\') + { + _pC++; + + if ( *_pC == 'n') + { + _stringBuf[i] = '\n'; + } + else if ( *_pC == 't') + { + _stringBuf[i] = '\t'; + } + else if ( *_pC == '\'') + { + _stringBuf[i] = '\''; + } + else if ( *_pC == '\\') + { + _stringBuf[i] = '\\'; + } + else + { + Chain msg = Chain("Invalid escape character <") + Chain(*_pC) + Chain(">"); + throw Exception(EXLOC, msg); + } + i++; + } else { - _stringBuf[i] = *_pC; - i++; + _stringBuf[i] = *_pC; + i++; } - + if (i == MAXSTRINGLEN) { Chain msg("Stringbuf exceeded"); | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/src/CegoAdminHandler.cc ^ |
@@ -2976,7 +2976,7 @@ ListT<CegoField> schema; schema.Insert(CegoField(Chain("POOLINFO"), Chain("POOLINFO"), Chain("PARAMETER"),VARCHAR_TYPE, 20)); - schema.Insert(CegoField(Chain("POOLINFO"), Chain("POOLINFO"), Chain("VALUE"), VARCHAR_TYPE, 15)); + schema.Insert(CegoField(Chain("POOLINFO"), Chain("POOLINFO"), Chain("VALUE"), VARCHAR_TYPE, 20)); oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("POOLINFO"), schema, Chain("POOLINFO")); Chain pageSize = (*pInfo)->getAttributeValue(XML_PAGESIZE_ATTR); | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/src/CegoDefs.h ^ |
@@ -40,7 +40,7 @@ #endif #define CEGO_PRODUCT "Cego" -#define CEGO_VERSION "2.11.2" +#define CEGO_VERSION "2.11.3" #define CEGO_COPYRIGHT "Copyright (C) 2000-2011 by Bjoern Lemke. All rights reserved" /*******************************/ | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/src/CegoFieldValue.cc ^ |
@@ -1979,15 +1979,19 @@ Chain bval; val.replaceAll(Chain("\\"), Chain("\\\\"), bval); + // escape newlines + Chain nval; + bval.replaceAll(Chain("\n"), Chain("\\n"), nval); + // escape quotes Chain qval; if ( __quoteEscapeFlag ) { - bval.replaceAll(Chain("'"), Chain("''"), qval); + nval.replaceAll(Chain("'"), Chain("''"), qval); } else { - bval.replaceAll(Chain("'"), Chain("\\'"), qval); + nval.replaceAll(Chain("'"), Chain("\\'"), qval); } s = Chain("'") + qval + Chain("'"); | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/src/CegoPredDesc.cc ^ |
@@ -457,6 +457,25 @@ return _isChecked; } + +bool CegoPredDesc::hasOrCond() const +{ + + if (_pC) + { + if ( _pC->getCondType() == CegoCondDesc::OR ) + return true; + else if ( _pC->getCondType() == CegoCondDesc::AND ) + return _pC->Left()->hasOrCond() || _pC->Right()->hasOrCond(); + else if ( _pC->getCondType() == CegoCondDesc::PRED ) + return _pC->Left()->hasOrCond(); + } + else + { + return false; + } +} + const Chain& CegoPredDesc::getPattern() const { return _pattern; | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/src/CegoPredDesc.h ^ |
@@ -101,6 +101,8 @@ void setCheckedRec(bool val); bool isChecked() const; + bool hasOrCond() const; + // void setCaching(bool doCaching); void cleanUp(); | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/src/CegoQueryHelper.cc ^ |
@@ -609,10 +609,10 @@ switch(pC->getCondType()) { case CegoCondDesc::AND: - s += Chain("AND"); + s += Chain(" AND "); break; case CegoCondDesc::OR: - s += Chain("OR"); + s += Chain(" OR "); break; default: break; | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/src/CegoSelect.cc ^ |
@@ -307,7 +307,7 @@ } // cleanup - if ( _pPred ) + if ( _pPred ) { _pPred->setCheckedRec(false); _pPred->cleanUp(); @@ -484,8 +484,8 @@ { CegoQueryHelper queryHelper; queryHelper.makeCNF(_pPred->getCondition()); - } + createConjunctionList(_pPred); } @@ -493,7 +493,8 @@ _conjunctionList += _viewConjunctionList; _pLogger->log(_modId, Logger::DEBUG, Chain("Consolidating conjunction list ...")); - while ( consolidateConjunctionList() ) ; + + consolidateConjunctionList(); _pLogger->log(_modId, Logger::DEBUG, Chain("Building join tables ...")); buildJoinTables(); @@ -1468,50 +1469,79 @@ } } -bool CegoSelect::consolidateConjunctionList() +void CegoSelect::consolidateConjunctionList() { - SetT<Chain> tableRefSetA; - SetT<Chain> tableRefSetB; - - CegoPredDesc **pPredA = _conjunctionList.First(); - if ( pPredA ) - { - tableRefSetA = (*pPredA)->getTableRefSet(); - } - else - { - return false; - } - - CegoPredDesc **pPredB = _conjunctionList.Next(); - while ( pPredB ) + + bool finished = false; + + while ( finished == false ) { - - tableRefSetB = (*pPredB)->getTableRefSet(); + SetT<Chain> tableRefSetA; + SetT<Chain> tableRefSetB; - if ( tableRefSetA == tableRefSetB ) + bool predFound = false; + CegoPredDesc **pPredA = _conjunctionList.First(); + while ( pPredA && predFound == false) { - CegoPredDesc *pA = *pPredA; - CegoPredDesc *pB = *pPredB; - - // cout << "Pred A = " << (*pPredA)->toChain() << endl; - // cout << "Pred B = " << (*pPredB)->toChain() << endl; - - _conjunctionList.Remove(*pPredA); - _conjunctionList.Remove(*pPredB); - - CegoCondDesc* pCond = new CegoCondDesc(CegoCondDesc::AND); - pCond->setLeft(pA); - pCond->setRight(pB); - - _conjunctionList.Insert(new CegoPredDesc(pCond)); - return true; + if ( (*pPredA)->isChecked() == false && (*pPredA)->hasOrCond() == false ) + predFound = true; + else + pPredA = _conjunctionList.Next(); + } + + if ( pPredA ) + { + tableRefSetA = (*pPredA)->getTableRefSet(); + (*pPredA)->setChecked(true); + } + else + { + return; + } + + bool isMerged=false; + CegoPredDesc **pPredB = _conjunctionList.Next(); + while ( pPredB && isMerged == false ) + { + if ( (*pPredB)->hasOrCond() ) + { + pPredB = _conjunctionList.Next(); + } + else + { + tableRefSetB = (*pPredB)->getTableRefSet(); + + if ( tableRefSetA == tableRefSetB ) + { + CegoPredDesc *pA = *pPredA; + CegoPredDesc *pB = *pPredB; + + // cout << "Pred A = " << (*pPredA)->toChain() << endl; + // cout << "Pred B = " << (*pPredB)->toChain() << endl; + + _conjunctionList.Remove(*pPredA); + _conjunctionList.Remove(*pPredB); + + CegoCondDesc* pCond = new CegoCondDesc(CegoCondDesc::AND); + pCond->setLeft(pA); + pCond->setRight(pB); + + _conjunctionList.Insert(new CegoPredDesc(pCond)); + isMerged = true; + } + if ( isMerged == false ) + pPredB = _conjunctionList.Next(); + } } - pPredB = _conjunctionList.Next(); } - return false; - + CegoPredDesc **pPred = _conjunctionList.First(); + while ( pPred ) + { + (*pPred)->setChecked(false); + pPred = _conjunctionList.Next(); + } + } // | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/src/CegoSelect.h ^ |
@@ -146,7 +146,7 @@ bool nextGroupedTuple(ListT<CegoField>& jfl); bool nextJoinTuple(ListT<CegoField>& jfl, ListT<CegoField>& ofl); void createConjunctionList(CegoPredDesc* pPred); - bool consolidateConjunctionList(); + void consolidateConjunctionList(); void evalReferences(); | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/src/CegoTableManager.cc ^ |
@@ -3698,7 +3698,7 @@ ListT<CegoField> schema; schema.Insert(CegoField(Chain("POOLINFO"), Chain("POOLINFO"), Chain("PARAMETER"),VARCHAR_TYPE, 20)); - schema.Insert(CegoField(Chain("POOLINFO"), Chain("POOLINFO"), Chain("VALUE"), VARCHAR_TYPE, 15)); + schema.Insert(CegoField(Chain("POOLINFO"), Chain("POOLINFO"), Chain("VALUE"), VARCHAR_TYPE, 20)); oe = CegoTableObject(0, CegoObject::SYSTEM, Chain("POOLINFO"), schema, Chain("POOLINFO")); int pageSize; @@ -3778,7 +3778,7 @@ info.Insert(fl8); CegoFieldValue f9a(VARCHAR_TYPE, Chain("--------------------")); - CegoFieldValue f9b(VARCHAR_TYPE, Chain("---------------")); + CegoFieldValue f9b(VARCHAR_TYPE, Chain("--------------------")); ListT<CegoFieldValue> fl9; fl9.Insert(f9a); fl9.Insert(f9b); @@ -3786,7 +3786,7 @@ Datetime dt(statStart); CegoFieldValue f10a(VARCHAR_TYPE, Chain("Stat Start")); - CegoFieldValue f10b(VARCHAR_TYPE, dt.asChain("%H:%M:%S")); + CegoFieldValue f10b(VARCHAR_TYPE, dt.asChain("%d.%m.%Y %H:%M:%S")); ListT<CegoFieldValue> fl10; fl10.Insert(f10a); fl10.Insert(f10b); | ||
[-] [+] | Changed | cego-2.11.3.tar.bz2/src/CegoTransactionManager.cc ^ |
@@ -324,7 +324,12 @@ if ( pTAE == 0 ) { - throw Exception(EXLOC, Chain("Cannot find transaction ") + Chain(tid)); + + // no transaction entry found. It seems, no + // modifying operations have been take place, so we can retrn immediately + return opCount; + + // throw Exception(EXLOC, Chain("Cannot find transaction ") + Chain(tid)); } Chain taTable = pTAE->getTableObject().getName(); |