mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 22:03:03 +01:00
Hash table based on lock-free list (implemented in libcds).
This commit is contained in:
parent
ad7292d902
commit
82ba27fd5d
6
.github/workflows/main.yml
vendored
6
.github/workflows/main.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install libtool-bin libtomcrypt1 libtomcrypt-dev libtommath1 libtommath-dev libicu-dev zlib1g-dev
|
sudo apt-get install libtool-bin libtomcrypt1 libtomcrypt-dev libtommath1 libtommath-dev libicu-dev zlib1g-dev cmake
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
@ -135,7 +135,7 @@ jobs:
|
|||||||
fetch-depth: 10
|
fetch-depth: 10
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: apk update && apk --no-cache --update add build-base libtool git autoconf automake zlib-dev icu-dev ncurses-dev libedit-dev linux-headers tar
|
run: apk update && apk --no-cache --update add build-base libtool git autoconf automake cmake zlib-dev icu-dev ncurses-dev libedit-dev linux-headers tar
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
@ -323,7 +323,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Prepare - Install tools
|
- name: Prepare - Install tools
|
||||||
run: |
|
run: |
|
||||||
brew install automake libtool ninja
|
brew install automake cmake libtool ninja
|
||||||
|
|
||||||
- name: Cache - libc++ install
|
- name: Cache - libc++ install
|
||||||
id: cache-libcxx-install-macos
|
id: cache-libcxx-install-macos
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -27,3 +27,4 @@ extern/ttmath/release/
|
|||||||
/src/include/gen/parse.h
|
/src/include/gen/parse.h
|
||||||
/src/include/gen/autoconfig.auto
|
/src/include/gen/autoconfig.auto
|
||||||
/src/include/gen/autoconfig.h
|
/src/include/gen/autoconfig.h
|
||||||
|
extern/libcds/lib/
|
||||||
|
@ -28,7 +28,7 @@ install:
|
|||||||
- cmd: cd builds\win32
|
- cmd: cd builds\win32
|
||||||
- cmd: run_all.bat JUSTBUILD
|
- cmd: run_all.bat JUSTBUILD
|
||||||
- cmd: set ARTIFACTS_PATH=output_%FB_OUTPUT_SUFFIX%
|
- cmd: set ARTIFACTS_PATH=output_%FB_OUTPUT_SUFFIX%
|
||||||
- sh: export APT_PACKAGES="libtool-bin"
|
- sh: export APT_PACKAGES="libtool-bin cmake"
|
||||||
- sh: if [ $PLATFORM = "x64" ]; then export APT_PACKAGES="$APT_PACKAGES libtommath1 libtommath-dev libicu-dev zlib1g-dev"; fi
|
- sh: if [ $PLATFORM = "x64" ]; then export APT_PACKAGES="$APT_PACKAGES libtommath1 libtommath-dev libicu-dev zlib1g-dev"; fi
|
||||||
- sh: if [ $PLATFORM = "x86" ]; then export APT_PACKAGES="$APT_PACKAGES gcc-multilib g++-multilib libncurses5-dev:i386 libtommath-dev:i386 libicu-dev:i386 zlib1g-dev:i386"; fi
|
- sh: if [ $PLATFORM = "x86" ]; then export APT_PACKAGES="$APT_PACKAGES gcc-multilib g++-multilib libncurses5-dev:i386 libtommath-dev:i386 libicu-dev:i386 zlib1g-dev:i386"; fi
|
||||||
- sh: if [ $PLATFORM = "x64" ]; then export CC="gcc" CXX="g++"; fi
|
- sh: if [ $PLATFORM = "x64" ]; then export CC="gcc" CXX="g++"; fi
|
||||||
|
@ -83,6 +83,13 @@ LTC_LDFLAGS='-L$(LIB) $(subst $,$$$$,$(call LIB_LINK_RPATH,lib))'
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# correct build type for cmake builds
|
||||||
|
FB_CMAKE_BUILD_TYPE=$(TARGET)
|
||||||
|
ifeq ($(FB_CMAKE_BUILD_TYPE),Native)
|
||||||
|
FB_CMAKE_BUILD_TYPE=Release
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
.PHONY: master_process cross_process firebird Debug Release external
|
.PHONY: master_process cross_process firebird Debug Release external
|
||||||
|
|
||||||
all: firebird
|
all: firebird
|
||||||
@ -190,6 +197,8 @@ ifeq ($(RE2_BUILD_FLG),Y)
|
|||||||
ln -sf $(ROOT)/extern/re2/obj/libre2.a $(LIB)
|
ln -sf $(ROOT)/extern/re2/obj/libre2.a $(LIB)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
$(MAKE) libcds
|
||||||
|
|
||||||
ifeq ($(TOMMATH_BUILD_FLG),Y)
|
ifeq ($(TOMMATH_BUILD_FLG),Y)
|
||||||
CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" $(MAKE) -C $(ROOT)/extern/libtommath -f makefile.shared GCC="$(CC)"
|
CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" $(MAKE) -C $(ROOT)/extern/libtommath -f makefile.shared GCC="$(CC)"
|
||||||
|
|
||||||
@ -279,6 +288,22 @@ $(RE2_LIB): $(RE2_Objs)
|
|||||||
-$(RM) $@
|
-$(RM) $@
|
||||||
$(STATICLIB_LINK) $@ $^
|
$(STATICLIB_LINK) $@ $^
|
||||||
|
|
||||||
|
#___________________________________________________________________________
|
||||||
|
# libcds
|
||||||
|
#
|
||||||
|
|
||||||
|
.PHONY: libcds
|
||||||
|
libcds:
|
||||||
|
mkdir -p $(LIBCDS)/lib/$(TARGET)
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=$(FB_CMAKE_BUILD_TYPE) -DCMAKE_CXX_FLAGS=-fPIC -S $(LIBCDS) -B $(LIBCDS)/lib/$(TARGET)
|
||||||
|
AR="$(AR)" $(MAKE) -C $(LIBCDS)/lib/$(TARGET)
|
||||||
|
|
||||||
|
ifeq ($(TARGET),Debug)
|
||||||
|
ln -sf $(LIBCDS)/lib/$(TARGET)/bin/libcds-s_d.a $(LIB)/libcds.a
|
||||||
|
else
|
||||||
|
ln -sf $(LIBCDS)/lib/$(TARGET)/bin/libcds-s.a $(LIB)/libcds.a
|
||||||
|
endif
|
||||||
|
|
||||||
#___________________________________________________________________________
|
#___________________________________________________________________________
|
||||||
# main build target for both debug and release builds
|
# main build target for both debug and release builds
|
||||||
#
|
#
|
||||||
@ -343,6 +368,7 @@ cross2:
|
|||||||
ln -sf $(ROOT)/extern/decNumber/libdecFloat$(CROSS).a $(LIB)
|
ln -sf $(ROOT)/extern/decNumber/libdecFloat$(CROSS).a $(LIB)
|
||||||
CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" $(MAKE) -C $(ROOT)/extern/int128/absl/numeric
|
CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" $(MAKE) -C $(ROOT)/extern/int128/absl/numeric
|
||||||
ln -sf $(ROOT)/extern/int128/absl/numeric/libi128$(CROSS).a $(LIB)
|
ln -sf $(ROOT)/extern/int128/absl/numeric/libi128$(CROSS).a $(LIB)
|
||||||
|
$(MAKE) libcds
|
||||||
$(MAKE) yvalve
|
$(MAKE) yvalve
|
||||||
$(MAKE) engine
|
$(MAKE) engine
|
||||||
$(MAKE) fbintl
|
$(MAKE) fbintl
|
||||||
|
@ -41,7 +41,7 @@ DEV_FLAGS=$(COMMON_FLAGS) $(WARN_FLAGS)
|
|||||||
CROSS_CONFIG=android.arm64
|
CROSS_CONFIG=android.arm64
|
||||||
|
|
||||||
LDFLAGS += -static-libstdc++
|
LDFLAGS += -static-libstdc++
|
||||||
DroidLibs := -lm -ldl $(DECLIB) $(RE2LIB) $(I128LIB)
|
DroidLibs := -lm -ldl $(DECLIB) $(RE2LIB) $(I128LIB) $(LIBCDSLIB)
|
||||||
UDR_SUPPORT_LIBS :=
|
UDR_SUPPORT_LIBS :=
|
||||||
|
|
||||||
LINK_LIBS = $(DroidLibs)
|
LINK_LIBS = $(DroidLibs)
|
||||||
|
@ -41,7 +41,7 @@ DEV_FLAGS=$(COMMON_FLAGS) $(WARN_FLAGS)
|
|||||||
CROSS_CONFIG=android.arme
|
CROSS_CONFIG=android.arme
|
||||||
|
|
||||||
LDFLAGS += -static-libstdc++
|
LDFLAGS += -static-libstdc++
|
||||||
DroidLibs := -lm -ldl $(DECLIB) $(RE2LIB) $(I128LIB)
|
DroidLibs := -lm -ldl $(DECLIB) $(RE2LIB) $(I128LIB) $(LIBCDSLIB)
|
||||||
UDR_SUPPORT_LIBS :=
|
UDR_SUPPORT_LIBS :=
|
||||||
|
|
||||||
LINK_LIBS = $(DroidLibs)
|
LINK_LIBS = $(DroidLibs)
|
||||||
|
@ -41,7 +41,7 @@ DEV_FLAGS=$(COMMON_FLAGS) $(WARN_FLAGS)
|
|||||||
CROSS_CONFIG=android.x86
|
CROSS_CONFIG=android.x86
|
||||||
|
|
||||||
LDFLAGS += -static-libstdc++
|
LDFLAGS += -static-libstdc++
|
||||||
DroidLibs := -lm -ldl $(DECLIB) $(RE2LIB) $(I128LIB)
|
DroidLibs := -lm -ldl $(DECLIB) $(RE2LIB) $(I128LIB) $(LIBCDSLIB)
|
||||||
UDR_SUPPORT_LIBS :=
|
UDR_SUPPORT_LIBS :=
|
||||||
|
|
||||||
LINK_LIBS = $(DroidLibs)
|
LINK_LIBS = $(DroidLibs)
|
||||||
|
@ -41,7 +41,7 @@ DEV_FLAGS=$(COMMON_FLAGS) $(WARN_FLAGS)
|
|||||||
CROSS_CONFIG=android.x86_64
|
CROSS_CONFIG=android.x86_64
|
||||||
|
|
||||||
LDFLAGS += -static-libstdc++
|
LDFLAGS += -static-libstdc++
|
||||||
DroidLibs := -lm -ldl $(DECLIB) $(RE2LIB) $(I128LIB)
|
DroidLibs := -lm -ldl $(DECLIB) $(RE2LIB) $(I128LIB) $(LIBCDSLIB)
|
||||||
UDR_SUPPORT_LIBS :=
|
UDR_SUPPORT_LIBS :=
|
||||||
|
|
||||||
LINK_LIBS = $(DroidLibs)
|
LINK_LIBS = $(DroidLibs)
|
||||||
|
@ -148,6 +148,8 @@ else
|
|||||||
I128LIB=
|
I128LIB=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
LIBCDSLIB=-lcds
|
||||||
|
|
||||||
# crypt library
|
# crypt library
|
||||||
CRYPTLIB=@CRYPTLIB@
|
CRYPTLIB=@CRYPTLIB@
|
||||||
|
|
||||||
@ -204,8 +206,8 @@ endif
|
|||||||
|
|
||||||
STATICLIB_LINK = $(AR) crus
|
STATICLIB_LINK = $(AR) crus
|
||||||
|
|
||||||
LINK_LIBS = @LIBS@ $(DECLIB) $(RE2LIB) $(I128LIB)
|
LINK_LIBS = @LIBS@ $(DECLIB) $(RE2LIB) $(I128LIB) $(LIBCDSLIB)
|
||||||
SO_LINK_LIBS = @LIBS@ $(DECLIB) $(RE2LIB) $(I128LIB)
|
SO_LINK_LIBS = @LIBS@ $(DECLIB) $(RE2LIB) $(I128LIB) $(LIBCDSLIB)
|
||||||
|
|
||||||
# Default extensions
|
# Default extensions
|
||||||
|
|
||||||
@ -294,6 +296,11 @@ TOMCRYPT_INC=$(TOMCRYPT)/src/headers
|
|||||||
TOMCRYPT_SO=$(TOMCRYPT)/.libs/libtomcrypt.so
|
TOMCRYPT_SO=$(TOMCRYPT)/.libs/libtomcrypt.so
|
||||||
TOMCRYPT_VER=1
|
TOMCRYPT_VER=1
|
||||||
|
|
||||||
|
# Own libcds support
|
||||||
|
LIBCDS=$(ROOT)/extern/libcds
|
||||||
|
LIBCDS_INC=$(LIBCDS)
|
||||||
|
LIBCDS_DEF=CDS_BUILD_STATIC_LIB
|
||||||
|
|
||||||
# LINKER OPTIONS
|
# LINKER OPTIONS
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ ifneq ($(SYSTEM_BOOST_FLG),Y)
|
|||||||
WFLAGS += -I$(ROOT)/extern/boost
|
WFLAGS += -I$(ROOT)/extern/boost
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
WFLAGS += -I$(LIBCDS_INC) -D$(LIBCDS_DEF)
|
||||||
|
|
||||||
ifeq ($(TOMMATH_BUILD_FLG),Y)
|
ifeq ($(TOMMATH_BUILD_FLG),Y)
|
||||||
WFLAGS += -I$(TOMMATH_INC)
|
WFLAGS += -I$(TOMMATH_INC)
|
||||||
endif
|
endif
|
||||||
|
@ -22,6 +22,16 @@ for %%v in ( %* ) do (
|
|||||||
@echo Cleaning icu...
|
@echo Cleaning icu...
|
||||||
@rmdir /S /Q "%FB_ROOT_PATH%\extern\icu\%FB_TARGET_PLATFORM%\%FBBUILD_BUILDTYPE%" 2>nul
|
@rmdir /S /Q "%FB_ROOT_PATH%\extern\icu\%FB_TARGET_PLATFORM%\%FBBUILD_BUILDTYPE%" 2>nul
|
||||||
|
|
||||||
|
@echo Cleaning cds...
|
||||||
|
@for /D %%d in ("%FB_ROOT_PATH%\extern\libcds\obj\*") do (
|
||||||
|
rmdir /S /Q "%%d\%FB_TARGET_PLATFORM%\cds\%FB_CONFIG%-static" 2>nul
|
||||||
|
)
|
||||||
|
|
||||||
|
@for /D %%d in ("%FB_ROOT_PATH%\extern\libcds\bin\*") do (
|
||||||
|
rmdir /S /Q "%%d\%FB_TARGET_PLATFORM%-%FB_CONFIG%-static" 2>nul
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@echo Cleaning decNumber...
|
@echo Cleaning decNumber...
|
||||||
@rmdir /S /Q "%FB_ROOT_PATH%\extern\decNumber\lib\%FB_TARGET_PLATFORM%" 2>nul
|
@rmdir /S /Q "%FB_ROOT_PATH%\extern\decNumber\lib\%FB_TARGET_PLATFORM%" 2>nul
|
||||||
@rmdir /S /Q "%FB_ROOT_PATH%\extern\decNumber\temp\%FB_TARGET_PLATFORM%" 2>nul
|
@rmdir /S /Q "%FB_ROOT_PATH%\extern\decNumber\temp\%FB_TARGET_PLATFORM%" 2>nul
|
||||||
|
@ -18,6 +18,11 @@ set projects=
|
|||||||
set config=debug
|
set config=debug
|
||||||
)
|
)
|
||||||
|
|
||||||
|
:: Special case for CDS, set in make_boot only
|
||||||
|
@if "%FB_LIBCDS%"=="1" (
|
||||||
|
set config=%config%-static
|
||||||
|
)
|
||||||
|
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
@ -34,6 +34,9 @@ if "%ERRLEV%"=="1" goto :END
|
|||||||
call :btyacc
|
call :btyacc
|
||||||
if "%ERRLEV%"=="1" goto :END
|
if "%ERRLEV%"=="1" goto :END
|
||||||
|
|
||||||
|
call :libcds
|
||||||
|
if "%ERRLEV%"=="1" goto :END
|
||||||
|
|
||||||
call :LibTom
|
call :LibTom
|
||||||
if "%ERRLEV%"=="1" goto :END
|
if "%ERRLEV%"=="1" goto :END
|
||||||
|
|
||||||
@ -145,6 +148,17 @@ goto :EOF
|
|||||||
if errorlevel 1 call :boot2 decNumber_%FB_OBJ_DIR%
|
if errorlevel 1 call :boot2 decNumber_%FB_OBJ_DIR%
|
||||||
goto :EOF
|
goto :EOF
|
||||||
|
|
||||||
|
::===================
|
||||||
|
:: Build libcds
|
||||||
|
:libcds
|
||||||
|
@echo.
|
||||||
|
set FB_LIBCDS=1
|
||||||
|
@echo Building libcds (%FB_OBJ_DIR%)...
|
||||||
|
@call compile.bat extern\libcds\projects\Win\vc141\cds libcds_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log cds
|
||||||
|
if errorlevel 1 call :boot2 libcds%FB_OBJ_DIR%
|
||||||
|
set FB_LIBCDS=
|
||||||
|
goto :EOF
|
||||||
|
|
||||||
::===================
|
::===================
|
||||||
:: BUILD ttmath
|
:: BUILD ttmath
|
||||||
:ttmath
|
:ttmath
|
||||||
|
@ -113,24 +113,28 @@
|
|||||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||||
<Import Project="FirebirdCommon.props" />
|
<Import Project="FirebirdCommon.props" />
|
||||||
<Import Project="FirebirdRelease.props" />
|
<Import Project="FirebirdRelease.props" />
|
||||||
|
<Import Project="libcds.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||||
<Import Project="FirebirdCommon.props" />
|
<Import Project="FirebirdCommon.props" />
|
||||||
<Import Project="FirebirdDebug.props" />
|
<Import Project="FirebirdDebug.props" />
|
||||||
|
<Import Project="libcds.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||||
<Import Project="FirebirdCommon.props" />
|
<Import Project="FirebirdCommon.props" />
|
||||||
<Import Project="FirebirdRelease.props" />
|
<Import Project="FirebirdRelease.props" />
|
||||||
|
<Import Project="libcds.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||||
<Import Project="FirebirdCommon.props" />
|
<Import Project="FirebirdCommon.props" />
|
||||||
<Import Project="FirebirdDebug.props" />
|
<Import Project="FirebirdDebug.props" />
|
||||||
|
<Import Project="libcds.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
@ -89,6 +89,7 @@
|
|||||||
<ClCompile Include="..\..\..\src\jrd\GlobalRWLock.cpp" />
|
<ClCompile Include="..\..\..\src\jrd\GlobalRWLock.cpp" />
|
||||||
<ClCompile Include="..\..\..\src\jrd\idx.cpp" />
|
<ClCompile Include="..\..\..\src\jrd\idx.cpp" />
|
||||||
<ClCompile Include="..\..\..\src\jrd\inf.cpp" />
|
<ClCompile Include="..\..\..\src\jrd\inf.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\src\jrd\InitCDSLib.cpp" />
|
||||||
<ClCompile Include="..\..\..\src\jrd\intl.cpp" />
|
<ClCompile Include="..\..\..\src\jrd\intl.cpp" />
|
||||||
<ClCompile Include="..\..\..\src\jrd\IntlManager.cpp" />
|
<ClCompile Include="..\..\..\src\jrd\IntlManager.cpp" />
|
||||||
<ClCompile Include="..\..\..\src\jrd\intl_builtin.cpp" />
|
<ClCompile Include="..\..\..\src\jrd\intl_builtin.cpp" />
|
||||||
@ -276,6 +277,7 @@
|
|||||||
<ClInclude Include="..\..\..\src\jrd\inf_proto.h" />
|
<ClInclude Include="..\..\..\src\jrd\inf_proto.h" />
|
||||||
<ClInclude Include="..\..\..\src\jrd\inf_pub.h" />
|
<ClInclude Include="..\..\..\src\jrd\inf_pub.h" />
|
||||||
<ClInclude Include="..\..\..\src\jrd\ini.h" />
|
<ClInclude Include="..\..\..\src\jrd\ini.h" />
|
||||||
|
<ClInclude Include="..\..\..\src\jrd\InitCDSLib.h" />
|
||||||
<ClInclude Include="..\..\..\src\jrd\ini_proto.h" />
|
<ClInclude Include="..\..\..\src\jrd\ini_proto.h" />
|
||||||
<ClInclude Include="..\..\..\src\jrd\intl.h" />
|
<ClInclude Include="..\..\..\src\jrd\intl.h" />
|
||||||
<ClInclude Include="..\..\..\src\jrd\IntlManager.h" />
|
<ClInclude Include="..\..\..\src\jrd\IntlManager.h" />
|
||||||
@ -429,24 +431,28 @@
|
|||||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||||
<Import Project="FirebirdCommon.props" />
|
<Import Project="FirebirdCommon.props" />
|
||||||
<Import Project="FirebirdRelease.props" />
|
<Import Project="FirebirdRelease.props" />
|
||||||
|
<Import Project="libcds.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||||
<Import Project="FirebirdCommon.props" />
|
<Import Project="FirebirdCommon.props" />
|
||||||
<Import Project="FirebirdDebug.props" />
|
<Import Project="FirebirdDebug.props" />
|
||||||
|
<Import Project="libcds.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||||
<Import Project="FirebirdCommon.props" />
|
<Import Project="FirebirdCommon.props" />
|
||||||
<Import Project="FirebirdRelease.props" />
|
<Import Project="FirebirdRelease.props" />
|
||||||
|
<Import Project="libcds.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||||
<Import Project="FirebirdCommon.props" />
|
<Import Project="FirebirdCommon.props" />
|
||||||
<Import Project="FirebirdDebug.props" />
|
<Import Project="FirebirdDebug.props" />
|
||||||
|
<Import Project="libcds.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
@ -513,6 +513,9 @@
|
|||||||
<ClCompile Include="..\..\..\src\jrd\MetaName.cpp">
|
<ClCompile Include="..\..\..\src\jrd\MetaName.cpp">
|
||||||
<Filter>JRD files</Filter>
|
<Filter>JRD files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\src\jrd\InitCDSLib.cpp">
|
||||||
|
<Filter>JRD files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\..\src\jrd\optimizer\InnerJoin.cpp">
|
<ClCompile Include="..\..\..\src\jrd\optimizer\InnerJoin.cpp">
|
||||||
<Filter>Optimizer</Filter>
|
<Filter>Optimizer</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@ -1070,6 +1073,9 @@
|
|||||||
<ClInclude Include="..\..\..\src\jrd\QualifiedName.h">
|
<ClInclude Include="..\..\..\src\jrd\QualifiedName.h">
|
||||||
<Filter>Header files</Filter>
|
<Filter>Header files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\src\jrd\InitCDSLib.h">
|
||||||
|
<Filter>Header files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\..\src\jrd\WorkerAttachment.h">
|
<ClInclude Include="..\..\..\src\jrd\WorkerAttachment.h">
|
||||||
<Filter>Header files</Filter>
|
<Filter>Header files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -66,24 +66,28 @@
|
|||||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||||
<Import Project="FirebirdCommon.props" />
|
<Import Project="FirebirdCommon.props" />
|
||||||
<Import Project="FirebirdDebug.props" />
|
<Import Project="FirebirdDebug.props" />
|
||||||
|
<Import Project="libcds.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||||
<Import Project="FirebirdCommon.props" />
|
<Import Project="FirebirdCommon.props" />
|
||||||
<Import Project="FirebirdRelease.props" />
|
<Import Project="FirebirdRelease.props" />
|
||||||
|
<Import Project="libcds.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||||
<Import Project="FirebirdCommon.props" />
|
<Import Project="FirebirdCommon.props" />
|
||||||
<Import Project="FirebirdDebug.props" />
|
<Import Project="FirebirdDebug.props" />
|
||||||
|
<Import Project="libcds.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||||
<Import Project="FirebirdCommon.props" />
|
<Import Project="FirebirdCommon.props" />
|
||||||
<Import Project="FirebirdRelease.props" />
|
<Import Project="FirebirdRelease.props" />
|
||||||
|
<Import Project="libcds.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
23
builds/win32/msvc15/libcds.props
Normal file
23
builds/win32/msvc15/libcds.props
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ImportGroup Label="PropertySheets" />
|
||||||
|
<PropertyGroup Label="UserMacros">
|
||||||
|
<LIBCDS_ROOT>..\..\..\extern\libcds</LIBCDS_ROOT>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup />
|
||||||
|
<ItemDefinitionGroup>
|
||||||
|
<ClCompile>
|
||||||
|
<AdditionalIncludeDirectories>$(LIBCDS_ROOT);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>CDS_BUILD_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<AdditionalLibraryDirectories>$(LIBCDS_ROOT)\bin\vc.$(PlatformToolset)\$(Platform)-$(Configuration)-static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>libcds-$(PlatformTarget).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BuildMacro Include="LIBCDS_ROOT">
|
||||||
|
<Value>$(LIBCDS_ROOT)</Value>
|
||||||
|
</BuildMacro>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
134
src/jrd/InitCDSLib.cpp
Normal file
134
src/jrd/InitCDSLib.cpp
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
/*
|
||||||
|
* PROGRAM: JRD Access Method
|
||||||
|
* MODULE: InitCDSLib.cpp
|
||||||
|
* DESCRIPTION: support for correct usage of CDS library by the engine
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Initial
|
||||||
|
* Developer's Public License Version 1.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed AS IS,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing rights
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* The Original Code was created by Vladyslav Khorsun for the
|
||||||
|
* Firebird Open Source RDBMS project.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2022 Vladyslav Khorsun <hvlad@users.sourceforge.net>
|
||||||
|
* and all contributors signed below.
|
||||||
|
*
|
||||||
|
* All Rights Reserved.
|
||||||
|
* Contributor(s): ______________________________________.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "firebird.h"
|
||||||
|
#include "../common/classes/array.h"
|
||||||
|
#include "../common/classes/init.h"
|
||||||
|
#include "../common/classes/locks.h"
|
||||||
|
#include "../jrd/InitCDSLib.h"
|
||||||
|
#include "../yvalve/gds_proto.h"
|
||||||
|
|
||||||
|
#include <cds/init.h> //cds::Initialize, cds::Terminate
|
||||||
|
#include <cds/gc/dhp.h> //cds::gc::DHP (Hazard Pointer)
|
||||||
|
|
||||||
|
using namespace Firebird;
|
||||||
|
|
||||||
|
namespace Jrd
|
||||||
|
{
|
||||||
|
|
||||||
|
Array<MemoryPool*>* InitCDS::m_pools = nullptr;
|
||||||
|
MemoryPool* InitCDS::m_pool = nullptr;
|
||||||
|
MemoryStats InitCDS::m_stats;
|
||||||
|
|
||||||
|
static GlobalPtr<InitCDS, InstanceControl::PRIORITY_TLS_KEY> initCDS;
|
||||||
|
|
||||||
|
InitCDS::InitCDS(MemoryPool&)
|
||||||
|
{
|
||||||
|
m_pool = MemoryPool::createPool(nullptr, m_stats);
|
||||||
|
m_pools = FB_NEW_POOL(*m_pool) Array<MemoryPool*>(*m_pool);
|
||||||
|
|
||||||
|
cds::Initialize();
|
||||||
|
cds::gc::dhp::smr::set_memory_allocator(alloc, free);
|
||||||
|
cds::gc::dhp::smr::construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
InitCDS::~InitCDS()
|
||||||
|
{
|
||||||
|
cds::gc::dhp::smr::destruct(true);
|
||||||
|
|
||||||
|
char str[512];
|
||||||
|
|
||||||
|
// CDS_ENABLE_HPSTAT is not defined by default.
|
||||||
|
// Rebuild of libcds after change is required.
|
||||||
|
|
||||||
|
#ifdef CDS_ENABLE_HPSTAT
|
||||||
|
cds::gc::DHP::stat const& st = cds::gc::DHP::postmortem_statistics();
|
||||||
|
|
||||||
|
sprintf(str, "DHP statistics:\n"
|
||||||
|
" thread count = %llu\n"
|
||||||
|
" guard allocated = %llu\n"
|
||||||
|
" guard freed = %llu\n"
|
||||||
|
" retired data count = %llu\n"
|
||||||
|
" free data count = %llu\n"
|
||||||
|
" HP blocks allocated = %llu\n"
|
||||||
|
" retired blocks allocated = %llu\n"
|
||||||
|
" hp array extend() calls = %llu\n"
|
||||||
|
" retired array extend() = %llu\n"
|
||||||
|
" scan() call count = %llu\n"
|
||||||
|
" help_scan() call count = %llu\n"
|
||||||
|
"\n",
|
||||||
|
st.thread_rec_count,
|
||||||
|
st.guard_allocated, st.guard_freed,
|
||||||
|
st.retired_count, st.free_count,
|
||||||
|
st.hp_block_count, st.retired_block_count,
|
||||||
|
st.hp_extend_count, st.retired_extend_count,
|
||||||
|
st.scan_count, st.help_scan_count
|
||||||
|
);
|
||||||
|
gds__log(str);
|
||||||
|
#endif
|
||||||
|
cds::Terminate();
|
||||||
|
|
||||||
|
// no need to protect m_pools at this point
|
||||||
|
while (m_pools->hasData())
|
||||||
|
{
|
||||||
|
MemoryPool* pool = m_pools->pop();
|
||||||
|
MemoryPool::deletePool(pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete m_pools;
|
||||||
|
MemoryPool::deletePool(m_pool);
|
||||||
|
|
||||||
|
#ifdef DEBUG_CDS_MEMORY
|
||||||
|
sprintf(str, "DHP pool stats:\n"
|
||||||
|
" usage = %llu\n"
|
||||||
|
" mapping = %llu\n"
|
||||||
|
" max usage = %llu\n"
|
||||||
|
" max mapping = %llu\n"
|
||||||
|
"\n",
|
||||||
|
m_stats.getCurrentUsage(),
|
||||||
|
m_stats.getCurrentMapping(),
|
||||||
|
m_stats.getMaximumUsage(),
|
||||||
|
m_stats.getMaximumMapping()
|
||||||
|
);
|
||||||
|
|
||||||
|
gds__log(str);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static InitInstance<Mutex> mutex; // guard InitCDS::m_pools
|
||||||
|
|
||||||
|
MemoryPool* InitCDS::createPool()
|
||||||
|
{
|
||||||
|
MemoryPool* pool = MemoryPool::createPool(nullptr, m_stats);
|
||||||
|
|
||||||
|
MutexLockGuard guard(mutex(), FB_FUNCTION);
|
||||||
|
m_pools->push(pool);
|
||||||
|
return pool;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Jrd
|
70
src/jrd/InitCDSLib.h
Normal file
70
src/jrd/InitCDSLib.h
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* PROGRAM: JRD Access Method
|
||||||
|
* MODULE: InitCDSLib.h
|
||||||
|
* DESCRIPTION: support for correct usage of CDS library by the engine
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Initial
|
||||||
|
* Developer's Public License Version 1.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed AS IS,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing rights
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* The Original Code was created by Vladyslav Khorsun for the
|
||||||
|
* Firebird Open Source RDBMS project.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2022 Vladyslav Khorsun <hvlad@users.sourceforge.net>
|
||||||
|
* and all contributors signed below.
|
||||||
|
*
|
||||||
|
* All Rights Reserved.
|
||||||
|
* Contributor(s): ______________________________________.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FB_INIT_CDSLIB_H
|
||||||
|
#define FB_INIT_CDSLIB_H
|
||||||
|
|
||||||
|
#include "../common/classes/alloc.h"
|
||||||
|
|
||||||
|
// Uncomment to write final memory usage stats into firebird.log.
|
||||||
|
// See ~InitCDS() and ~InitPool() in CCH
|
||||||
|
|
||||||
|
//#define DEBUG_CDS_MEMORY
|
||||||
|
|
||||||
|
namespace Jrd
|
||||||
|
{
|
||||||
|
|
||||||
|
class InitCDS
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit InitCDS(MemoryPool&);
|
||||||
|
~InitCDS();
|
||||||
|
|
||||||
|
// Creates memory pool that will not be deleted until cds finish its work.
|
||||||
|
// Should be used to allocate structures by cds classes.
|
||||||
|
static Firebird::MemoryPool* createPool();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void* alloc(size_t size)
|
||||||
|
{
|
||||||
|
return m_pool->allocate(size ALLOC_ARGS);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void free(void* p)
|
||||||
|
{
|
||||||
|
m_pool->deallocate(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Firebird::Array<Firebird::MemoryPool*>* m_pools;
|
||||||
|
static Firebird::MemoryPool* m_pool;
|
||||||
|
static Firebird::MemoryStats m_stats;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Jrd
|
||||||
|
|
||||||
|
#endif // FB_INIT_CDSLIB_H
|
@ -45,7 +45,7 @@ class jrd_tra;
|
|||||||
template <typename T> class vec;
|
template <typename T> class vec;
|
||||||
class Statement;
|
class Statement;
|
||||||
struct temporary_key;
|
struct temporary_key;
|
||||||
class jrd_tra;
|
class thread_db;
|
||||||
class BtrPageGCLock;
|
class BtrPageGCLock;
|
||||||
class Sort;
|
class Sort;
|
||||||
class PartitionedSort;
|
class PartitionedSort;
|
||||||
|
1491
src/jrd/cch.cpp
1491
src/jrd/cch.cpp
File diff suppressed because it is too large
Load Diff
@ -62,6 +62,7 @@ class thread_db;
|
|||||||
struct que;
|
struct que;
|
||||||
class BufferDesc;
|
class BufferDesc;
|
||||||
class Database;
|
class Database;
|
||||||
|
class BCBHashTable;
|
||||||
|
|
||||||
// Page buffer cache size constraints.
|
// Page buffer cache size constraints.
|
||||||
|
|
||||||
@ -72,22 +73,16 @@ const ULONG MAX_PAGE_BUFFERS = 131072;
|
|||||||
const ULONG MAX_PAGE_BUFFERS = MAX_SLONG - 1;
|
const ULONG MAX_PAGE_BUFFERS = MAX_SLONG - 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// BufferControl -- Buffer control block -- one per system
|
// BufferControl -- Buffer control block -- one per system
|
||||||
|
|
||||||
struct bcb_repeat
|
|
||||||
{
|
|
||||||
BufferDesc* bcb_bdb; // Buffer descriptor block
|
|
||||||
que bcb_page_mod; // Que of buffers with page mod n
|
|
||||||
};
|
|
||||||
|
|
||||||
class BufferControl : public pool_alloc<type_bcb>
|
class BufferControl : public pool_alloc<type_bcb>
|
||||||
{
|
{
|
||||||
BufferControl(MemoryPool& p, Firebird::MemoryStats& parentStats)
|
BufferControl(MemoryPool& p, Firebird::MemoryStats& parentStats)
|
||||||
: bcb_bufferpool(&p),
|
: bcb_bufferpool(&p),
|
||||||
bcb_memory_stats(&parentStats),
|
bcb_memory_stats(&parentStats),
|
||||||
bcb_memory(p),
|
bcb_memory(p),
|
||||||
bcb_writer_fini(p, cache_writer, THREAD_medium)
|
bcb_writer_fini(p, cache_writer, THREAD_medium),
|
||||||
|
bcb_bdbBlocks(p)
|
||||||
{
|
{
|
||||||
bcb_database = NULL;
|
bcb_database = NULL;
|
||||||
QUE_INIT(bcb_in_use);
|
QUE_INIT(bcb_in_use);
|
||||||
@ -103,6 +98,7 @@ class BufferControl : public pool_alloc<type_bcb>
|
|||||||
bcb_prec_walk_mark = 0;
|
bcb_prec_walk_mark = 0;
|
||||||
bcb_page_size = 0;
|
bcb_page_size = 0;
|
||||||
bcb_page_incarnation = 0;
|
bcb_page_incarnation = 0;
|
||||||
|
bcb_hashTable = nullptr;
|
||||||
#ifdef SUPERSERVER_V2
|
#ifdef SUPERSERVER_V2
|
||||||
bcb_prefetch = NULL;
|
bcb_prefetch = NULL;
|
||||||
#endif
|
#endif
|
||||||
@ -142,9 +138,9 @@ public:
|
|||||||
|
|
||||||
Firebird::SyncObject bcb_syncObject;
|
Firebird::SyncObject bcb_syncObject;
|
||||||
Firebird::SyncObject bcb_syncDirtyBdbs;
|
Firebird::SyncObject bcb_syncDirtyBdbs;
|
||||||
|
Firebird::SyncObject bcb_syncEmpty;
|
||||||
Firebird::SyncObject bcb_syncPrecedence;
|
Firebird::SyncObject bcb_syncPrecedence;
|
||||||
Firebird::SyncObject bcb_syncLRU;
|
Firebird::SyncObject bcb_syncLRU;
|
||||||
//Firebird::SyncObject bcb_syncPageWrite;
|
|
||||||
|
|
||||||
typedef ThreadFinishSync<BufferControl*> BcbThreadSync;
|
typedef ThreadFinishSync<BufferControl*> BcbThreadSync;
|
||||||
|
|
||||||
@ -164,7 +160,15 @@ public:
|
|||||||
|
|
||||||
void exceptionHandler(const Firebird::Exception& ex, BcbThreadSync::ThreadRoutine* routine);
|
void exceptionHandler(const Firebird::Exception& ex, BcbThreadSync::ThreadRoutine* routine);
|
||||||
|
|
||||||
bcb_repeat* bcb_rpt;
|
BCBHashTable* bcb_hashTable;
|
||||||
|
|
||||||
|
// block of allocated BufferDesc's
|
||||||
|
struct BDBBlock
|
||||||
|
{
|
||||||
|
BufferDesc* m_bdbs;
|
||||||
|
ULONG m_count;
|
||||||
|
};
|
||||||
|
Firebird::Array<BDBBlock> bcb_bdbBlocks; // all allocated BufferDesc's
|
||||||
};
|
};
|
||||||
|
|
||||||
const int BCB_keep_pages = 1; // set during btc_flush(), pages not removed from dirty binary tree
|
const int BCB_keep_pages = 1; // set during btc_flush(), pages not removed from dirty binary tree
|
||||||
@ -186,13 +190,13 @@ class BufferDesc : public pool_alloc<type_bdb>
|
|||||||
public:
|
public:
|
||||||
explicit BufferDesc(BufferControl* bcb)
|
explicit BufferDesc(BufferControl* bcb)
|
||||||
: bdb_bcb(bcb),
|
: bdb_bcb(bcb),
|
||||||
bdb_page(0, 0),
|
bdb_page(0, 0)
|
||||||
bdb_pending_page(0, 0)
|
|
||||||
{
|
{
|
||||||
bdb_lock = NULL;
|
bdb_lock = NULL;
|
||||||
QUE_INIT(bdb_que);
|
QUE_INIT(bdb_que);
|
||||||
QUE_INIT(bdb_in_use);
|
QUE_INIT(bdb_in_use);
|
||||||
QUE_INIT(bdb_dirty);
|
QUE_INIT(bdb_dirty);
|
||||||
|
bdb_lru_chain = NULL;
|
||||||
bdb_buffer = NULL;
|
bdb_buffer = NULL;
|
||||||
bdb_incarnation = 0;
|
bdb_incarnation = 0;
|
||||||
bdb_transactions = 0;
|
bdb_transactions = 0;
|
||||||
@ -202,6 +206,7 @@ public:
|
|||||||
bdb_exclusive = NULL;
|
bdb_exclusive = NULL;
|
||||||
bdb_io = NULL;
|
bdb_io = NULL;
|
||||||
bdb_writers = 0;
|
bdb_writers = 0;
|
||||||
|
bdb_io_locks = 0;
|
||||||
bdb_scan_count = 0;
|
bdb_scan_count = 0;
|
||||||
bdb_difference_page = 0;
|
bdb_difference_page = 0;
|
||||||
bdb_prec_walk_mark = 0;
|
bdb_prec_walk_mark = 0;
|
||||||
@ -233,13 +238,12 @@ public:
|
|||||||
BufferControl* bdb_bcb;
|
BufferControl* bdb_bcb;
|
||||||
Firebird::SyncObject bdb_syncPage;
|
Firebird::SyncObject bdb_syncPage;
|
||||||
Lock* bdb_lock; // Lock block for buffer
|
Lock* bdb_lock; // Lock block for buffer
|
||||||
que bdb_que; // Either mod que in hash table or bcb_pending que if BDB_free_pending flag is set
|
que bdb_que; // Either mod que in hash table or bcb_empty que if never used
|
||||||
que bdb_in_use; // queue of buffers in use
|
que bdb_in_use; // queue of buffers in use
|
||||||
que bdb_dirty; // dirty pages LRU queue
|
que bdb_dirty; // dirty pages LRU queue
|
||||||
BufferDesc* bdb_lru_chain; // pending LRU chain
|
BufferDesc* bdb_lru_chain; // pending LRU chain
|
||||||
Ods::pag* bdb_buffer; // Actual buffer
|
Ods::pag* bdb_buffer; // Actual buffer
|
||||||
PageNumber bdb_page; // Database page number in buffer
|
PageNumber bdb_page; // Database page number in buffer
|
||||||
PageNumber bdb_pending_page; // Database page number to be
|
|
||||||
ULONG bdb_incarnation;
|
ULONG bdb_incarnation;
|
||||||
ULONG bdb_transactions; // vector of dirty flags to reduce commit overhead
|
ULONG bdb_transactions; // vector of dirty flags to reduce commit overhead
|
||||||
TraNumber bdb_mark_transaction; // hi-water mark transaction to defer header page I/O
|
TraNumber bdb_mark_transaction; // hi-water mark transaction to defer header page I/O
|
||||||
|
@ -384,6 +384,9 @@ static void threadDetach()
|
|||||||
{
|
{
|
||||||
ThreadSync* thd = ThreadSync::findThread();
|
ThreadSync* thd = ThreadSync::findThread();
|
||||||
delete thd;
|
delete thd;
|
||||||
|
|
||||||
|
if (cds::threading::Manager::isThreadAttached())
|
||||||
|
cds::threading::Manager::detachThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shutdownBeforeUnload()
|
static void shutdownBeforeUnload()
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
#include "../jrd/Attachment.h"
|
#include "../jrd/Attachment.h"
|
||||||
#include "firebird/Interface.h"
|
#include "firebird/Interface.h"
|
||||||
|
|
||||||
|
#include <cds/threading/model.h> // cds::threading::Manager
|
||||||
|
|
||||||
#define BUGCHECK(number) ERR_bugcheck(number, __FILE__, __LINE__)
|
#define BUGCHECK(number) ERR_bugcheck(number, __FILE__, __LINE__)
|
||||||
#define SOFT_BUGCHECK(number) ERR_soft_bugcheck(number, __FILE__, __LINE__)
|
#define SOFT_BUGCHECK(number) ERR_soft_bugcheck(number, __FILE__, __LINE__)
|
||||||
@ -772,6 +773,9 @@ public:
|
|||||||
{
|
{
|
||||||
context.putSpecific();
|
context.putSpecific();
|
||||||
currentStatus->init();
|
currentStatus->init();
|
||||||
|
|
||||||
|
if (!cds::threading::Manager::isThreadAttached())
|
||||||
|
cds::threading::Manager::attachThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadContextHolder(Database* dbb, Jrd::Attachment* att, FbStatusVector* status = NULL)
|
ThreadContextHolder(Database* dbb, Jrd::Attachment* att, FbStatusVector* status = NULL)
|
||||||
@ -781,6 +785,9 @@ public:
|
|||||||
context.setDatabase(dbb);
|
context.setDatabase(dbb);
|
||||||
context.setAttachment(att);
|
context.setAttachment(att);
|
||||||
currentStatus->init();
|
currentStatus->init();
|
||||||
|
|
||||||
|
if (!cds::threading::Manager::isThreadAttached())
|
||||||
|
cds::threading::Manager::attachThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
~ThreadContextHolder()
|
~ThreadContextHolder()
|
||||||
|
@ -144,16 +144,17 @@ public:
|
|||||||
UCHAR lck_physical; // Physical lock level
|
UCHAR lck_physical; // Physical lock level
|
||||||
LOCK_DATA_T lck_data; // Data associated with a lock
|
LOCK_DATA_T lck_data; // Data associated with a lock
|
||||||
|
|
||||||
|
static constexpr size_t KEY_STATIC_SIZE = sizeof(SINT64);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const size_t KEY_STATIC_SIZE = sizeof(SINT64);
|
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
UCHAR key_string[KEY_STATIC_SIZE];
|
UCHAR key_string[KEY_STATIC_SIZE];
|
||||||
SINT64 key_long;
|
SINT64 key_long;
|
||||||
} lck_key; // Lock key string
|
} lck_key; // Lock key string
|
||||||
|
|
||||||
|
static_assert(KEY_STATIC_SIZE >= sizeof(lck_key), "Wrong KEY_STATIC_SIZE");
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
UCHAR* getKeyPtr()
|
UCHAR* getKeyPtr()
|
||||||
|
@ -2622,14 +2622,19 @@ ULONG PAG_page_count(thread_db* tdbb)
|
|||||||
if (!PIO_read(tdbb, pageSpace->file, &temp_bdb, temp_bdb.bdb_buffer, &status))
|
if (!PIO_read(tdbb, pageSpace->file, &temp_bdb, temp_bdb.bdb_buffer, &status))
|
||||||
status_exception::raise(&status);
|
status_exception::raise(&status);
|
||||||
|
|
||||||
fb_assert(pip->pip_header.pag_type == pag_pages);
|
// After PIO_extend the tail of the file might have thousands of zero pages.
|
||||||
|
// Recently last PIP might be marked as fully used but the new PIP is not initialized.
|
||||||
|
// If nbackup state becomes nbak_stalled in this moment we'll find zero pip in the tail of the file.
|
||||||
|
// Fortunatelly it must be the last valuable page and we can rely on its number.
|
||||||
|
fb_assert(pip->pip_header.pag_type == pag_pages ||
|
||||||
|
(!pip->pip_header.pag_type && !pip->pip_used) );
|
||||||
if (pip->pip_used == pagesPerPip)
|
if (pip->pip_used == pagesPerPip)
|
||||||
{
|
{
|
||||||
// this is not last page, continue search
|
// this is not last page, continue search
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pip->pip_used + pageNo + (sequence ? 1 : -1);
|
return pip->pip_used + pageNo - (sequence ? 0 : pageSpace->pipFirst) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// compiler warnings silencer
|
// compiler warnings silencer
|
||||||
|
Loading…
Reference in New Issue
Block a user