Commit 75f2f013 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

[t:4901] merging brt->ft rename to main

git-svn-id: file:///svn/toku/tokudb@43686 c7de825b-a66e-492c-adef-691d508d4ae1
parent 85457b33
...@@ -84,7 +84,7 @@ include_directories( ...@@ -84,7 +84,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/toku_include ${CMAKE_CURRENT_SOURCE_DIR}/toku_include
${CMAKE_CURRENT_SOURCE_DIR}/portability ${CMAKE_CURRENT_SOURCE_DIR}/portability
${CMAKE_CURRENT_SOURCE_DIR} ## so you can include <newbrt/brt.h> from inside src/ ${CMAKE_CURRENT_SOURCE_DIR} ## so you can include <ft/ft-ops.h> from inside src/
${CMAKE_CURRENT_BINARY_DIR} ## for logging code ${CMAKE_CURRENT_BINARY_DIR} ## for logging code
) )
## include where config.h will be generated ## include where config.h will be generated
...@@ -96,7 +96,7 @@ include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/buildheader) ...@@ -96,7 +96,7 @@ include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/buildheader)
## add subdirectories ## add subdirectories
add_subdirectory(portability) add_subdirectory(portability)
add_subdirectory(newbrt) add_subdirectory(ft)
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(utils) add_subdirectory(utils)
add_subdirectory(db-benchmark-test) add_subdirectory(db-benchmark-test)
......
...@@ -2,9 +2,9 @@ cmake_policy(SET CMP0012 NEW) ...@@ -2,9 +2,9 @@ cmake_policy(SET CMP0012 NEW)
## these tests shouldn't run with valgrind ## these tests shouldn't run with valgrind
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE
brtloader-test-extractor-1 ft_loader-test-extractor-1
brtloader-test-extractor-2 ft_loader-test-extractor-2
brtloader-test-extractor-3 ft_loader-test-extractor-3
brt-serialize-benchmark brt-serialize-benchmark
bnc-insert-benchmark bnc-insert-benchmark
test_groupcommit_perf.tdb test_groupcommit_perf.tdb
......
...@@ -12,16 +12,16 @@ else ...@@ -12,16 +12,16 @@ else
SRCDIRS_CXX = cxx db-benchmark-test-cxx SRCDIRS_CXX = cxx db-benchmark-test-cxx
endif endif
SRCDIRS = $(OS_CHOICE) newbrt src/range_tree src/lock_tree src utils db-benchmark-test $(SRCDIRS_CXX) SRCDIRS = $(OS_CHOICE) ft src/range_tree src/lock_tree src utils db-benchmark-test $(SRCDIRS_CXX)
BUILDDIRS = $(SRCDIRS) man/texi BUILDDIRS = $(SRCDIRS) man/texi
ifeq ($(OS_CHOICE),windows) ifeq ($(OS_CHOICE),windows)
.NOTPARALLEL:; #Windows/cygwin jobserver does not properly handle submakes. Serialize .NOTPARALLEL:; #Windows/cygwin jobserver does not properly handle submakes. Serialize
endif endif
newbrt.dir: $(OS_CHOICE).dir ft.dir: $(OS_CHOICE).dir
src/range_tree.dir: $(OS_CHOICE).dir src/range_tree.dir: $(OS_CHOICE).dir
src/lock_tree.dir: src/range_tree.dir src/lock_tree.dir: src/range_tree.dir
src.dir: newbrt.dir src/lock_tree.dir src.dir: ft.dir src/lock_tree.dir
utils.dir: src.dir utils.dir: src.dir
db-benchmark-test.dir: src.dir db-benchmark-test.dir: src.dir
cxx.dir: src.dir cxx.dir: src.dir
...@@ -41,7 +41,7 @@ build: $(patsubst %,%.dir, $(BUILDDIRS)) ...@@ -41,7 +41,7 @@ build: $(patsubst %,%.dir, $(BUILDDIRS))
%.check: %.check:
cd $(patsubst %.check, %,$@) && $(MAKE) check cd $(patsubst %.check, %,$@) && $(MAKE) check
release: linux.local newbrt.local src.local release.local release: linux.local ft.local src.local release.local
CHECKS = $(patsubst %,%.checkdir,$(SRCDIRS)) CHECKS = $(patsubst %,%.checkdir,$(SRCDIRS))
...@@ -60,26 +60,26 @@ summarize: check ...@@ -60,26 +60,26 @@ summarize: check
check: $(CHECKS) check: $(CHECKS)
.PHONY: fastbuild fastbuildtests fastcheck fastchecknewbrt fastcheckydb fastcheckonlyfail fastcheckonlyfailnewbrt fastcheckonlyfailydb .PHONY: fastbuild fastbuildtests fastcheck fastcheckft fastcheckydb fastcheckonlyfail fastcheckonlyfailft fastcheckonlyfailydb
fastbuild: fastbuild:
$(MAKE) -s -k -C linux $(MAKE) -s -k -C linux
$(MAKE) -s -k -C newbrt local $(MAKE) -s -k -C ft local
$(MAKE) -s -k -C src local $(MAKE) -s -k -C src local
$(MAKE) -s -k -C utils $(MAKE) -s -k -C utils
fastbuildtests: fastbuild fastbuildtests: fastbuild
$(MAKE) -s -k -C newbrt/tests $(MAKE) -s -k -C ft/tests
$(MAKE) -s -k -C src/tests tests.tdb $(MAKE) -s -k -C src/tests tests.tdb
fastcheck: fastchecknewbrt fastcheckydb fastcheck: fastcheckft fastcheckydb
fastchecknewbrt: fastbuildtests fastcheckft: fastbuildtests
$(MAKE) -s -k -C newbrt/tests fastcheck $(MAKE) -s -k -C ft/tests fastcheck
fastcheckydb: fastbuildtests fastcheckydb: fastbuildtests
$(MAKE) -s -k -C src/tests fastcheck.tdb $(MAKE) -s -k -C src/tests fastcheck.tdb
fastcheckonlyfail: fastcheckonlyfailnewbrt fastcheckonlyfailydb fastcheckonlyfail: fastcheckonlyfailft fastcheckonlyfailydb
fastcheckonlyfailnewbrt: fastbuildtests fastcheckonlyfailft: fastbuildtests
$(MAKE) -s -k -C newbrt/tests fastcheckonlyfail $(MAKE) -s -k -C ft/tests fastcheckonlyfail
fastcheckonlyfailydb: fastbuildtests fastcheckonlyfailydb: fastbuildtests
$(MAKE) -s -k -C src/tests fastcheckonlyfail.tdb $(MAKE) -s -k -C src/tests fastcheckonlyfail.tdb
...@@ -114,12 +114,12 @@ build-coverage: ...@@ -114,12 +114,12 @@ build-coverage:
$(MAKE) build OPTFLAGS= GCOV_FLAGS="-fprofile-arcs -ftest-coverage" $(MAKE) build OPTFLAGS= GCOV_FLAGS="-fprofile-arcs -ftest-coverage"
# this is messy now since we dont have consistent make targets # this is messy now since we dont have consistent make targets
check-coverage: check-coverage-newbrt check-coverage-src-tests check-coverage-utils check-coverage-cxx-tests \ check-coverage: check-coverage-ft check-coverage-src-tests check-coverage-utils check-coverage-cxx-tests \
check-coverage-db-benchmark-test check-coverage-db-benchmark-test-cxx \ check-coverage-db-benchmark-test check-coverage-db-benchmark-test-cxx \
check-coverage-range-tree-tests check-coverage-lock-tree-tests check-coverage-range-tree-tests check-coverage-lock-tree-tests
check-coverage-newbrt: check-coverage-ft:
(cd newbrt && $(MAKE) -k check VGRIND="") (cd ft && $(MAKE) -k check VGRIND="")
check-coverage-src-tests: check-coverage-src-tests:
(cd src/tests && $(MAKE) -k check.tdb VGRIND="") (cd src/tests && $(MAKE) -k check.tdb VGRIND="")
check-coverage-utils: check-coverage-utils:
......
...@@ -4,25 +4,25 @@ file(GLOB_RECURSE all_srcs ...@@ -4,25 +4,25 @@ file(GLOB_RECURSE all_srcs
toku_include/*.c toku_include/*.c
buildheader/*.c buildheader/*.c
portability/*.c portability/*.c
newbrt/*.c ft/*.c
src/*.c src/*.c
utils/*.c utils/*.c
db-benchmark-test/*.c db-benchmark-test/*.c
${CMAKE_CURRENT_BINARY_DIR}/newbrt/log_code.c ${CMAKE_CURRENT_BINARY_DIR}/ft/log_code.c
${CMAKE_CURRENT_BINARY_DIR}/newbrt/log_print.c ${CMAKE_CURRENT_BINARY_DIR}/ft/log_print.c
) )
file(GLOB_RECURSE all_hdrs file(GLOB_RECURSE all_hdrs
include/*.h include/*.h
toku_include/*.h toku_include/*.h
buildheader/*.h buildheader/*.h
portability/*.h portability/*.h
newbrt/*.h ft/*.h
src/*.h src/*.h
utils/*.h utils/*.h
db-benchmark-test/*.h db-benchmark-test/*.h
${CMAKE_CURRENT_BINARY_DIR}/toku_include/config.h ${CMAKE_CURRENT_BINARY_DIR}/toku_include/config.h
${CMAKE_CURRENT_BINARY_DIR}/buildheader/db.h ${CMAKE_CURRENT_BINARY_DIR}/buildheader/db.h
${CMAKE_CURRENT_BINARY_DIR}/newbrt/log_header.h ${CMAKE_CURRENT_BINARY_DIR}/ft/log_header.h
) )
option(USE_CTAGS "Build the ctags database." ON) option(USE_CTAGS "Build the ctags database." ON)
......
...@@ -117,7 +117,7 @@ include(CTest) ...@@ -117,7 +117,7 @@ include(CTest)
if (BUILD_TESTING) if (BUILD_TESTING)
## set up full valgrind suppressions file (concatenate the suppressions files) ## set up full valgrind suppressions file (concatenate the suppressions files)
file(READ newbrt/valgrind.suppressions valgrind_suppressions) file(READ ft/valgrind.suppressions valgrind_suppressions)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${valgrind_suppressions}") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${valgrind_suppressions}")
file(READ src/tests/bdb.suppressions bdb_suppressions) file(READ src/tests/bdb.suppressions bdb_suppressions)
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${bdb_suppressions}") file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${bdb_suppressions}")
......
#include <stdarg.h> #include <stdarg.h>
#include <errno.h> #include <errno.h>
#include <toku_assert.h> #include <toku_assert.h>
#include "../newbrt/brttypes.h" #include "../ft/fttypes.h"
#include <db_cxx.h> #include <db_cxx.h>
DbEnv::DbEnv (u_int32_t flags) DbEnv::DbEnv (u_int32_t flags)
......
...@@ -47,7 +47,7 @@ endif ...@@ -47,7 +47,7 @@ endif
ifneq ($(OSX),) ifneq ($(OSX),)
VGRIND= VGRIND=
else else
VGRIND=valgrind --quiet --error-exitcode=1 --leak-check=yes --suppressions=../../newbrt/valgrind.suppressions VGRIND=valgrind --quiet --error-exitcode=1 --leak-check=yes --suppressions=../../ft/valgrind.suppressions
endif endif
default: build default: build
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
.DEFAULT_GOAL= build .DEFAULT_GOAL= build
TOKUROOT=../ TOKUROOT=../
INCLUDEDIRS=-I. -I../ -I$(TOKUROOT)include -I$(TOKUROOT)toku_include -I$(TOKUROOT)newbrt -I../range_tree -I../lock_tree INCLUDEDIRS=-I. -I../ -I$(TOKUROOT)include -I$(TOKUROOT)toku_include -I$(TOKUROOT)ft -I../range_tree -I../lock_tree
DEPEND_COMPILE += \ DEPEND_COMPILE += \
./*.h \ ./*.h \
#end #end
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
.DEFAULT_GOAL= build .DEFAULT_GOAL= build
TOKUROOT=../ TOKUROOT=../
INCLUDEDIRS=-I. -I$(TOKUROOT)newbrt -I$(TOKUROOT)include -I$(TOKUROOT)/toku_include -I$(TOKUROOT)src INCLUDEDIRS=-I. -I$(TOKUROOT)ft -I$(TOKUROOT)include -I$(TOKUROOT)/toku_include -I$(TOKUROOT)src
DEPEND_COMPILE += \ DEPEND_COMPILE += \
../*.h \ ../*.h \
../range_tree/*.h \ ../range_tree/*.h \
...@@ -144,7 +144,7 @@ OFILES = \ ...@@ -144,7 +144,7 @@ OFILES = \
$(TOKUROOT)src/ydb.lib \ $(TOKUROOT)src/ydb.lib \
$(TOKUROOT)src/lock_tree/locktree.lib \ $(TOKUROOT)src/lock_tree/locktree.lib \
$(TOKUROOT)src/range_tree/rangetree.lib \ $(TOKUROOT)src/range_tree/rangetree.lib \
$(TOKUROOT)newbrt/newbrt.lib \ $(TOKUROOT)ft/ft.lib \
$(LIBPORTABILITY_SO) \ $(LIBPORTABILITY_SO) \
#end #end
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#ifdef TOKUDB #ifdef TOKUDB
#include <newbrt/key.h> #include <ft/key.h>
#include <newbrt/cachetable.h> #include <ft/cachetable.h>
#endif #endif
static const char *pname; static const char *pname;
......
...@@ -17,36 +17,33 @@ add_custom_command( ...@@ -17,36 +17,33 @@ add_custom_command(
DEPENDS logformat DEPENDS logformat
) )
set(BRT_SOURCES set(FT_SOURCES
block_allocator.c block_allocator.c
block_table.c block_table.c
brtloader.c
brtloader-callback.c
brt-serialize.c
brt-verify.c
brt.c
brt-cachetable-wrappers.c
brt-flusher.c
brt_header.c
brt-hot-flusher.c
brt_msg.c
brt-test-helpers.c
cachetable.c cachetable.c
checkpoint.c checkpoint.c
compress.c compress.c
dbufio.c dbufio.c
fifo.c fifo.c
ft.c
ft-cachetable-wrappers.c
ft-flusher.c
ft-hot-flusher.c
ftloader.c
ftloader-callback.c
ft_msg.c
ft-ops.c
ft-serialize.c
ft-test-helpers.c
ft-verify.c
key.c key.c
kibbutz.c kibbutz.c
leafentry.c leafentry.c
le-cursor.c le-cursor.c
logcursor.c
logfilemgr.c logfilemgr.c
logger.c logger.c
"${CMAKE_CURRENT_BINARY_DIR}/log_code.c"
"${CMAKE_CURRENT_BINARY_DIR}/log_header.h"
log_upgrade.c log_upgrade.c
"${CMAKE_CURRENT_BINARY_DIR}/log_print.c"
logcursor.c
memarena.c memarena.c
mempool.c mempool.c
minicron.c minicron.c
...@@ -55,66 +52,69 @@ set(BRT_SOURCES ...@@ -55,66 +52,69 @@ set(BRT_SOURCES
queue.c queue.c
quicklz.c quicklz.c
recover.c recover.c
roll.c
rollback.c rollback.c
roll.c
sort.c sort.c
sub_block.c sub_block.c
ule.c
threadpool.c threadpool.c
txn.c txn.c
ule.c
workqueue.c workqueue.c
x1764.c x1764.c
xids.c xids.c
ybt.c ybt.c
"${CMAKE_CURRENT_BINARY_DIR}/log_code.c"
"${CMAKE_CURRENT_BINARY_DIR}/log_header.h"
"${CMAKE_CURRENT_BINARY_DIR}/log_print.c"
) )
add_library(newbrt SHARED ${BRT_SOURCES}) add_library(ft SHARED ${FT_SOURCES})
add_library(newbrt_static STATIC ${BRT_SOURCES}) add_library(ft_static STATIC ${FT_SOURCES})
## we're going to link this into libtokudb.so so it needs to have PIC ## we're going to link this into libtokudb.so so it needs to have PIC
set_property(TARGET newbrt_static APPEND PROPERTY COMPILE_FLAGS "-fPIC") set_property(TARGET ft_static APPEND PROPERTY COMPILE_FLAGS "-fPIC")
maybe_add_gcov_to_libraries(newbrt newbrt_static) maybe_add_gcov_to_libraries(ft ft_static)
## depend on other generated targets ## depend on other generated targets
add_dependencies(newbrt install_tdb_h build_lzma) add_dependencies(ft install_tdb_h build_lzma)
add_dependencies(newbrt_static install_tdb_h build_lzma) add_dependencies(ft_static install_tdb_h build_lzma)
## link with tokuportability, and lzma (which should be static) ## link with tokuportability, and lzma (which should be static)
target_link_libraries(newbrt ${LIBTOKUPORTABILITY} lzma) target_link_libraries(ft ${LIBTOKUPORTABILITY} lzma)
target_link_libraries(newbrt_static ${LIBTOKUPORTABILITY} lzma) target_link_libraries(ft_static ${LIBTOKUPORTABILITY} lzma)
if (CMAKE_C_COMPILER_ID STREQUAL Intel) if (CMAKE_C_COMPILER_ID STREQUAL Intel)
## don't link with default libs, those come with tokuportability, but we ## don't link with default libs, those come with tokuportability, but we
## do need libc and we need the intel libirc (and it should be static to ## do need libc and we need the intel libirc (and it should be static to
## be redistributable) ## be redistributable)
target_link_libraries(newbrt -nodefaultlibs c -Bstatic irc -Bdynamic) target_link_libraries(ft -nodefaultlibs c -Bstatic irc -Bdynamic)
endif () endif ()
## conditionally use cilk ## conditionally use cilk
if (USE_CILK) if (USE_CILK)
set_property(TARGET newbrt APPEND PROPERTY COMPILE_DEFINITIONS HAVE_CILK=1) set_property(TARGET ft APPEND PROPERTY COMPILE_DEFINITIONS HAVE_CILK=1)
set_property(TARGET newbrt_static APPEND PROPERTY COMPILE_DEFINITIONS HAVE_CILK=1) set_property(TARGET ft_static APPEND PROPERTY COMPILE_DEFINITIONS HAVE_CILK=1)
target_link_libraries(newbrt cilkrts) target_link_libraries(ft cilkrts)
target_link_libraries(newbrt_static cilkrts) target_link_libraries(ft_static cilkrts)
endif (USE_CILK) endif (USE_CILK)
## build the bins in this directory ## build the bins in this directory
set(bins set(bins
brtdump ftdump
tdb_logprint tdb_logprint
tdb-recover tdb-recover
) )
foreach(bin ${bins}) foreach(bin ${bins})
add_executable(${bin} ${bin}.c) add_executable(${bin} ${bin}.c)
add_dependencies(${bin} install_tdb_h) add_dependencies(${bin} install_tdb_h)
target_link_libraries(${bin} newbrt ${LIBTOKUPORTABILITY}) target_link_libraries(${bin} ft ${LIBTOKUPORTABILITY})
add_executable(${bin}_static ${bin}.c) add_executable(${bin}_static ${bin}.c)
add_dependencies(${bin} install_tdb_h) add_dependencies(${bin} install_tdb_h)
target_link_libraries(${bin}_static newbrt_static ${LIBTOKUPORTABILITY_STATIC}) target_link_libraries(${bin}_static ft_static ${LIBTOKUPORTABILITY_STATIC})
endforeach(bin) endforeach(bin)
install( install(
TARGETS brtdump_static TARGETS ftdump_static
DESTINATION bin DESTINATION bin
) )
......
ROOT = ../ ROOT = ../
build: newbrt.builddir build: ft.builddir
check: newbrt.checkdir check: ft.checkdir
include $(ROOT)Makefile.include include $(ROOT)Makefile.include
......
...@@ -13,19 +13,19 @@ DEPEND_COMPILE += \ ...@@ -13,19 +13,19 @@ DEPEND_COMPILE += \
log_header.h \ log_header.h \
# keep this line so I can have a \ on the previous line # keep this line so I can have a \ on the previous line
NEWBRT_SO = $(TOKUROOT)lib/libnewbrt.$(SOEXT) FT_SO = $(TOKUROOT)lib/libft.$(SOEXT)
NEWBRT_A = $(TOKUROOT)lib/libnewbrt.$(AEXT) FT_A = $(TOKUROOT)lib/libft.$(AEXT)
SKIP_NEWBRTRULE=1 SKIP_FTRULE=1
include $(TOKUROOT)toku_include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
LDFLAGS+=-L$(TOKUROOT)lib -Wl,-rpath,$(shell pwd)/$(TOKUROOT)lib LDFLAGS+=-L$(TOKUROOT)lib -Wl,-rpath,$(shell pwd)/$(TOKUROOT)lib
LDLIBS+=-lnewbrt -l$(LIBTOKUPORTABILITY) LDLIBS+=-lft -l$(LIBTOKUPORTABILITY)
# When debugging, try: valgrind --show-reachable=yes --leak-check=full ./brt-test # When debugging, try: valgrind --show-reachable=yes --leak-check=full ./brt-test
BINS_RAW= \ BINS_RAW= \
brtdump \ ftdump \
brtdump_static \ ftdump_static \
tdb_logprint \ tdb_logprint \
tdb-recover \ tdb-recover \
# Intentionally left blank # Intentionally left blank
...@@ -36,20 +36,20 @@ BINS_RAW= \ ...@@ -36,20 +36,20 @@ BINS_RAW= \
build default: local build default: local
cd tests;$(MAKE) build cd tests;$(MAKE) build
local: bins libs $(TEST_NEWBRT); local: bins libs $(TEST_FT);
BRT_SOURCES = \ FT_SOURCES = \
block_allocator \ block_allocator \
block_table \ block_table \
brtloader-callback \ ft_loader-callback \
brt-serialize \ brt-serialize \
brt-verify \ brt-verify \
brt \ brt \
brt-cachetable-wrappers \ brt-cachetable-wrappers \
brt-flusher \ brt-flusher \
brt-hot-flusher \ brt-hot-flusher \
brt_msg \ ft_msg \
brt-test-helpers \ brt-test-helpers \
cachetable \ cachetable \
checkpoint \ checkpoint \
...@@ -85,40 +85,40 @@ BRT_SOURCES = \ ...@@ -85,40 +85,40 @@ BRT_SOURCES = \
ybt \ ybt \
# keep this line so I can have a \ on the previous line # keep this line so I can have a \ on the previous line
ifneq ($(OS_CHOICE),windows) ifneq ($(OS_CHOICE),windows)
BRT_SOURCES += trace_mem #Windows does not handle 'empty' file FT_SOURCES += trace_mem #Windows does not handle 'empty' file
endif endif
TEST_NEWBRT = brt-test-helpers.$(OEXT) TEST_FT = brt-test-helpers.$(OEXT)
BRT_C_FILES = $(patsubst %,%.c,$(BRT_SOURCES)) FT_C_FILES = $(patsubst %,%.c,$(FT_SOURCES))
BRT_O_FILES = $(patsubst %,%.$(OEXT),$(BRT_SOURCES)) FT_O_FILES = $(patsubst %,%.$(OEXT),$(FT_SOURCES))
newbrt.$(OEXT): $(BRT_C_FILES) $(DEPEND_COMPILE) ft.$(OEXT): $(FT_C_FILES) $(DEPEND_COMPILE)
$(CC) -c $(BRT_C_FILES) $(COMBINE_C) $(CPPFLAGS) $(CFLAGS) $(OOUTPUT)$@ $(CC) -c $(FT_C_FILES) $(COMBINE_C) $(CPPFLAGS) $(CFLAGS) $(OOUTPUT)$@
brt-serialize.$(OEXT): $(wildcard backwards_*.c) brt-serialize.$(OEXT): $(wildcard backwards_*.c)
ifneq ($(CYGWIN),) ifneq ($(CYGWIN),)
NEWBRT_O_FILES = $(BRT_O_FILES) FT_O_FILES = $(FT_O_FILES)
else ifeq ($(CC),icc) else ifeq ($(CC),icc)
NEWBRT_O_FILES = $(BRT_O_FILES) FT_O_FILES = $(FT_O_FILES)
else ifeq ($(COMBINE),0) else ifeq ($(COMBINE),0)
NEWBRT_O_FILES = $(BRT_O_FILES) FT_O_FILES = $(FT_O_FILES)
else else
NEWBRT_O_FILES = newbrt.o FT_O_FILES = ft.o
endif endif
NEWBRT_O_FILES += brtloader.$(OEXT) quicklz.$(OEXT) compress.$(OEXT) FT_O_FILES += ft_loader.$(OEXT) quicklz.$(OEXT) compress.$(OEXT)
brtloader.$(OEXT): $(DEPEND_COMPILE) ft_loader.$(OEXT): $(DEPEND_COMPILE)
$(NEWBRT_O_FILES): VISIBILITY= $(FT_O_FILES): VISIBILITY=
$(NEWBRT_O_FILES): $(LZMA_H) $(FT_O_FILES): $(LZMA_H)
$(NEWBRT_SO): DISABLE_WARNING += 10237 # Do not complain about -lcilkrts being linked in dynamically, static library not available $(FT_SO): DISABLE_WARNING += 10237 # Do not complain about -lcilkrts being linked in dynamically, static library not available
$(NEWBRT_SO): $(NEWBRT_O_FILES) $(LZMA_A) $(FT_SO): $(FT_O_FILES) $(LZMA_A)
$(TOKULINKER) $(SHARED) $(SYMBOLS) $(GCOV_FLAGS) $(SKIP_WARNING) $(NEWBRT_O_FILES) $(LZMA_A) -o$(NEWBRT_SO) $(LINUX_NOSTDLIB) $(LCILKRTS) $(TOKULINKER) $(SHARED) $(SYMBOLS) $(GCOV_FLAGS) $(SKIP_WARNING) $(FT_O_FILES) $(LZMA_A) -o$(FT_SO) $(LINUX_NOSTDLIB) $(LCILKRTS)
$(NEWBRT_A): $(NEWBRT_O_FILES) $(FT_A): $(FT_O_FILES)
log_code.$(OEXT): log_header.h wbuf.h log-internal.h rbuf.h log_code.$(OEXT): log_header.h wbuf.h log-internal.h rbuf.h
...@@ -132,15 +132,15 @@ log_code.c: logformat$(BINSUF) ...@@ -132,15 +132,15 @@ log_code.c: logformat$(BINSUF)
log_print.c log_header.h: log_code.c log_print.c log_header.h: log_code.c
test 1 = 1 test 1 = 1
#Needs to be done manually since it does not include newbrt. #Needs to be done manually since it does not include ft.
logformat$(BINSUF): logformat.c $(LIBPORTABILITY_SO) logformat$(BINSUF): logformat.c $(LIBPORTABILITY_SO)
$(CC) $< $(BIN_FROM_O_FLAGS_NOLIB) $(LDFLAGS) $(ALWAYS_LINK) $(LINK_MUST_BE_LAST) $(LIBPORTABILITY_SO) $(CC) $< $(BIN_FROM_O_FLAGS_NOLIB) $(LDFLAGS) $(ALWAYS_LINK) $(LINK_MUST_BE_LAST) $(LIBPORTABILITY_SO)
ifeq ($(PROF),1) ifeq ($(PROF),1)
libs: $(NEWBRT_A) libs: $(FT_A)
else else
libs: $(NEWBRT_SO) $(NEWBRT_A) libs: $(FT_SO) $(FT_A)
endif endif
bins: $(BINS) bins: $(BINS)
...@@ -151,9 +151,9 @@ check: bins ...@@ -151,9 +151,9 @@ check: bins
cd tests;$(MAKE) check cd tests;$(MAKE) check
ifeq ($(PROF),1) ifeq ($(PROF),1)
$(BINS): $(NEWBRT_A) $(LIBPORTABILITY_A) $(BINS): $(FT_A) $(LIBPORTABILITY_A)
else else
$(BINS): $(NEWBRT_SO) $(LIBPORTABILITY_SO) $(BINS): $(FT_SO) $(LIBPORTABILITY_SO)
endif endif
foo2: foo2:
...@@ -171,19 +171,19 @@ clean: clean-local clean-tests ...@@ -171,19 +171,19 @@ clean: clean-local clean-tests
clean-tests: clean-tests:
cd tests;$(MAKE) clean cd tests;$(MAKE) clean
clean-local: clean-local:
$(RM) $(TOKUROOT)lib/libnewbrt.$(AEXT) $(TOKUROOT)lib/libnewbrt.$(SOEXT) $(RM) $(TOKUROOT)lib/libft.$(AEXT) $(TOKUROOT)lib/libft.$(SOEXT)
rm -rf $(NEWBRT) rm -rf $(FT)
rm -rf test_oexcl.c.tmp *.brt rm -rf test_oexcl.c.tmp *.ft_handle
rm -rf log_code.c log_header.h log_print.c logformat rm -rf log_code.c log_header.h log_print.c logformat
brtdump_static$(BINSUF): DEPEND_LINK = -lpthread -ldl -lz ftdump_static$(BINSUF): DEPEND_LINK = -lpthread -ldl -lz
brtdump_static$(BINSUF): brtdump.$(OEXT) $(NEWBRT_A) $(LZMA_A) $(LIBPORTABILITY_A) $(DEPEND_COMPILE) $(DEPEND_LINK) ftdump_static$(BINSUF): ftdump.$(OEXT) $(FT_A) $(LZMA_A) $(LIBPORTABILITY_A) $(DEPEND_COMPILE) $(DEPEND_LINK)
$(CC) $< $(NEWBRT_A) $(LZMA_A) $(LIBPORTABILITY_A) $(BIN_FROM_O_FLAGS_NOLIB) $(ALWAYS_LINK) $(LINK_MUST_BE_LAST) $(CC) $< $(FT_A) $(LZMA_A) $(LIBPORTABILITY_A) $(BIN_FROM_O_FLAGS_NOLIB) $(ALWAYS_LINK) $(LINK_MUST_BE_LAST)
# After doing (cd ../src/tests;make test_log5.recover), run these. The files should have no differences. # After doing (cd ../src/tests;make test_log5.recover), run these. The files should have no differences.
testdump: brtdump$(BINSUF) testdump: ftdump$(BINSUF)
./brtdump ../src/tests/dir.test_log5.c.tdb.recover/foo.db > dump.r && ./brtdump ../src/tests/dir.test_log5.c.tdb/foo.db > dump.$(OEXT) && diff dump.$(OEXT) dump.r ./ftdump ../src/tests/dir.test_log5.c.tdb.recover/foo.db > dump.r && ./ftdump ../src/tests/dir.test_log5.c.tdb/foo.db > dump.$(OEXT) && diff dump.$(OEXT) dump.r
foo: foo:
@echo BRTLOADER $(BRTLOADER) @echo FTLOADER $(FTLOADER)
@echo BDBDIR $(BDBDIR) @echo BDBDIR $(BDBDIR)
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include "brttypes.h" #include "fttypes.h"
#if defined(__cplusplus) || defined(__cilkplusplus) #if defined(__cplusplus) || defined(__cilkplusplus)
extern "C" { extern "C" {
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <toku_portability.h> #include <toku_portability.h>
#include "brt-internal.h" // ugly but pragmatic, need access to dirty bits while holding translation lock #include "ft-internal.h" // ugly but pragmatic, need access to dirty bits while holding translation lock
#include "brttypes.h" #include "fttypes.h"
#include "block_table.h" #include "block_table.h"
#include "memory.h" #include "memory.h"
#include "toku_assert.h" #include "toku_assert.h"
...@@ -83,11 +83,11 @@ static inline void unlock_for_blocktable (BLOCK_TABLE bt); ...@@ -83,11 +83,11 @@ static inline void unlock_for_blocktable (BLOCK_TABLE bt);
static void static void
brtheader_set_dirty(struct brt_header *h, BOOL for_checkpoint){ ft_set_dirty(FT h, BOOL for_checkpoint){
assert(toku_mutex_is_locked(&h->blocktable->mutex)); assert(toku_mutex_is_locked(&h->blocktable->mutex));
assert(h->type == BRTHEADER_CURRENT); assert(h->type == FT_CURRENT);
if (for_checkpoint) { if (for_checkpoint) {
assert(h->checkpoint_header->type == BRTHEADER_CHECKPOINT_INPROGRESS); assert(h->checkpoint_header->type == FT_CHECKPOINT_INPROGRESS);
h->checkpoint_header->dirty = 1; h->checkpoint_header->dirty = 1;
} }
else { else {
...@@ -97,7 +97,7 @@ brtheader_set_dirty(struct brt_header *h, BOOL for_checkpoint){ ...@@ -97,7 +97,7 @@ brtheader_set_dirty(struct brt_header *h, BOOL for_checkpoint){
//fd is protected (must be holding fdlock) //fd is protected (must be holding fdlock)
static void static void
maybe_truncate_cachefile(BLOCK_TABLE bt, int fd, struct brt_header *h, u_int64_t size_needed_before) { maybe_truncate_cachefile(BLOCK_TABLE bt, int fd, FT h, u_int64_t size_needed_before) {
assert(toku_mutex_is_locked(&bt->mutex)); assert(toku_mutex_is_locked(&bt->mutex));
u_int64_t new_size_needed = block_allocator_allocated_limit(bt->block_allocator); u_int64_t new_size_needed = block_allocator_allocated_limit(bt->block_allocator);
//Save a call to toku_os_get_file_size (kernel call) if unlikely to be useful. //Save a call to toku_os_get_file_size (kernel call) if unlikely to be useful.
...@@ -107,7 +107,7 @@ maybe_truncate_cachefile(BLOCK_TABLE bt, int fd, struct brt_header *h, u_int64_t ...@@ -107,7 +107,7 @@ maybe_truncate_cachefile(BLOCK_TABLE bt, int fd, struct brt_header *h, u_int64_t
//fd is protected (must be holding fdlock) //fd is protected (must be holding fdlock)
void void
toku_maybe_truncate_cachefile_on_open(BLOCK_TABLE bt, int fd, struct brt_header *h) { toku_maybe_truncate_cachefile_on_open(BLOCK_TABLE bt, int fd, FT h) {
lock_for_blocktable(bt); lock_for_blocktable(bt);
u_int64_t size_needed = block_allocator_allocated_limit(bt->block_allocator); u_int64_t size_needed = block_allocator_allocated_limit(bt->block_allocator);
toku_maybe_truncate_cachefile(h->cf, fd, size_needed); toku_maybe_truncate_cachefile(h->cf, fd, size_needed);
...@@ -255,7 +255,7 @@ PRNTF("free", i, pair->size, pair->u.diskoff, bt); ...@@ -255,7 +255,7 @@ PRNTF("free", i, pair->size, pair->u.diskoff, bt);
// inprogress = NULL // inprogress = NULL
//fd is protected (must be holding fdlock) //fd is protected (must be holding fdlock)
void void
toku_block_translation_note_end_checkpoint (BLOCK_TABLE bt, int fd, struct brt_header *h) { toku_block_translation_note_end_checkpoint (BLOCK_TABLE bt, int fd, FT h) {
// Free unused blocks // Free unused blocks
lock_for_blocktable(bt); lock_for_blocktable(bt);
u_int64_t allocated_limit_at_start = block_allocator_allocated_limit(bt->block_allocator); u_int64_t allocated_limit_at_start = block_allocator_allocated_limit(bt->block_allocator);
...@@ -333,13 +333,13 @@ unlock_for_blocktable (BLOCK_TABLE bt) { ...@@ -333,13 +333,13 @@ unlock_for_blocktable (BLOCK_TABLE bt) {
} }
void void
toku_brtheader_lock (struct brt_header *h) { toku_ft_lock (FT h) {
BLOCK_TABLE bt = h->blocktable; BLOCK_TABLE bt = h->blocktable;
lock_for_blocktable(bt); lock_for_blocktable(bt);
} }
void void
toku_brtheader_unlock (struct brt_header *h) { toku_ft_unlock (FT h) {
BLOCK_TABLE bt = h->blocktable; BLOCK_TABLE bt = h->blocktable;
assert(toku_mutex_is_locked(&bt->mutex)); assert(toku_mutex_is_locked(&bt->mutex));
unlock_for_blocktable(bt); unlock_for_blocktable(bt);
...@@ -384,9 +384,9 @@ translation_prevents_freeing(struct translation *t, BLOCKNUM b, struct block_tra ...@@ -384,9 +384,9 @@ translation_prevents_freeing(struct translation *t, BLOCKNUM b, struct block_tra
} }
static void static void
blocknum_realloc_on_disk_internal (BLOCK_TABLE bt, BLOCKNUM b, DISKOFF size, DISKOFF *offset, struct brt_header * h, BOOL for_checkpoint) { blocknum_realloc_on_disk_internal (BLOCK_TABLE bt, BLOCKNUM b, DISKOFF size, DISKOFF *offset, FT h, BOOL for_checkpoint) {
assert(toku_mutex_is_locked(&bt->mutex)); assert(toku_mutex_is_locked(&bt->mutex));
brtheader_set_dirty(h, for_checkpoint); ft_set_dirty(h, for_checkpoint);
struct translation *t = &bt->current; struct translation *t = &bt->current;
struct block_translation_pair old_pair = t->block_translation[b.b]; struct block_translation_pair old_pair = t->block_translation[b.b];
...@@ -416,7 +416,7 @@ PRNTF("New", b.b, t->block_translation[b.b].size, t->block_translation[b.b].u.di ...@@ -416,7 +416,7 @@ PRNTF("New", b.b, t->block_translation[b.b].size, t->block_translation[b.b].u.di
} }
void void
toku_blocknum_realloc_on_disk (BLOCK_TABLE bt, BLOCKNUM b, DISKOFF size, DISKOFF *offset, struct brt_header * h, BOOL for_checkpoint) { toku_blocknum_realloc_on_disk (BLOCK_TABLE bt, BLOCKNUM b, DISKOFF size, DISKOFF *offset, FT h, BOOL for_checkpoint) {
lock_for_blocktable(bt); lock_for_blocktable(bt);
struct translation *t = &bt->current; struct translation *t = &bt->current;
verify_valid_freeable_blocknum(t, b); verify_valid_freeable_blocknum(t, b);
...@@ -516,7 +516,7 @@ maybe_expand_translation (struct translation *t) { ...@@ -516,7 +516,7 @@ maybe_expand_translation (struct translation *t) {
} }
void void
toku_allocate_blocknum_unlocked(BLOCK_TABLE bt, BLOCKNUM *res, struct brt_header * h) { toku_allocate_blocknum_unlocked(BLOCK_TABLE bt, BLOCKNUM *res, FT h) {
assert(toku_mutex_is_locked(&bt->mutex)); assert(toku_mutex_is_locked(&bt->mutex));
BLOCKNUM result; BLOCKNUM result;
struct translation * t = &bt->current; struct translation * t = &bt->current;
...@@ -538,11 +538,11 @@ toku_allocate_blocknum_unlocked(BLOCK_TABLE bt, BLOCKNUM *res, struct brt_header ...@@ -538,11 +538,11 @@ toku_allocate_blocknum_unlocked(BLOCK_TABLE bt, BLOCKNUM *res, struct brt_header
t->block_translation[result.b].size = 0; t->block_translation[result.b].size = 0;
verify_valid_freeable_blocknum(t, result); verify_valid_freeable_blocknum(t, result);
*res = result; *res = result;
brtheader_set_dirty(h, FALSE); ft_set_dirty(h, FALSE);
} }
void void
toku_allocate_blocknum(BLOCK_TABLE bt, BLOCKNUM *res, struct brt_header * h) { toku_allocate_blocknum(BLOCK_TABLE bt, BLOCKNUM *res, FT h) {
lock_for_blocktable(bt); lock_for_blocktable(bt);
toku_allocate_blocknum_unlocked(bt, res, h); toku_allocate_blocknum_unlocked(bt, res, h);
unlock_for_blocktable(bt); unlock_for_blocktable(bt);
...@@ -562,7 +562,7 @@ free_blocknum_in_translation(struct translation *t, BLOCKNUM b) ...@@ -562,7 +562,7 @@ free_blocknum_in_translation(struct translation *t, BLOCKNUM b)
} }
static void static void
free_blocknum_unlocked(BLOCK_TABLE bt, BLOCKNUM *bp, struct brt_header * h, BOOL for_checkpoint) { free_blocknum_unlocked(BLOCK_TABLE bt, BLOCKNUM *bp, FT h, BOOL for_checkpoint) {
// Effect: Free a blocknum. // Effect: Free a blocknum.
// If the blocknum holds the only reference to a block on disk, free that block // If the blocknum holds the only reference to a block on disk, free that block
assert(toku_mutex_is_locked(&bt->mutex)); assert(toku_mutex_is_locked(&bt->mutex));
...@@ -573,7 +573,7 @@ free_blocknum_unlocked(BLOCK_TABLE bt, BLOCKNUM *bp, struct brt_header * h, BOOL ...@@ -573,7 +573,7 @@ free_blocknum_unlocked(BLOCK_TABLE bt, BLOCKNUM *bp, struct brt_header * h, BOOL
free_blocknum_in_translation(&bt->current, b); free_blocknum_in_translation(&bt->current, b);
if (for_checkpoint) { if (for_checkpoint) {
assert(h->checkpoint_header->type == BRTHEADER_CHECKPOINT_INPROGRESS); assert(h->checkpoint_header->type == FT_CHECKPOINT_INPROGRESS);
free_blocknum_in_translation(&bt->inprogress, b); free_blocknum_in_translation(&bt->inprogress, b);
} }
...@@ -589,11 +589,11 @@ PRNTF("free_blocknum_free", b.b, old_pair.size, old_pair.u.diskoff, bt); ...@@ -589,11 +589,11 @@ PRNTF("free_blocknum_free", b.b, old_pair.size, old_pair.u.diskoff, bt);
} }
} }
else assert(old_pair.size==0 && old_pair.u.diskoff == diskoff_unused); else assert(old_pair.size==0 && old_pair.u.diskoff == diskoff_unused);
brtheader_set_dirty(h, for_checkpoint); ft_set_dirty(h, for_checkpoint);
} }
void void
toku_free_blocknum(BLOCK_TABLE bt, BLOCKNUM *bp, struct brt_header * h, BOOL for_checkpoint) { toku_free_blocknum(BLOCK_TABLE bt, BLOCKNUM *bp, FT h, BOOL for_checkpoint) {
lock_for_blocktable(bt); lock_for_blocktable(bt);
free_blocknum_unlocked(bt, bp, h, for_checkpoint); free_blocknum_unlocked(bt, bp, h, for_checkpoint);
unlock_for_blocktable(bt); unlock_for_blocktable(bt);
...@@ -649,7 +649,7 @@ dump_translation(FILE *f, struct translation *t) { ...@@ -649,7 +649,7 @@ dump_translation(FILE *f, struct translation *t) {
else fprintf(f, " does not exist\n"); else fprintf(f, " does not exist\n");
} }
//Only used by toku_brt_dump which is only for debugging purposes //Only used by toku_ft_dump which is only for debugging purposes
void void
toku_dump_translation_table(FILE *f, BLOCK_TABLE bt) { toku_dump_translation_table(FILE *f, BLOCK_TABLE bt) {
lock_for_blocktable(bt); lock_for_blocktable(bt);
...@@ -662,7 +662,7 @@ toku_dump_translation_table(FILE *f, BLOCK_TABLE bt) { ...@@ -662,7 +662,7 @@ toku_dump_translation_table(FILE *f, BLOCK_TABLE bt) {
unlock_for_blocktable(bt); unlock_for_blocktable(bt);
} }
//Only used by brtdump //Only used by ftdump
void void
toku_blocknum_dump_translation(BLOCK_TABLE bt, BLOCKNUM b) { toku_blocknum_dump_translation(BLOCK_TABLE bt, BLOCKNUM b) {
lock_for_blocktable(bt); lock_for_blocktable(bt);
...@@ -892,14 +892,14 @@ toku_blocktable_internal_fragmentation (BLOCK_TABLE bt, int64_t *total_sizep, in ...@@ -892,14 +892,14 @@ toku_blocktable_internal_fragmentation (BLOCK_TABLE bt, int64_t *total_sizep, in
} }
void void
toku_realloc_descriptor_on_disk_unlocked(BLOCK_TABLE bt, DISKOFF size, DISKOFF *offset, struct brt_header * h) { toku_realloc_descriptor_on_disk_unlocked(BLOCK_TABLE bt, DISKOFF size, DISKOFF *offset, FT h) {
assert(toku_mutex_is_locked(&bt->mutex)); assert(toku_mutex_is_locked(&bt->mutex));
BLOCKNUM b = make_blocknum(RESERVED_BLOCKNUM_DESCRIPTOR); BLOCKNUM b = make_blocknum(RESERVED_BLOCKNUM_DESCRIPTOR);
blocknum_realloc_on_disk_internal(bt, b, size, offset, h, FALSE); blocknum_realloc_on_disk_internal(bt, b, size, offset, h, FALSE);
} }
void void
toku_realloc_descriptor_on_disk(BLOCK_TABLE bt, DISKOFF size, DISKOFF *offset, struct brt_header * h) { toku_realloc_descriptor_on_disk(BLOCK_TABLE bt, DISKOFF size, DISKOFF *offset, FT h) {
lock_for_blocktable(bt); lock_for_blocktable(bt);
toku_realloc_descriptor_on_disk_unlocked(bt, size, offset, h); toku_realloc_descriptor_on_disk_unlocked(bt, size, offset, h);
unlock_for_blocktable(bt); unlock_for_blocktable(bt);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include "brttypes.h" #include "fttypes.h"
#if defined(__cplusplus) || defined(__cilkplusplus) #if defined(__cplusplus) || defined(__cilkplusplus)
extern "C" { extern "C" {
...@@ -13,7 +13,7 @@ extern "C" { ...@@ -13,7 +13,7 @@ extern "C" {
typedef struct block_table *BLOCK_TABLE; typedef struct block_table *BLOCK_TABLE;
//Needed by tests, brtdump //Needed by tests, ftdump
struct block_translation_pair { struct block_translation_pair {
union { // If in the freelist, use next_free_blocknum, otherwise diskoff. union { // If in the freelist, use next_free_blocknum, otherwise diskoff.
DISKOFF diskoff; DISKOFF diskoff;
...@@ -26,28 +26,28 @@ void toku_blocktable_create_new(BLOCK_TABLE *btp); ...@@ -26,28 +26,28 @@ void toku_blocktable_create_new(BLOCK_TABLE *btp);
enum deserialize_error_code toku_blocktable_create_from_buffer(BLOCK_TABLE *btp, DISKOFF location_on_disk, DISKOFF size_on_disk, unsigned char *translation_buffer); enum deserialize_error_code toku_blocktable_create_from_buffer(BLOCK_TABLE *btp, DISKOFF location_on_disk, DISKOFF size_on_disk, unsigned char *translation_buffer);
void toku_blocktable_destroy(BLOCK_TABLE *btp); void toku_blocktable_destroy(BLOCK_TABLE *btp);
void toku_brtheader_lock(struct brt_header *h); void toku_ft_lock(FT h);
void toku_brtheader_unlock(struct brt_header *h); void toku_ft_unlock(FT h);
void toku_block_translation_note_start_checkpoint_unlocked(BLOCK_TABLE bt); void toku_block_translation_note_start_checkpoint_unlocked(BLOCK_TABLE bt);
void toku_block_translation_note_end_checkpoint(BLOCK_TABLE bt, int fd, struct brt_header *h); void toku_block_translation_note_end_checkpoint(BLOCK_TABLE bt, int fd, FT h);
void toku_block_translation_note_failed_checkpoint(BLOCK_TABLE bt); void toku_block_translation_note_failed_checkpoint(BLOCK_TABLE bt);
void toku_block_translation_note_skipped_checkpoint(BLOCK_TABLE bt); void toku_block_translation_note_skipped_checkpoint(BLOCK_TABLE bt);
void toku_maybe_truncate_cachefile_on_open(BLOCK_TABLE bt, int fd, struct brt_header *h); void toku_maybe_truncate_cachefile_on_open(BLOCK_TABLE bt, int fd, FT h);
//Blocknums //Blocknums
void toku_allocate_blocknum(BLOCK_TABLE bt, BLOCKNUM *res, struct brt_header * h); void toku_allocate_blocknum(BLOCK_TABLE bt, BLOCKNUM *res, FT h);
void toku_allocate_blocknum_unlocked(BLOCK_TABLE bt, BLOCKNUM *res, struct brt_header * h); void toku_allocate_blocknum_unlocked(BLOCK_TABLE bt, BLOCKNUM *res, FT h);
void toku_free_blocknum(BLOCK_TABLE bt, BLOCKNUM *b, struct brt_header * h, BOOL for_checkpoint); void toku_free_blocknum(BLOCK_TABLE bt, BLOCKNUM *b, FT h, BOOL for_checkpoint);
void toku_verify_blocknum_allocated(BLOCK_TABLE bt, BLOCKNUM b); void toku_verify_blocknum_allocated(BLOCK_TABLE bt, BLOCKNUM b);
void toku_block_verify_no_data_blocks_except_root_unlocked(BLOCK_TABLE bt, BLOCKNUM root); void toku_block_verify_no_data_blocks_except_root_unlocked(BLOCK_TABLE bt, BLOCKNUM root);
void toku_block_verify_no_free_blocknums(BLOCK_TABLE bt); void toku_block_verify_no_free_blocknums(BLOCK_TABLE bt);
void toku_realloc_descriptor_on_disk(BLOCK_TABLE bt, DISKOFF size, DISKOFF *offset, struct brt_header * h); void toku_realloc_descriptor_on_disk(BLOCK_TABLE bt, DISKOFF size, DISKOFF *offset, FT h);
void toku_realloc_descriptor_on_disk_unlocked(BLOCK_TABLE bt, DISKOFF size, DISKOFF *offset, struct brt_header * h); void toku_realloc_descriptor_on_disk_unlocked(BLOCK_TABLE bt, DISKOFF size, DISKOFF *offset, FT h);
void toku_get_descriptor_offset_size(BLOCK_TABLE bt, DISKOFF *offset, DISKOFF *size); void toku_get_descriptor_offset_size(BLOCK_TABLE bt, DISKOFF *offset, DISKOFF *size);
//Blocks and Blocknums //Blocks and Blocknums
void toku_blocknum_realloc_on_disk(BLOCK_TABLE bt, BLOCKNUM b, DISKOFF size, DISKOFF *offset, struct brt_header * h, BOOL for_checkpoint); void toku_blocknum_realloc_on_disk(BLOCK_TABLE bt, BLOCKNUM b, DISKOFF size, DISKOFF *offset, FT h, BOOL for_checkpoint);
void toku_translate_blocknum_to_offset_size(BLOCK_TABLE bt, BLOCKNUM b, DISKOFF *offset, DISKOFF *size); void toku_translate_blocknum_to_offset_size(BLOCK_TABLE bt, BLOCKNUM b, DISKOFF *offset, DISKOFF *size);
//Serialization //Serialization
...@@ -56,7 +56,7 @@ void toku_serialize_translation_to_wbuf_unlocked(BLOCK_TABLE bt, struct wbuf *w, ...@@ -56,7 +56,7 @@ void toku_serialize_translation_to_wbuf_unlocked(BLOCK_TABLE bt, struct wbuf *w,
void toku_block_table_swap_for_redirect(BLOCK_TABLE old_bt, BLOCK_TABLE new_bt); void toku_block_table_swap_for_redirect(BLOCK_TABLE old_bt, BLOCK_TABLE new_bt);
//DEBUG ONLY (brtdump included), tests included //DEBUG ONLY (ftdump included), tests included
void toku_blocknum_dump_translation(BLOCK_TABLE bt, BLOCKNUM b); void toku_blocknum_dump_translation(BLOCK_TABLE bt, BLOCKNUM b);
void toku_dump_translation_table(FILE *f, BLOCK_TABLE bt); void toku_dump_translation_table(FILE *f, BLOCK_TABLE bt);
void toku_block_alloc(BLOCK_TABLE bt, u_int64_t size, u_int64_t *offset); void toku_block_alloc(BLOCK_TABLE bt, u_int64_t size, u_int64_t *offset);
......
...@@ -17,13 +17,13 @@ ...@@ -17,13 +17,13 @@
#include "cachetable.h" #include "cachetable.h"
#include "rwlock.h" #include "rwlock.h"
#include "nonblocking_mutex.h" #include "nonblocking_mutex.h"
#include <newbrt/log_header.h> #include <ft/log_header.h>
#include "checkpoint.h" #include "checkpoint.h"
#include "minicron.h" #include "minicron.h"
#include "log-internal.h" #include "log-internal.h"
#include "kibbutz.h" #include "kibbutz.h"
#include "brt-internal.h" #include "ft-internal.h"
#define TRACE_CACHETABLE 0 #define TRACE_CACHETABLE 0
#if TRACE_CACHETABLE #if TRACE_CACHETABLE
...@@ -115,7 +115,7 @@ typedef struct ctpair *PAIR; ...@@ -115,7 +115,7 @@ typedef struct ctpair *PAIR;
struct ctpair { struct ctpair {
CACHEFILE cachefile; CACHEFILE cachefile;
CACHEKEY key; CACHEKEY key;
void* value_data; // data used by client threads, BRTNODEs and ROLLBACK_LOG_NODEs void* value_data; // data used by client threads, FTNODEs and ROLLBACK_LOG_NODEs
void* cloned_value_data; // cloned copy of value_data used for checkpointing void* cloned_value_data; // cloned copy of value_data used for checkpointing
long cloned_value_size; // size of cloned_value_data, used for accounting of ct->size_current long cloned_value_size; // size of cloned_value_data, used for accounting of ct->size_current
void* disk_data; // data used to fetch/flush value_data to and from disk. void* disk_data; // data used to fetch/flush value_data to and from disk.
...@@ -495,6 +495,9 @@ u_int32_t toku_get_cleaner_iterations_unlocked (CACHETABLE ct) { ...@@ -495,6 +495,9 @@ u_int32_t toku_get_cleaner_iterations_unlocked (CACHETABLE ct) {
#define unreservable_memory(size) ((size)/4) #define unreservable_memory(size) ((size)/4)
int toku_create_cachetable(CACHETABLE *result, long size_limit, LSN UU(initial_lsn), TOKULOGGER logger) { int toku_create_cachetable(CACHETABLE *result, long size_limit, LSN UU(initial_lsn), TOKULOGGER logger) {
if (size_limit == 0) {
size_limit = 128*1024*1024;
}
CACHETABLE MALLOC(ct); CACHETABLE MALLOC(ct);
if (ct == 0) return ENOMEM; if (ct == 0) return ENOMEM;
memset(ct, 0, sizeof(*ct)); memset(ct, 0, sizeof(*ct));
...@@ -864,7 +867,7 @@ int toku_cachefile_set_fd (CACHEFILE cf, int fd, const char *fname_in_env) { ...@@ -864,7 +867,7 @@ int toku_cachefile_set_fd (CACHEFILE cf, int fd, const char *fname_in_env) {
toku_free(cf->fname_in_env); toku_free(cf->fname_in_env);
cf->fname_in_env = NULL; cf->fname_in_env = NULL;
} }
//It is safe to have the name repeated since this is a newbrt-only test function. //It is safe to have the name repeated since this is a ft-only test function.
//There isn't an environment directory so its both env/cwd. //There isn't an environment directory so its both env/cwd.
cachefile_init_filenum(cf, fd, fname_in_env, fileid); cachefile_init_filenum(cf, fd, fname_in_env, fileid);
r = 0; r = 0;
...@@ -2234,7 +2237,7 @@ static void cachetable_fetch_pair( ...@@ -2234,7 +2237,7 @@ static void cachetable_fetch_pair(
cachetable_lock(ct); cachetable_lock(ct);
rwlock_read_unlock(&cf->fdlock); rwlock_read_unlock(&cf->fdlock);
// brt.c asserts that get_and_pin succeeds, // ft-ops.c asserts that get_and_pin succeeds,
// so we might as well just assert it here as opposed // so we might as well just assert it here as opposed
// to trying to support an INVALID state // to trying to support an INVALID state
assert(r == 0); assert(r == 0);
...@@ -2896,13 +2899,13 @@ void toku_cachefile_verify (CACHEFILE cf) { ...@@ -2896,13 +2899,13 @@ void toku_cachefile_verify (CACHEFILE cf) {
int64_t UU() toku_cachetable_size_slowslow (CACHETABLE ct) { int64_t UU() toku_cachetable_size_slowslow (CACHETABLE ct) {
// DANGER DANGER DANGER // DANGER DANGER DANGER
// This only works if every entry in the cachetable is actually a // This only works if every entry in the cachetable is actually a
// BRTNODE. Don't say you weren't warned. // FTNODE. Don't say you weren't warned.
PAIR p; PAIR p;
BOOL is_first = TRUE; BOOL is_first = TRUE;
int64_t ret = 0; int64_t ret = 0;
for (p=ct->clock_head; ct->clock_head!=NULL && (p!=ct->clock_head || is_first); p=p->clock_next) { for (p=ct->clock_head; ct->clock_head!=NULL && (p!=ct->clock_head || is_first); p=p->clock_next) {
is_first=FALSE; is_first=FALSE;
ret += brtnode_memory_size((BRTNODE) p->value_data); ret += ftnode_memory_size((FTNODE) p->value_data);
} }
return ret; return ret;
} }
...@@ -2910,13 +2913,13 @@ int64_t UU() toku_cachetable_size_slowslow (CACHETABLE ct) { ...@@ -2910,13 +2913,13 @@ int64_t UU() toku_cachetable_size_slowslow (CACHETABLE ct) {
int64_t UU() toku_cachetable_size_discrepancy (CACHETABLE ct) { int64_t UU() toku_cachetable_size_discrepancy (CACHETABLE ct) {
// DANGER DANGER DANGER // DANGER DANGER DANGER
// This only works if every entry in the cachetable is actually a // This only works if every entry in the cachetable is actually a
// BRTNODE. Don't say you weren't warned. // FTNODE. Don't say you weren't warned.
PAIR p; PAIR p;
BOOL is_first = TRUE; BOOL is_first = TRUE;
int64_t ret = 0; int64_t ret = 0;
for (p=ct->clock_head; ct->clock_head!=NULL && (p!=ct->clock_head || is_first); p=p->clock_next) { for (p=ct->clock_head; ct->clock_head!=NULL && (p!=ct->clock_head || is_first); p=p->clock_next) {
is_first=FALSE; is_first=FALSE;
ret += brtnode_memory_size((BRTNODE) p->value_data) - p->attr.size; ret += ftnode_memory_size((FTNODE) p->value_data) - p->attr.size;
} }
return ret; return ret;
} }
...@@ -2924,14 +2927,14 @@ int64_t UU() toku_cachetable_size_discrepancy (CACHETABLE ct) { ...@@ -2924,14 +2927,14 @@ int64_t UU() toku_cachetable_size_discrepancy (CACHETABLE ct) {
int64_t UU() toku_cachetable_size_discrepancy_pinned (CACHETABLE ct) { int64_t UU() toku_cachetable_size_discrepancy_pinned (CACHETABLE ct) {
// DANGER DANGER DANGER // DANGER DANGER DANGER
// This only works if every entry in the cachetable is actually a // This only works if every entry in the cachetable is actually a
// BRTNODE. Don't say you weren't warned. // FTNODE. Don't say you weren't warned.
PAIR p; PAIR p;
BOOL is_first = TRUE; BOOL is_first = TRUE;
int64_t ret = 0; int64_t ret = 0;
for (p=ct->clock_head; ct->clock_head!=NULL && (p!=ct->clock_head || is_first); p=p->clock_next) { for (p=ct->clock_head; ct->clock_head!=NULL && (p!=ct->clock_head || is_first); p=p->clock_next) {
is_first=FALSE; is_first=FALSE;
if (nb_mutex_writers(&p->value_nb_mutex)) { if (nb_mutex_writers(&p->value_nb_mutex)) {
ret += brtnode_memory_size((BRTNODE) p->value_data) - p->attr.size; ret += ftnode_memory_size((FTNODE) p->value_data) - p->attr.size;
} }
} }
return ret; return ret;
...@@ -3270,7 +3273,7 @@ int toku_cachetable_unpin_and_remove ( ...@@ -3270,7 +3273,7 @@ int toku_cachetable_unpin_and_remove (
p->attr.cache_pressure_size = 0; p->attr.cache_pressure_size = 0;
// //
// callback for removing the key // callback for removing the key
// for BRTNODEs, this leads to calling // for FTNODEs, this leads to calling
// toku_free_blocknum // toku_free_blocknum
// //
if (remove_key) { if (remove_key) {
...@@ -3389,7 +3392,7 @@ int toku_cachetable_unpin_and_remove ( ...@@ -3389,7 +3392,7 @@ int toku_cachetable_unpin_and_remove (
static int static int
set_filenum_in_array(OMTVALUE hv, u_int32_t index, void*arrayv) { set_filenum_in_array(OMTVALUE hv, u_int32_t index, void*arrayv) {
FILENUM *array = arrayv; FILENUM *array = arrayv;
struct brt_header* h = hv; FT h = hv;
array[index] = toku_cachefile_filenum(h->cf); array[index] = toku_cachefile_filenum(h->cf);
return 0; return 0;
} }
...@@ -3399,13 +3402,13 @@ log_open_txn (OMTVALUE txnv, u_int32_t UU(index), void *UU(extra)) { ...@@ -3399,13 +3402,13 @@ log_open_txn (OMTVALUE txnv, u_int32_t UU(index), void *UU(extra)) {
TOKUTXN txn = txnv; TOKUTXN txn = txnv;
TOKULOGGER logger = txn->logger; TOKULOGGER logger = txn->logger;
FILENUMS open_filenums; FILENUMS open_filenums;
uint32_t num_filenums = toku_omt_size(txn->open_brt_headers); uint32_t num_filenums = toku_omt_size(txn->open_fts);
FILENUM array[num_filenums]; FILENUM array[num_filenums];
{ {
open_filenums.num = num_filenums; open_filenums.num = num_filenums;
open_filenums.filenums = array; open_filenums.filenums = array;
//Fill in open_filenums //Fill in open_filenums
int r = toku_omt_iterate(txn->open_brt_headers, set_filenum_in_array, array); int r = toku_omt_iterate(txn->open_fts, set_filenum_in_array, array);
assert(r==0); assert(r==0);
} }
// Zardosht claims that COMMITTING, ABORTING and RETIRED can never happen because of the multi-operation lock. // Zardosht claims that COMMITTING, ABORTING and RETIRED can never happen because of the multi-operation lock.
...@@ -3927,7 +3930,7 @@ toku_cachefile_get_cachetable(CACHEFILE cf) { ...@@ -3927,7 +3930,7 @@ toku_cachefile_get_cachetable(CACHEFILE cf) {
return cf->cachetable; return cf->cachetable;
} }
//Only called by brtheader_end_checkpoint //Only called by ft_end_checkpoint
//Must have access to cf->fd (must be protected) //Must have access to cf->fd (must be protected)
int int
toku_cachefile_fsync(CACHEFILE cf) { toku_cachefile_fsync(CACHEFILE cf) {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <fcntl.h> #include <fcntl.h>
#include "brttypes.h" #include "fttypes.h"
#include "workqueue.h" #include "workqueue.h"
#if defined(__cplusplus) || defined(__cilkplusplus) #if defined(__cplusplus) || defined(__cilkplusplus)
...@@ -39,7 +39,11 @@ u_int32_t toku_get_cleaner_iterations_unlocked (CACHETABLE ct); ...@@ -39,7 +39,11 @@ u_int32_t toku_get_cleaner_iterations_unlocked (CACHETABLE ct);
// cachetable operations // cachetable operations
int toku_create_cachetable(CACHETABLE */*result*/, long size_limit, LSN initial_lsn, TOKULOGGER); // create and initialize a cache table
// size_limit is the upper limit on the size of the size of the values in the table
// pass 0 if you want the default
int toku_create_cachetable(CACHETABLE *result, long size_limit, LSN initial_lsn, TOKULOGGER);
// Create a new cachetable. // Create a new cachetable.
// Effects: a new cachetable is created and initialized. // Effects: a new cachetable is created and initialized.
// The cachetable pointer is stored into result. // The cachetable pointer is stored into result.
...@@ -143,7 +147,7 @@ typedef int (*CACHETABLE_FETCH_CALLBACK)(CACHEFILE, int fd, CACHEKEY key, u_int3 ...@@ -143,7 +147,7 @@ typedef int (*CACHETABLE_FETCH_CALLBACK)(CACHEFILE, int fd, CACHEKEY key, u_int3
// to return an estimate of the number of bytes it will free // to return an estimate of the number of bytes it will free
// so that the cachetable can estimate how much data is being evicted on background threads. // so that the cachetable can estimate how much data is being evicted on background threads.
// If cost is PE_CHEAP, then the callback does not set bytes_freed_estimate. // If cost is PE_CHEAP, then the callback does not set bytes_freed_estimate.
typedef void (*CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK)(void *brtnode_pv, void* disk_data, long* bytes_freed_estimate, enum partial_eviction_cost *cost, void *write_extraargs); typedef void (*CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK)(void *ftnode_pv, void* disk_data, long* bytes_freed_estimate, enum partial_eviction_cost *cost, void *write_extraargs);
// The cachetable calls the partial eviction callback is to possibly try and partially evict pieces // The cachetable calls the partial eviction callback is to possibly try and partially evict pieces
// of the PAIR. The callback determines the strategy for what to evict. The callback may choose to free // of the PAIR. The callback determines the strategy for what to evict. The callback may choose to free
...@@ -151,7 +155,7 @@ typedef void (*CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK)(void *brtnode_pv, void* ...@@ -151,7 +155,7 @@ typedef void (*CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK)(void *brtnode_pv, void*
// old_attr is the PAIR_ATTR of the PAIR when the callback is called. // old_attr is the PAIR_ATTR of the PAIR when the callback is called.
// new_attr is set to the new PAIR_ATTR after the callback executes partial eviction // new_attr is set to the new PAIR_ATTR after the callback executes partial eviction
// Requires a write lock to be held on the PAIR in the cachetable while this function is called // Requires a write lock to be held on the PAIR in the cachetable while this function is called
typedef int (*CACHETABLE_PARTIAL_EVICTION_CALLBACK)(void *brtnode_pv, PAIR_ATTR old_attr, PAIR_ATTR* new_attr, void *write_extraargs); typedef int (*CACHETABLE_PARTIAL_EVICTION_CALLBACK)(void *ftnode_pv, PAIR_ATTR old_attr, PAIR_ATTR* new_attr, void *write_extraargs);
// The cachetable calls this function to determine if get_and_pin call requires a partial fetch. If this function returns TRUE, // The cachetable calls this function to determine if get_and_pin call requires a partial fetch. If this function returns TRUE,
// then the cachetable will subsequently call CACHETABLE_PARTIAL_FETCH_CALLBACK to perform // then the cachetable will subsequently call CACHETABLE_PARTIAL_FETCH_CALLBACK to perform
...@@ -161,7 +165,7 @@ typedef int (*CACHETABLE_PARTIAL_EVICTION_CALLBACK)(void *brtnode_pv, PAIR_ATTR ...@@ -161,7 +165,7 @@ typedef int (*CACHETABLE_PARTIAL_EVICTION_CALLBACK)(void *brtnode_pv, PAIR_ATTR
// CACHETABLE_PARTIAL_FETCH_CALLBACK decide whether to possibly release the ydb lock and perform I/O. // CACHETABLE_PARTIAL_FETCH_CALLBACK decide whether to possibly release the ydb lock and perform I/O.
// There is no particular reason why this alternative was not chosen. // There is no particular reason why this alternative was not chosen.
// Requires: a read lock to be held on the PAIR // Requires: a read lock to be held on the PAIR
typedef BOOL (*CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK)(void *brtnode_pv, void *read_extraargs); typedef BOOL (*CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK)(void *ftnode_pv, void *read_extraargs);
// The cachetable calls the partial fetch callback when a thread needs to read or decompress a subset of a PAIR into memory. // The cachetable calls the partial fetch callback when a thread needs to read or decompress a subset of a PAIR into memory.
// An example is needing to read a basement node into memory. Another example is decompressing an internal node's // An example is needing to read a basement node into memory. Another example is decompressing an internal node's
...@@ -172,7 +176,7 @@ typedef BOOL (*CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK)(void *brtnode_pv, voi ...@@ -172,7 +176,7 @@ typedef BOOL (*CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK)(void *brtnode_pv, voi
typedef int (*CACHETABLE_PARTIAL_FETCH_CALLBACK)(void *value_data, void* disk_data, void *read_extraargs, int fd, PAIR_ATTR *sizep); typedef int (*CACHETABLE_PARTIAL_FETCH_CALLBACK)(void *value_data, void* disk_data, void *read_extraargs, int fd, PAIR_ATTR *sizep);
// TODO(leif) XXX TODO XXX // TODO(leif) XXX TODO XXX
typedef int (*CACHETABLE_CLEANER_CALLBACK)(void *brtnode_pv, BLOCKNUM blocknum, u_int32_t fullhash, void *write_extraargs); typedef int (*CACHETABLE_CLEANER_CALLBACK)(void *ftnode_pv, BLOCKNUM blocknum, u_int32_t fullhash, void *write_extraargs);
typedef void (*CACHETABLE_CLONE_CALLBACK)(void* value_data, void** cloned_value_data, PAIR_ATTR* new_attr, BOOL for_checkpoint, void* write_extraargs); typedef void (*CACHETABLE_CLONE_CALLBACK)(void* value_data, void** cloned_value_data, PAIR_ATTR* new_attr, BOOL for_checkpoint, void* write_extraargs);
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
#include <toku_portability.h> #include <toku_portability.h>
#include <time.h> #include <time.h>
#include "brttypes.h" #include "fttypes.h"
#include "cachetable.h" #include "cachetable.h"
#include "log-internal.h" #include "log-internal.h"
#include "logger.h" #include "logger.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include "dbufio.h" #include "dbufio.h"
#include "brttypes.h" #include "fttypes.h"
#include <toku_assert.h> #include <toku_assert.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
......
...@@ -56,7 +56,7 @@ static int next_power_of_two (int n) { ...@@ -56,7 +56,7 @@ static int next_power_of_two (int n) {
return r; return r;
} }
int toku_fifo_enq(FIFO fifo, const void *key, unsigned int keylen, const void *data, unsigned int datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, long *dest) { int toku_fifo_enq(FIFO fifo, const void *key, unsigned int keylen, const void *data, unsigned int datalen, enum ft_msg_type type, MSN msn, XIDS xids, bool is_fresh, long *dest) {
int need_space_here = sizeof(struct fifo_entry) int need_space_here = sizeof(struct fifo_entry)
+ keylen + datalen + keylen + datalen
+ xids_get_size(xids) + xids_get_size(xids)
...@@ -109,7 +109,7 @@ struct fifo_entry * toku_fifo_iterate_internal_get_entry(FIFO fifo, int off) { ...@@ -109,7 +109,7 @@ struct fifo_entry * toku_fifo_iterate_internal_get_entry(FIFO fifo, int off) {
return (struct fifo_entry *)(fifo->memory + off); return (struct fifo_entry *)(fifo->memory + off);
} }
void toku_fifo_iterate (FIFO fifo, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,ITEMLEN datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, void*), void *arg) { void toku_fifo_iterate (FIFO fifo, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,ITEMLEN datalen, enum ft_msg_type type, MSN msn, XIDS xids, bool is_fresh, void*), void *arg) {
FIFO_ITERATE(fifo, FIFO_ITERATE(fifo,
key, keylen, data, datalen, type, msn, xids, is_fresh, key, keylen, data, datalen, type, msn, xids, is_fresh,
f(key,keylen,data,datalen,type,msn,xids,is_fresh, arg)); f(key,keylen,data,datalen,type,msn,xids,is_fresh, arg));
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include "brttypes.h" #include "fttypes.h"
#include "xids-internal.h" #include "xids-internal.h"
#include "xids.h" #include "xids.h"
...@@ -28,17 +28,17 @@ struct __attribute__((__packed__)) fifo_entry { ...@@ -28,17 +28,17 @@ struct __attribute__((__packed__)) fifo_entry {
// get and set the brt message type for a fifo entry. // get and set the brt message type for a fifo entry.
// it is internally stored as a single unsigned char. // it is internally stored as a single unsigned char.
static inline enum brt_msg_type static inline enum ft_msg_type
fifo_entry_get_msg_type(const struct fifo_entry * entry) fifo_entry_get_msg_type(const struct fifo_entry * entry)
{ {
enum brt_msg_type msg_type; enum ft_msg_type msg_type;
msg_type = (enum brt_msg_type) entry->type; msg_type = (enum ft_msg_type) entry->type;
return msg_type; return msg_type;
} }
static inline void static inline void
fifo_entry_set_msg_type(struct fifo_entry * entry, fifo_entry_set_msg_type(struct fifo_entry * entry,
enum brt_msg_type msg_type) enum ft_msg_type msg_type)
{ {
unsigned char type = (unsigned char) msg_type; unsigned char type = (unsigned char) msg_type;
entry->type = type; entry->type = type;
...@@ -56,7 +56,7 @@ void toku_fifo_free(FIFO *); ...@@ -56,7 +56,7 @@ void toku_fifo_free(FIFO *);
int toku_fifo_n_entries(FIFO); int toku_fifo_n_entries(FIFO);
int toku_fifo_enq (FIFO, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, long *dest); int toku_fifo_enq (FIFO, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, enum ft_msg_type type, MSN msn, XIDS xids, bool is_fresh, long *dest);
unsigned int toku_fifo_buffer_size_in_use (FIFO fifo); unsigned int toku_fifo_buffer_size_in_use (FIFO fifo);
unsigned long toku_fifo_memory_size_in_use(FIFO fifo); // return how much memory in the fifo holds useful data unsigned long toku_fifo_memory_size_in_use(FIFO fifo); // return how much memory in the fifo holds useful data
...@@ -65,8 +65,8 @@ unsigned long toku_fifo_memory_footprint(FIFO fifo); // return how much memory ...@@ -65,8 +65,8 @@ unsigned long toku_fifo_memory_footprint(FIFO fifo); // return how much memory
//These two are problematic, since I don't want to malloc() the bytevecs, but dequeueing the fifo frees the memory. //These two are problematic, since I don't want to malloc() the bytevecs, but dequeueing the fifo frees the memory.
//int toku_fifo_peek_deq (FIFO, bytevec *key, ITEMLEN *keylen, bytevec *data, ITEMLEN *datalen, u_int32_t *type, TXNID *xid); //int toku_fifo_peek_deq (FIFO, bytevec *key, ITEMLEN *keylen, bytevec *data, ITEMLEN *datalen, u_int32_t *type, TXNID *xid);
//int toku_fifo_peek_deq_cmdstruct (FIFO, BRT_MSG, DBT*, DBT*); // fill in the BRT_MSG, using the two DBTs for the DBT part. //int toku_fifo_peek_deq_cmdstruct (FIFO, FT_MSG, DBT*, DBT*); // fill in the FT_MSG, using the two DBTs for the DBT part.
void toku_fifo_iterate(FIFO, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,ITEMLEN datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, void*), void*); void toku_fifo_iterate(FIFO, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,ITEMLEN datalen, enum ft_msg_type type, MSN msn, XIDS xids, bool is_fresh, void*), void*);
#define FIFO_ITERATE(fifo,keyvar,keylenvar,datavar,datalenvar,typevar,msnvar,xidsvar,is_freshvar,body) ({ \ #define FIFO_ITERATE(fifo,keyvar,keylenvar,datavar,datalenvar,typevar,msnvar,xidsvar,is_freshvar,body) ({ \
for (int fifo_iterate_off = toku_fifo_iterate_internal_start(fifo); \ for (int fifo_iterate_off = toku_fifo_iterate_internal_start(fifo); \
...@@ -75,7 +75,7 @@ void toku_fifo_iterate(FIFO, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,IT ...@@ -75,7 +75,7 @@ void toku_fifo_iterate(FIFO, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,IT
struct fifo_entry *e = toku_fifo_iterate_internal_get_entry(fifo, fifo_iterate_off); \ struct fifo_entry *e = toku_fifo_iterate_internal_get_entry(fifo, fifo_iterate_off); \
ITEMLEN keylenvar = e->keylen; \ ITEMLEN keylenvar = e->keylen; \
ITEMLEN datalenvar = e->vallen; \ ITEMLEN datalenvar = e->vallen; \
enum brt_msg_type typevar = fifo_entry_get_msg_type(e); \ enum ft_msg_type typevar = fifo_entry_get_msg_type(e); \
MSN msnvar = e->msn; \ MSN msnvar = e->msn; \
XIDS xidsvar = &e->xids_s; \ XIDS xidsvar = &e->xids_s; \
bytevec keyvar = xids_get_end_of_array(xidsvar); \ bytevec keyvar = xids_get_end_of_array(xidsvar); \
......
...@@ -3,19 +3,19 @@ ...@@ -3,19 +3,19 @@
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <brt-cachetable-wrappers.h> #include <ft-cachetable-wrappers.h>
#include <brttypes.h> #include <fttypes.h>
#include <brt-flusher.h> #include <ft-flusher.h>
#include <brt-internal.h> #include <ft-internal.h>
static void static void
brtnode_get_key_and_fullhash( ftnode_get_key_and_fullhash(
BLOCKNUM* cachekey, BLOCKNUM* cachekey,
u_int32_t* fullhash, u_int32_t* fullhash,
void* extra) void* extra)
{ {
struct brt_header* h = extra; FT h = extra;
BLOCKNUM name; BLOCKNUM name;
toku_allocate_blocknum(h->blocktable, &name, h); toku_allocate_blocknum(h->blocktable, &name, h);
*cachekey = name; *cachekey = name;
...@@ -24,14 +24,14 @@ brtnode_get_key_and_fullhash( ...@@ -24,14 +24,14 @@ brtnode_get_key_and_fullhash(
void void
cachetable_put_empty_node_with_dep_nodes( cachetable_put_empty_node_with_dep_nodes(
struct brt_header* h, FT h,
u_int32_t num_dependent_nodes, u_int32_t num_dependent_nodes,
BRTNODE* dependent_nodes, FTNODE* dependent_nodes,
BLOCKNUM* name, //output BLOCKNUM* name, //output
u_int32_t* fullhash, //output u_int32_t* fullhash, //output
BRTNODE* result) FTNODE* result)
{ {
BRTNODE XMALLOC(new_node); FTNODE XMALLOC(new_node);
CACHEFILE dependent_cf[num_dependent_nodes]; CACHEFILE dependent_cf[num_dependent_nodes];
BLOCKNUM dependent_keys[num_dependent_nodes]; BLOCKNUM dependent_keys[num_dependent_nodes];
u_int32_t dependent_fullhash[num_dependent_nodes]; u_int32_t dependent_fullhash[num_dependent_nodes];
...@@ -45,9 +45,9 @@ cachetable_put_empty_node_with_dep_nodes( ...@@ -45,9 +45,9 @@ cachetable_put_empty_node_with_dep_nodes(
int r = toku_cachetable_put_with_dep_pairs( int r = toku_cachetable_put_with_dep_pairs(
h->cf, h->cf,
brtnode_get_key_and_fullhash, ftnode_get_key_and_fullhash,
new_node, new_node,
make_pair_attr(sizeof(BRTNODE)), make_pair_attr(sizeof(FTNODE)),
get_write_callbacks_for_node(h), get_write_callbacks_for_node(h),
h, h,
num_dependent_nodes, num_dependent_nodes,
...@@ -63,13 +63,13 @@ cachetable_put_empty_node_with_dep_nodes( ...@@ -63,13 +63,13 @@ cachetable_put_empty_node_with_dep_nodes(
} }
void void
create_new_brtnode_with_dep_nodes( create_new_ftnode_with_dep_nodes(
struct brt_header* h, FT h,
BRTNODE *result, FTNODE *result,
int height, int height,
int n_children, int n_children,
u_int32_t num_dependent_nodes, u_int32_t num_dependent_nodes,
BRTNODE* dependent_nodes) FTNODE* dependent_nodes)
{ {
u_int32_t fullhash = 0; u_int32_t fullhash = 0;
BLOCKNUM name; BLOCKNUM name;
...@@ -88,7 +88,7 @@ create_new_brtnode_with_dep_nodes( ...@@ -88,7 +88,7 @@ create_new_brtnode_with_dep_nodes(
assert(n_children > 0); assert(n_children > 0);
} }
toku_initialize_empty_brtnode( toku_initialize_empty_ftnode(
*result, *result,
name, name,
height, height,
...@@ -102,13 +102,13 @@ create_new_brtnode_with_dep_nodes( ...@@ -102,13 +102,13 @@ create_new_brtnode_with_dep_nodes(
} }
void void
toku_create_new_brtnode ( toku_create_new_ftnode (
BRT t, FT_HANDLE t,
BRTNODE *result, FTNODE *result,
int height, int height,
int n_children) int n_children)
{ {
return create_new_brtnode_with_dep_nodes( return create_new_ftnode_with_dep_nodes(
t->h, t->h,
result, result,
height, height,
...@@ -118,17 +118,17 @@ toku_create_new_brtnode ( ...@@ -118,17 +118,17 @@ toku_create_new_brtnode (
} }
int int
toku_pin_brtnode( toku_pin_ftnode(
BRT brt, FT_HANDLE brt,
BLOCKNUM blocknum, BLOCKNUM blocknum,
u_int32_t fullhash, u_int32_t fullhash,
UNLOCKERS unlockers, UNLOCKERS unlockers,
ANCESTORS ancestors, ANCESTORS ancestors,
const PIVOT_BOUNDS bounds, const PIVOT_BOUNDS bounds,
BRTNODE_FETCH_EXTRA bfe, FTNODE_FETCH_EXTRA bfe,
BOOL may_modify_node, BOOL may_modify_node,
BOOL apply_ancestor_messages, // this BOOL is probably temporary, for #3972, once we know how range query estimates work, will revisit this BOOL apply_ancestor_messages, // this BOOL is probably temporary, for #3972, once we know how range query estimates work, will revisit this
BRTNODE *node_p, FTNODE *node_p,
BOOL* msgs_applied) BOOL* msgs_applied)
{ {
void *node_v; void *node_v;
...@@ -140,14 +140,14 @@ toku_pin_brtnode( ...@@ -140,14 +140,14 @@ toku_pin_brtnode(
&node_v, &node_v,
NULL, NULL,
get_write_callbacks_for_node(brt->h), get_write_callbacks_for_node(brt->h),
toku_brtnode_fetch_callback, toku_ftnode_fetch_callback,
toku_brtnode_pf_req_callback, toku_ftnode_pf_req_callback,
toku_brtnode_pf_callback, toku_ftnode_pf_callback,
may_modify_node, may_modify_node,
bfe, //read_extraargs bfe, //read_extraargs
unlockers); unlockers);
if (r==0) { if (r==0) {
BRTNODE node = node_v; FTNODE node = node_v;
if (apply_ancestor_messages) { if (apply_ancestor_messages) {
maybe_apply_ancestors_messages_to_node(brt, node, ancestors, bounds, msgs_applied); maybe_apply_ancestors_messages_to_node(brt, node, ancestors, bounds, msgs_applied);
} }
...@@ -161,15 +161,15 @@ toku_pin_brtnode( ...@@ -161,15 +161,15 @@ toku_pin_brtnode(
} }
void void
toku_pin_brtnode_off_client_thread( toku_pin_ftnode_off_client_thread(
struct brt_header* h, FT h,
BLOCKNUM blocknum, BLOCKNUM blocknum,
u_int32_t fullhash, u_int32_t fullhash,
BRTNODE_FETCH_EXTRA bfe, FTNODE_FETCH_EXTRA bfe,
BOOL may_modify_node, BOOL may_modify_node,
u_int32_t num_dependent_nodes, u_int32_t num_dependent_nodes,
BRTNODE* dependent_nodes, FTNODE* dependent_nodes,
BRTNODE *node_p) FTNODE *node_p)
{ {
void *node_v; void *node_v;
CACHEFILE dependent_cf[num_dependent_nodes]; CACHEFILE dependent_cf[num_dependent_nodes];
...@@ -190,9 +190,9 @@ toku_pin_brtnode_off_client_thread( ...@@ -190,9 +190,9 @@ toku_pin_brtnode_off_client_thread(
&node_v, &node_v,
NULL, NULL,
get_write_callbacks_for_node(h), get_write_callbacks_for_node(h),
toku_brtnode_fetch_callback, toku_ftnode_fetch_callback,
toku_brtnode_pf_req_callback, toku_ftnode_pf_req_callback,
toku_brtnode_pf_callback, toku_ftnode_pf_callback,
may_modify_node, may_modify_node,
bfe, bfe,
num_dependent_nodes, num_dependent_nodes,
...@@ -202,33 +202,33 @@ toku_pin_brtnode_off_client_thread( ...@@ -202,33 +202,33 @@ toku_pin_brtnode_off_client_thread(
dependent_dirty_bits dependent_dirty_bits
); );
assert(r==0); assert(r==0);
BRTNODE node = node_v; FTNODE node = node_v;
*node_p = node; *node_p = node;
} }
void void
toku_unpin_brtnode_off_client_thread(struct brt_header* h, BRTNODE node) toku_unpin_ftnode_off_client_thread(FT h, FTNODE node)
{ {
int r = toku_cachetable_unpin( int r = toku_cachetable_unpin(
h->cf, h->cf,
node->thisnodename, node->thisnodename,
node->fullhash, node->fullhash,
(enum cachetable_dirty) node->dirty, (enum cachetable_dirty) node->dirty,
make_brtnode_pair_attr(node) make_ftnode_pair_attr(node)
); );
assert(r==0); assert(r==0);
} }
void void
toku_unpin_brtnode(struct brt_header *h, BRTNODE node) toku_unpin_ftnode(FT h, FTNODE node)
{ {
// printf("%*sUnpin %ld\n", 8-node->height, "", node->thisnodename.b); // printf("%*sUnpin %ld\n", 8-node->height, "", node->thisnodename.b);
//VERIFY_NODE(brt,node); //VERIFY_NODE(brt,node);
toku_unpin_brtnode_off_client_thread(h, node); toku_unpin_ftnode_off_client_thread(h, node);
} }
void void
toku_unpin_brtnode_read_only(BRT brt, BRTNODE node) toku_unpin_ftnode_read_only(FT_HANDLE brt, FTNODE node)
{ {
int r = toku_cachetable_unpin( int r = toku_cachetable_unpin(
brt->h->cf, brt->h->cf,
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ifndef BRT_CACHETABLE_WRAPPERS_H #ifndef FT_CACHETABLE_WRAPPERS_H
#define BRT_CACHETABLE_WRAPPERS_H #define FT_CACHETABLE_WRAPPERS_H
#ident "$Id$" #ident "$Id$"
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <brttypes.h> #include <fttypes.h>
#include "cachetable.h" #include "cachetable.h"
/** /**
...@@ -16,61 +16,61 @@ ...@@ -16,61 +16,61 @@
*/ */
void void
cachetable_put_empty_node_with_dep_nodes( cachetable_put_empty_node_with_dep_nodes(
struct brt_header* h, FT h,
u_int32_t num_dependent_nodes, u_int32_t num_dependent_nodes,
BRTNODE* dependent_nodes, FTNODE* dependent_nodes,
BLOCKNUM* name, //output BLOCKNUM* name, //output
u_int32_t* fullhash, //output u_int32_t* fullhash, //output
BRTNODE* result FTNODE* result
); );
/** /**
* Create a new brtnode with specified height and number of children. * Create a new ftnode with specified height and number of children.
* In the process, write dependent nodes out for checkpoint if * In the process, write dependent nodes out for checkpoint if
* necessary. * necessary.
*/ */
void void
create_new_brtnode_with_dep_nodes( create_new_ftnode_with_dep_nodes(
struct brt_header* h, FT h,
BRTNODE *result, FTNODE *result,
int height, int height,
int n_children, int n_children,
u_int32_t num_dependent_nodes, u_int32_t num_dependent_nodes,
BRTNODE* dependent_nodes FTNODE* dependent_nodes
); );
/** /**
* Create a new brtnode with specified height * Create a new ftnode with specified height
* and children. * and children.
* Used for test functions only. * Used for test functions only.
*/ */
void void
toku_create_new_brtnode ( toku_create_new_ftnode (
BRT t, FT_HANDLE t,
BRTNODE *result, FTNODE *result,
int height, int height,
int n_children int n_children
); );
/** /**
* toku_pin_brtnode either pins a brtnode, if the operation is fast (because * toku_pin_ftnode either pins a ftnode, if the operation is fast (because
* a partial fetch is not required and there is no contention for the node) * a partial fetch is not required and there is no contention for the node)
* or it returns TOKUDB_TRY_AGAIN after unlocking its ancestors (using * or it returns TOKUDB_TRY_AGAIN after unlocking its ancestors (using
* unlockers and ancestors) and bringing the necessary pieces of the node * unlockers and ancestors) and bringing the necessary pieces of the node
* into memory. * into memory.
*/ */
int int
toku_pin_brtnode( toku_pin_ftnode(
BRT brt, FT_HANDLE brt,
BLOCKNUM blocknum, BLOCKNUM blocknum,
u_int32_t fullhash, u_int32_t fullhash,
UNLOCKERS unlockers, UNLOCKERS unlockers,
ANCESTORS ancestors, ANCESTORS ancestors,
const PIVOT_BOUNDS pbounds, const PIVOT_BOUNDS pbounds,
BRTNODE_FETCH_EXTRA bfe, FTNODE_FETCH_EXTRA bfe,
BOOL may_modify_node, BOOL may_modify_node,
BOOL apply_ancestor_messages, // this BOOL is probably temporary, for #3972, once we know how range query estimates work, will revisit this BOOL apply_ancestor_messages, // this BOOL is probably temporary, for #3972, once we know how range query estimates work, will revisit this
BRTNODE *node_p, FTNODE *node_p,
BOOL* msgs_applied BOOL* msgs_applied
); );
...@@ -78,19 +78,19 @@ toku_pin_brtnode( ...@@ -78,19 +78,19 @@ toku_pin_brtnode(
* Unfortunately, this function is poorly named * Unfortunately, this function is poorly named
* as over time, client threads have also started * as over time, client threads have also started
* calling this function. * calling this function.
* This function returns a pinned brtnode to the caller. * This function returns a pinned ftnode to the caller.
* Unlike toku_pin_brtnode, this function blocks until the node is pinned. * Unlike toku_pin_ftnode, this function blocks until the node is pinned.
*/ */
void void
toku_pin_brtnode_off_client_thread( toku_pin_ftnode_off_client_thread(
struct brt_header* h, FT h,
BLOCKNUM blocknum, BLOCKNUM blocknum,
u_int32_t fullhash, u_int32_t fullhash,
BRTNODE_FETCH_EXTRA bfe, FTNODE_FETCH_EXTRA bfe,
BOOL may_modify_node, BOOL may_modify_node,
u_int32_t num_dependent_nodes, u_int32_t num_dependent_nodes,
BRTNODE* dependent_nodes, FTNODE* dependent_nodes,
BRTNODE *node_p FTNODE *node_p
); );
/** /**
...@@ -98,16 +98,16 @@ toku_pin_brtnode_off_client_thread( ...@@ -98,16 +98,16 @@ toku_pin_brtnode_off_client_thread(
* nodes that were pinned off client thread. * nodes that were pinned off client thread.
*/ */
void void
toku_unpin_brtnode_off_client_thread(struct brt_header* h, BRTNODE node); toku_unpin_ftnode_off_client_thread(FT h, FTNODE node);
/** /**
* Effect: Unpin a brt node. * Effect: Unpin a brt node.
* Used for nodes pinned on a client thread * Used for nodes pinned on a client thread
*/ */
void void
toku_unpin_brtnode(struct brt_header *h, BRTNODE node); toku_unpin_ftnode(FT h, FTNODE node);
void void
toku_unpin_brtnode_read_only(BRT brt, BRTNODE node); toku_unpin_ftnode_read_only(FT_HANDLE brt, FTNODE node);
#endif #endif
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ifndef BRT_FLUSHER_INTERNAL #ifndef FT_FLUSHER_INTERNAL_H
#define BRT_FLUSHER_INTERNAL #define FT_FLUSHER_INTERNAL_H
#ident "$Id$" #ident "$Id$"
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <brttypes.h> #include <fttypes.h>
#define ft_flush_before_applying_inbox 1 #define flt_flush_before_applying_inbox 1
#define ft_flush_before_child_pin 2 #define flt_flush_before_child_pin 2
#define ft_flush_after_child_pin 3 #define ft_flush_aflter_child_pin 3
#define ft_flush_before_split 4 #define flt_flush_before_split 4
#define ft_flush_during_split 5 #define flt_flush_during_split 5
#define ft_flush_before_merge 6 #define flt_flush_before_merge 6
#define ft_flush_after_merge 7 #define ft_flush_aflter_merge 7
#define ft_flush_after_rebalance 8 #define ft_flush_aflter_rebalance 8
#define ft_flush_before_unpin_remove 9 #define flt_flush_before_unpin_remove 9
#define ft_flush_before_pin_second_node_for_merge 10 #define flt_flush_before_pin_second_node_for_merge 10
typedef struct flusher_advice FLUSHER_ADVICE; typedef struct flusher_advice FLUSHER_ADVICE;
...@@ -29,7 +29,7 @@ typedef struct flusher_advice FLUSHER_ADVICE; ...@@ -29,7 +29,7 @@ typedef struct flusher_advice FLUSHER_ADVICE;
* Cleaner thread merging leaf nodes: follow down to a key * Cleaner thread merging leaf nodes: follow down to a key
* Hot optimize table: follow down to the right of a key * Hot optimize table: follow down to the right of a key
*/ */
typedef int (*FA_PICK_CHILD)(struct brt_header *h, BRTNODE parent, void* extra); typedef int (*FA_PICK_CHILD)(FT h, FTNODE parent, void* extra);
/** /**
* Decide whether to call `flush_some_child` on the child if it is * Decide whether to call `flush_some_child` on the child if it is
...@@ -40,7 +40,7 @@ typedef int (*FA_PICK_CHILD)(struct brt_header *h, BRTNODE parent, void* extra); ...@@ -40,7 +40,7 @@ typedef int (*FA_PICK_CHILD)(struct brt_header *h, BRTNODE parent, void* extra);
* Cleaner thread merging leaf nodes: always yes * Cleaner thread merging leaf nodes: always yes
* Hot optimize table: always yes * Hot optimize table: always yes
*/ */
typedef bool (*FA_SHOULD_RECURSIVELY_FLUSH)(BRTNODE child, void* extra); typedef bool (*FA_SHOULD_RECURSIVELY_FLUSH)(FTNODE child, void* extra);
/** /**
* Called if the child needs merging. Should do something to get the * Called if the child needs merging. Should do something to get the
...@@ -53,10 +53,10 @@ typedef bool (*FA_SHOULD_RECURSIVELY_FLUSH)(BRTNODE child, void* extra); ...@@ -53,10 +53,10 @@ typedef bool (*FA_SHOULD_RECURSIVELY_FLUSH)(BRTNODE child, void* extra);
* Hot optimize table: just do the merge * Hot optimize table: just do the merge
*/ */
typedef void (*FA_MAYBE_MERGE_CHILD)(struct flusher_advice *fa, typedef void (*FA_MAYBE_MERGE_CHILD)(struct flusher_advice *fa,
struct brt_header *h, FT h,
BRTNODE parent, FTNODE parent,
int childnum, int childnum,
BRTNODE child, FTNODE child,
void* extra); void* extra);
/** /**
...@@ -74,20 +74,20 @@ typedef void (*FA_MAYBE_MERGE_CHILD)(struct flusher_advice *fa, ...@@ -74,20 +74,20 @@ typedef void (*FA_MAYBE_MERGE_CHILD)(struct flusher_advice *fa,
typedef bool (*FA_SHOULD_DESTROY_BN)(void* extra); typedef bool (*FA_SHOULD_DESTROY_BN)(void* extra);
/** /**
* Update `brt_flusher_status` in whatever way necessary. Called once * Update `ft_flusher_status` in whatever way necessary. Called once
* by `flush_some_child` right before choosing what to do next (split, * by `flush_some_child` right before choosing what to do next (split,
* merge, recurse), with the number of nodes that were dirtied by this * merge, recurse), with the number of nodes that were dirtied by this
* execution of `flush_some_child`. * execution of `flush_some_child`.
*/ */
typedef void (*FA_UPDATE_STATUS)(BRTNODE child, int dirtied, void* extra); typedef void (*FA_UPDATE_STATUS)(FTNODE child, int dirtied, void* extra);
/** /**
* Choose whether to go to the left or right child after a split. Called * Choose whether to go to the left or right child after a split. Called
* by `brt_split_child`. If -1 is returned, `brt_split_child` defaults to * by `ft_split_child`. If -1 is returned, `ft_split_child` defaults to
* the old behavior. * the old behavior.
*/ */
typedef int (*FA_PICK_CHILD_AFTER_SPLIT)(struct brt_header* h, typedef int (*FA_PICK_CHILD_AFTER_SPLIT)(FT h,
BRTNODE node, FTNODE node,
int childnuma, int childnuma,
int childnumb, int childnumb,
void* extra); void* extra);
...@@ -95,7 +95,7 @@ typedef int (*FA_PICK_CHILD_AFTER_SPLIT)(struct brt_header* h, ...@@ -95,7 +95,7 @@ typedef int (*FA_PICK_CHILD_AFTER_SPLIT)(struct brt_header* h,
/** /**
* A collection of callbacks used by the flushing machinery to make * A collection of callbacks used by the flushing machinery to make
* various decisions. There are implementations of each of these * various decisions. There are implementations of each of these
* functions for flusher threads (ft_*), cleaner threads (ct_*), , and hot * functions for flusher threads (flt_*), cleaner threads (ct_*), , and hot
* optimize table (hot_*). * optimize table (hot_*).
*/ */
struct flusher_advice { struct flusher_advice {
...@@ -112,7 +112,7 @@ struct flusher_advice { ...@@ -112,7 +112,7 @@ struct flusher_advice {
// //
// how about: // how about:
// //
// toku_brtnode_flush_some_child() // toku_ftnode_flush_some_child()
// toku_fa_flusher_advice_init() // toku_fa_flusher_advice_init()
// toku_fa_always_recursively_flush() // toku_fa_always_recursively_flush()
// toku_fa_dont_destroy_basement_nodes() // toku_fa_dont_destroy_basement_nodes()
...@@ -133,27 +133,27 @@ flusher_advice_init( ...@@ -133,27 +133,27 @@ flusher_advice_init(
void void
flush_some_child( flush_some_child(
struct brt_header* h, FT h,
BRTNODE parent, FTNODE parent,
struct flusher_advice *fa); struct flusher_advice *fa);
bool bool
always_recursively_flush(BRTNODE child, void* extra); always_recursively_flush(FTNODE child, void* extra);
bool bool
dont_destroy_basement_nodes(void* extra); dont_destroy_basement_nodes(void* extra);
void void
default_merge_child(struct flusher_advice *fa, default_merge_child(struct flusher_advice *fa,
struct brt_header *h, FT h,
BRTNODE parent, FTNODE parent,
int childnum, int childnum,
BRTNODE child, FTNODE child,
void* extra); void* extra);
int int
default_pick_child_after_split(struct brt_header *h, default_pick_child_after_split(FT h,
BRTNODE parent, FTNODE parent,
int childnuma, int childnuma,
int childnumb, int childnumb,
void *extra); void *extra);
......
This diff is collapsed.
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#ifndef BRT_FLUSHER #ifndef FT_FLUSHER_H
#define BRT_FLUSHER #define FT_FLUSHER_H
#ident "$Id$" #ident "$Id$"
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
// This must be first to make the 64-bit file mode work right in Linux // This must be first to make the 64-bit file mode work right in Linux
#include "brttypes.h" #include "fttypes.h"
typedef enum { typedef enum {
BRT_FLUSHER_CLEANER_TOTAL_NODES = 0, // total number of nodes whose buffers are potentially flushed by cleaner thread FT_FLUSHER_CLEANER_TOTAL_NODES = 0, // total number of nodes whose buffers are potentially flushed by cleaner thread
BRT_FLUSHER_CLEANER_H1_NODES, // number of nodes of height one whose message buffers are flushed by cleaner thread FT_FLUSHER_CLEANER_H1_NODES, // number of nodes of height one whose message buffers are flushed by cleaner thread
BRT_FLUSHER_CLEANER_HGT1_NODES, // number of nodes of height > 1 whose message buffers are flushed by cleaner thread FT_FLUSHER_CLEANER_HGT1_NODES, // number of nodes of height > 1 whose message buffers are flushed by cleaner thread
BRT_FLUSHER_CLEANER_EMPTY_NODES, // number of nodes that are selected by cleaner, but whose buffers are empty FT_FLUSHER_CLEANER_EMPTY_NODES, // number of nodes that are selected by cleaner, but whose buffers are empty
BRT_FLUSHER_CLEANER_NODES_DIRTIED, // number of nodes that are made dirty by the cleaner thread FT_FLUSHER_CLEANER_NODES_DIRTIED, // number of nodes that are made dirty by the cleaner thread
BRT_FLUSHER_CLEANER_MAX_BUFFER_SIZE, // max number of bytes in message buffer flushed by cleaner thread FT_FLUSHER_CLEANER_MAX_BUFFER_SIZE, // max number of bytes in message buffer flushed by cleaner thread
BRT_FLUSHER_CLEANER_MIN_BUFFER_SIZE, FT_FLUSHER_CLEANER_MIN_BUFFER_SIZE,
BRT_FLUSHER_CLEANER_TOTAL_BUFFER_SIZE, FT_FLUSHER_CLEANER_TOTAL_BUFFER_SIZE,
BRT_FLUSHER_CLEANER_MAX_BUFFER_WORKDONE, // max workdone value of any message buffer flushed by cleaner thread FT_FLUSHER_CLEANER_MAX_BUFFER_WORKDONE, // max workdone value of any message buffer flushed by cleaner thread
BRT_FLUSHER_CLEANER_MIN_BUFFER_WORKDONE, FT_FLUSHER_CLEANER_MIN_BUFFER_WORKDONE,
BRT_FLUSHER_CLEANER_TOTAL_BUFFER_WORKDONE, FT_FLUSHER_CLEANER_TOTAL_BUFFER_WORKDONE,
BRT_FLUSHER_CLEANER_NUM_LEAF_MERGES_STARTED, // number of times cleaner thread tries to merge a leaf FT_FLUSHER_CLEANER_NUM_LEAF_MERGES_STARTED, // number of times cleaner thread tries to merge a leaf
BRT_FLUSHER_CLEANER_NUM_LEAF_MERGES_RUNNING, // number of cleaner thread leaf merges in progress FT_FLUSHER_CLEANER_NUM_LEAF_MERGES_RUNNING, // number of cleaner thread leaf merges in progress
BRT_FLUSHER_CLEANER_NUM_LEAF_MERGES_COMPLETED, // number of times cleaner thread successfully merges a leaf FT_FLUSHER_CLEANER_NUM_LEAF_MERGES_COMPLETED, // number of times cleaner thread successfully merges a leaf
BRT_FLUSHER_CLEANER_NUM_DIRTIED_FOR_LEAF_MERGE, // nodes dirtied by the "flush from root" process to merge a leaf node FT_FLUSHER_CLEANER_NUM_DIRTIED_FOR_LEAF_MERGE, // nodes dirtied by the "flush from root" process to merge a leaf node
BRT_FLUSHER_FLUSH_TOTAL, // total number of flushes done by flusher threads or cleaner threads FT_FLUSHER_FLUSH_TOTAL, // total number of flushes done by flusher threads or cleaner threads
BRT_FLUSHER_FLUSH_IN_MEMORY, // number of in memory flushes FT_FLUSHER_FLUSH_IN_MEMORY, // number of in memory flushes
BRT_FLUSHER_FLUSH_NEEDED_IO, // number of flushes that had to read a child (or part) off disk FT_FLUSHER_FLUSH_NEEDED_IO, // number of flushes that had to read a child (or part) off disk
BRT_FLUSHER_FLUSH_CASCADES, // number of flushes that triggered another flush in the child FT_FLUSHER_FLUSH_CASCADES, // number of flushes that triggered another flush in the child
BRT_FLUSHER_FLUSH_CASCADES_1, // number of flushes that triggered 1 cascading flush FT_FLUSHER_FLUSH_CASCADES_1, // number of flushes that triggered 1 cascading flush
BRT_FLUSHER_FLUSH_CASCADES_2, // number of flushes that triggered 2 cascading flushes FT_FLUSHER_FLUSH_CASCADES_2, // number of flushes that triggered 2 cascading flushes
BRT_FLUSHER_FLUSH_CASCADES_3, // number of flushes that triggered 3 cascading flushes FT_FLUSHER_FLUSH_CASCADES_3, // number of flushes that triggered 3 cascading flushes
BRT_FLUSHER_FLUSH_CASCADES_4, // number of flushes that triggered 4 cascading flushes FT_FLUSHER_FLUSH_CASCADES_4, // number of flushes that triggered 4 cascading flushes
BRT_FLUSHER_FLUSH_CASCADES_5, // number of flushes that triggered 5 cascading flushes FT_FLUSHER_FLUSH_CASCADES_5, // number of flushes that triggered 5 cascading flushes
BRT_FLUSHER_FLUSH_CASCADES_GT_5, // number of flushes that triggered more than 5 cascading flushes FT_FLUSHER_FLUSH_CASCADES_GT_5, // number of flushes that triggered more than 5 cascading flushes
BRT_FLUSHER_SPLIT_LEAF, // number of leaf nodes split FT_FLUSHER_SPLIT_LEAF, // number of leaf nodes split
BRT_FLUSHER_SPLIT_NONLEAF, // number of nonleaf nodes split FT_FLUSHER_SPLIT_NONLEAF, // number of nonleaf nodes split
BRT_FLUSHER_MERGE_LEAF, // number of times leaf nodes are merged FT_FLUSHER_MERGE_LEAF, // number of times leaf nodes are merged
BRT_FLUSHER_MERGE_NONLEAF, // number of times nonleaf nodes are merged FT_FLUSHER_MERGE_NONLEAF, // number of times nonleaf nodes are merged
BRT_FLUSHER_BALANCE_LEAF, // number of times a leaf node is balanced inside brt FT_FLUSHER_BALANCE_LEAF, // number of times a leaf node is balanced inside brt
BRT_FLUSHER_STATUS_NUM_ROWS FT_FLUSHER_STATUS_NUM_ROWS
} brt_flusher_status_entry; } ft_flusher_status_entry;
typedef struct { typedef struct {
bool initialized; bool initialized;
TOKU_ENGINE_STATUS_ROW_S status[BRT_FLUSHER_STATUS_NUM_ROWS]; TOKU_ENGINE_STATUS_ROW_S status[FT_FLUSHER_STATUS_NUM_ROWS];
} BRT_FLUSHER_STATUS_S, *BRT_FLUSHER_STATUS; } FT_FLUSHER_STATUS_S, *FT_FLUSHER_STATUS;
void toku_brt_flusher_status_init(void) __attribute__((__constructor__)); void toku_ft_flusher_status_init(void) __attribute__((__constructor__));
void toku_brt_flusher_get_status(BRT_FLUSHER_STATUS); void toku_ft_flusher_get_status(FT_FLUSHER_STATUS);
/** /**
* Only for testing, not for production. * Only for testing, not for production.
...@@ -68,8 +68,8 @@ toku_flusher_thread_set_callback( ...@@ -68,8 +68,8 @@ toku_flusher_thread_set_callback(
*/ */
void void
flush_node_on_background_thread( flush_node_on_background_thread(
struct brt_header *h, FT h,
BRTNODE parent FTNODE parent
); );
/** /**
...@@ -81,15 +81,15 @@ flush_node_on_background_thread( ...@@ -81,15 +81,15 @@ flush_node_on_background_thread(
* splitk is the right-most key of nodea * splitk is the right-most key of nodea
*/ */
void void
brtleaf_split( ftleaf_split(
struct brt_header* h, FT h,
BRTNODE node, FTNODE node,
BRTNODE *nodea, FTNODE *nodea,
BRTNODE *nodeb, FTNODE *nodeb,
DBT *splitk, DBT *splitk,
BOOL create_new_node, BOOL create_new_node,
u_int32_t num_dependent_nodes, u_int32_t num_dependent_nodes,
BRTNODE* dependent_nodes FTNODE* dependent_nodes
); );
/** /**
...@@ -102,14 +102,14 @@ brtleaf_split( ...@@ -102,14 +102,14 @@ brtleaf_split(
* but it does not guarantee that the resulting nodes are smaller than nodesize. * but it does not guarantee that the resulting nodes are smaller than nodesize.
*/ */
void void
brt_nonleaf_split( ft_nonleaf_split(
struct brt_header* h, FT h,
BRTNODE node, FTNODE node,
BRTNODE *nodea, FTNODE *nodea,
BRTNODE *nodeb, FTNODE *nodeb,
DBT *splitk, DBT *splitk,
u_int32_t num_dependent_nodes, u_int32_t num_dependent_nodes,
BRTNODE* dependent_nodes FTNODE* dependent_nodes
); );
...@@ -120,26 +120,26 @@ brt_nonleaf_split( ...@@ -120,26 +120,26 @@ brt_nonleaf_split(
*/ */
typedef enum { typedef enum {
BRT_HOT_NUM_STARTED = 0, // number of HOT operations that have begun FT_HOT_NUM_STARTED = 0, // number of HOT operations that have begun
BRT_HOT_NUM_COMPLETED, // number of HOT operations that have successfully completed FT_HOT_NUM_COMPLETED, // number of HOT operations that have successfully completed
BRT_HOT_NUM_ABORTED, // number of HOT operations that have been aborted FT_HOT_NUM_ABORTED, // number of HOT operations that have been aborted
BRT_HOT_MAX_ROOT_FLUSH_COUNT, // max number of flushes from root ever required to optimize a tree FT_HOT_MAX_ROOT_FLUSH_COUNT, // max number of flushes from root ever required to optimize a tree
BRT_HOT_STATUS_NUM_ROWS FT_HOT_STATUS_NUM_ROWS
} brt_hot_status_entry; } ft_hot_status_entry;
typedef struct { typedef struct {
bool initialized; bool initialized;
TOKU_ENGINE_STATUS_ROW_S status[BRT_HOT_STATUS_NUM_ROWS]; TOKU_ENGINE_STATUS_ROW_S status[FT_HOT_STATUS_NUM_ROWS];
} BRT_HOT_STATUS_S, *BRT_HOT_STATUS; } FT_HOT_STATUS_S, *FT_HOT_STATUS;
void toku_brt_hot_status_init(void) __attribute__((__constructor__)); void toku_ft_hot_status_init(void) __attribute__((__constructor__));
void toku_brt_hot_get_status(BRT_HOT_STATUS); void toku_ft_hot_get_status(FT_HOT_STATUS);
/** /**
* Takes given BRT and pushes all pending messages to the leaf nodes. * Takes given FT and pushes all pending messages to the leaf nodes.
*/ */
int int
toku_brt_hot_optimize(BRT brt, toku_ft_hot_optimize(FT_HANDLE brt,
int (*progress_callback)(void *extra, float progress), int (*progress_callback)(void *extra, float progress),
void *progress_extra); void *progress_extra);
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <brt-flusher.h> #include <ft-flusher.h>
#include <brt-flusher-internal.h> #include <ft-flusher-internal.h>
#include <brt-cachetable-wrappers.h> #include <ft-cachetable-wrappers.h>
#include <brt-internal.h> #include <ft-internal.h>
#include <brt_header.h> #include <ft.h>
// Member Descirption: // Member Descirption:
// 1. highest_pivot_key - this is the key that corresponds to the // 1. highest_pivot_key - this is the key that corresponds to the
...@@ -28,7 +28,7 @@ struct hot_flusher_extra { ...@@ -28,7 +28,7 @@ struct hot_flusher_extra {
bool rightmost_leaf_seen; bool rightmost_leaf_seen;
}; };
static volatile BRT_HOT_STATUS_S hot_status; static volatile FT_HOT_STATUS_S hot_status;
#define STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l) { \
hot_status.status[k].keyname = #k; \ hot_status.status[k].keyname = #k; \
...@@ -39,21 +39,21 @@ static volatile BRT_HOT_STATUS_S hot_status; ...@@ -39,21 +39,21 @@ static volatile BRT_HOT_STATUS_S hot_status;
#define STATUS_VALUE(x) hot_status.status[x].value.num #define STATUS_VALUE(x) hot_status.status[x].value.num
void void
toku_brt_hot_status_init(void) toku_ft_hot_status_init(void)
{ {
STATUS_INIT(BRT_HOT_NUM_STARTED, UINT64, "operations ever started"); STATUS_INIT(FT_HOT_NUM_STARTED, UINT64, "operations ever started");
STATUS_INIT(BRT_HOT_NUM_COMPLETED, UINT64, "operations successfully completed"); STATUS_INIT(FT_HOT_NUM_COMPLETED, UINT64, "operations successfully completed");
STATUS_INIT(BRT_HOT_NUM_ABORTED, UINT64, "operations aborted"); STATUS_INIT(FT_HOT_NUM_ABORTED, UINT64, "operations aborted");
STATUS_INIT(BRT_HOT_MAX_ROOT_FLUSH_COUNT, UINT64, "max number of flushes from root ever required to optimize a tree"); STATUS_INIT(FT_HOT_MAX_ROOT_FLUSH_COUNT, UINT64, "max number of flushes from root ever required to optimize a tree");
hot_status.initialized = true; hot_status.initialized = true;
} }
#undef STATUS_INIT #undef STATUS_INIT
void void
toku_brt_hot_get_status(BRT_HOT_STATUS s) { toku_ft_hot_get_status(FT_HOT_STATUS s) {
if (!hot_status.initialized) { if (!hot_status.initialized) {
toku_brt_hot_status_init(); toku_ft_hot_status_init();
} }
*s = hot_status; *s = hot_status;
} }
...@@ -88,7 +88,7 @@ hot_set_highest_key(struct hot_flusher_extra *flusher) ...@@ -88,7 +88,7 @@ hot_set_highest_key(struct hot_flusher_extra *flusher)
// Copies the pivot key in the parent to the given DBT key, using the // Copies the pivot key in the parent to the given DBT key, using the
// pivot corresponding to the given child. // pivot corresponding to the given child.
static void static void
hot_set_key(DBT *key, BRTNODE parent, int childnum) hot_set_key(DBT *key, FTNODE parent, int childnum)
{ {
// assert that childnum is less than number of children - 1. // assert that childnum is less than number of children - 1.
DBT *pivot = &parent->childkeys[childnum]; DBT *pivot = &parent->childkeys[childnum];
...@@ -103,8 +103,8 @@ hot_set_key(DBT *key, BRTNODE parent, int childnum) ...@@ -103,8 +103,8 @@ hot_set_key(DBT *key, BRTNODE parent, int childnum)
} }
static int static int
hot_just_pick_child(struct brt_header *h, hot_just_pick_child(FT h,
BRTNODE parent, FTNODE parent,
struct hot_flusher_extra *flusher) struct hot_flusher_extra *flusher)
{ {
int childnum = 0; int childnum = 0;
...@@ -118,7 +118,7 @@ hot_just_pick_child(struct brt_header *h, ...@@ -118,7 +118,7 @@ hot_just_pick_child(struct brt_header *h,
childnum = 0; childnum = 0;
} else { } else {
// Find the pivot boundary. // Find the pivot boundary.
childnum = toku_brtnode_hot_next_child(parent, childnum = toku_ftnode_hot_next_child(parent,
&flusher->highest_pivot_key, &flusher->highest_pivot_key,
&h->cmp_descriptor, &h->cmp_descriptor,
h->compare_fun); h->compare_fun);
...@@ -128,7 +128,7 @@ hot_just_pick_child(struct brt_header *h, ...@@ -128,7 +128,7 @@ hot_just_pick_child(struct brt_header *h,
} }
static void static void
hot_update_flusher_keys(BRTNODE parent, hot_update_flusher_keys(FTNODE parent,
int childnum, int childnum,
struct hot_flusher_extra *flusher) struct hot_flusher_extra *flusher)
{ {
...@@ -142,8 +142,8 @@ hot_update_flusher_keys(BRTNODE parent, ...@@ -142,8 +142,8 @@ hot_update_flusher_keys(BRTNODE parent,
// Picks which child flush_some_child will use for flushing and // Picks which child flush_some_child will use for flushing and
// recursion. // recursion.
static int static int
hot_pick_child(struct brt_header *h, hot_pick_child(FT h,
BRTNODE parent, FTNODE parent,
void *extra) void *extra)
{ {
struct hot_flusher_extra *flusher = extra; struct hot_flusher_extra *flusher = extra;
...@@ -166,7 +166,7 @@ hot_pick_child(struct brt_header *h, ...@@ -166,7 +166,7 @@ hot_pick_child(struct brt_header *h,
// Does nothing for now. // Does nothing for now.
static void static void
hot_update_status(BRTNODE UU(child), hot_update_status(FTNODE UU(child),
int UU(dirtied), int UU(dirtied),
void *UU(extra)) void *UU(extra))
{ {
...@@ -177,8 +177,8 @@ hot_update_status(BRTNODE UU(child), ...@@ -177,8 +177,8 @@ hot_update_status(BRTNODE UU(child),
// one to flush into. This gives it a chance to do that, and update the // one to flush into. This gives it a chance to do that, and update the
// keys it maintains. // keys it maintains.
static int static int
hot_pick_child_after_split(struct brt_header *h, hot_pick_child_after_split(FT h,
BRTNODE parent, FTNODE parent,
int childnuma, int childnuma,
int childnumb, int childnumb,
void *extra) void *extra)
...@@ -189,8 +189,8 @@ hot_pick_child_after_split(struct brt_header *h, ...@@ -189,8 +189,8 @@ hot_pick_child_after_split(struct brt_header *h,
hot_update_flusher_keys(parent, childnum, flusher); hot_update_flusher_keys(parent, childnum, flusher);
if (parent->height == 1) { if (parent->height == 1) {
// We don't want to recurse into a leaf node, but if we return // We don't want to recurse into a leaf node, but if we return
// anything valid, brt_split_child will try to go there, so we // anything valid, ft_split_child will try to go there, so we
// return -1 to allow brt_split_child to have its default // return -1 to allow ft_split_child to have its default
// behavior, which will be to stop recursing. // behavior, which will be to stop recursing.
childnum = -1; childnum = -1;
} }
...@@ -237,7 +237,7 @@ hot_flusher_destroy(struct hot_flusher_extra *flusher) ...@@ -237,7 +237,7 @@ hot_flusher_destroy(struct hot_flusher_extra *flusher)
// Entry point for Hot Optimize Table (HOT). Note, this function is // Entry point for Hot Optimize Table (HOT). Note, this function is
// not recursive. It iterates over root-to-leaf paths. // not recursive. It iterates over root-to-leaf paths.
int int
toku_brt_hot_optimize(BRT brt, toku_ft_hot_optimize(FT_HANDLE brt,
int (*progress_callback)(void *extra, float progress), int (*progress_callback)(void *extra, float progress),
void *progress_extra) void *progress_extra)
{ {
...@@ -250,29 +250,29 @@ toku_brt_hot_optimize(BRT brt, ...@@ -250,29 +250,29 @@ toku_brt_hot_optimize(BRT brt,
uint64_t loop_count = 0; uint64_t loop_count = 0;
MSN msn_at_start_of_hot = ZERO_MSN; // capture msn from root at MSN msn_at_start_of_hot = ZERO_MSN; // capture msn from root at
// start of HOT operation // start of HOT operation
(void) __sync_fetch_and_add(&STATUS_VALUE(BRT_HOT_NUM_STARTED), 1); (void) __sync_fetch_and_add(&STATUS_VALUE(FT_HOT_NUM_STARTED), 1);
{ {
toku_brt_header_note_hot_begin(brt); toku_ft_note_hot_begin(brt);
} }
// Higher level logic prevents a dictionary from being deleted or // Higher level logic prevents a dictionary from being deleted or
// truncated during a hot optimize operation. Doing so would violate // truncated during a hot optimize operation. Doing so would violate
// the hot optimize contract. // the hot optimize contract.
do { do {
BRTNODE root; FTNODE root;
CACHEKEY root_key; CACHEKEY root_key;
u_int32_t fullhash; u_int32_t fullhash;
{ {
toku_brtheader_grab_treelock(brt->h); toku_ft_grab_treelock(brt->h);
// Get root node (the first parent of each successive HOT // Get root node (the first parent of each successive HOT
// call.) // call.)
toku_calculate_root_offset_pointer(brt->h, &root_key, &fullhash); toku_calculate_root_offset_pointer(brt->h, &root_key, &fullhash);
struct brtnode_fetch_extra bfe; struct ftnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, brt->h); fill_bfe_for_full_read(&bfe, brt->h);
toku_pin_brtnode_off_client_thread(brt->h, toku_pin_ftnode_off_client_thread(brt->h,
(BLOCKNUM) root_key, (BLOCKNUM) root_key,
fullhash, fullhash,
&bfe, &bfe,
...@@ -282,7 +282,7 @@ toku_brt_hot_optimize(BRT brt, ...@@ -282,7 +282,7 @@ toku_brt_hot_optimize(BRT brt,
&root); &root);
toku_assert_entire_node_in_memory(root); toku_assert_entire_node_in_memory(root);
toku_brtheader_release_treelock(brt->h); toku_ft_release_treelock(brt->h);
} }
// Prepare HOT diagnostics. // Prepare HOT diagnostics.
...@@ -293,8 +293,8 @@ toku_brt_hot_optimize(BRT brt, ...@@ -293,8 +293,8 @@ toku_brt_hot_optimize(BRT brt,
loop_count++; loop_count++;
if (loop_count > STATUS_VALUE(BRT_HOT_MAX_ROOT_FLUSH_COUNT)) { if (loop_count > STATUS_VALUE(FT_HOT_MAX_ROOT_FLUSH_COUNT)) {
STATUS_VALUE(BRT_HOT_MAX_ROOT_FLUSH_COUNT) = loop_count; STATUS_VALUE(FT_HOT_MAX_ROOT_FLUSH_COUNT) = loop_count;
} }
// Initialize the maximum current key. We need to do this for // Initialize the maximum current key. We need to do this for
...@@ -315,7 +315,7 @@ toku_brt_hot_optimize(BRT brt, ...@@ -315,7 +315,7 @@ toku_brt_hot_optimize(BRT brt,
// Since there are no children to flush, we should abort // Since there are no children to flush, we should abort
// the HOT call. // the HOT call.
flusher.rightmost_leaf_seen = 1; flusher.rightmost_leaf_seen = 1;
toku_unpin_brtnode_off_client_thread(brt->h, root); toku_unpin_ftnode_off_client_thread(brt->h, root);
} }
// Set the highest pivot key seen here, since the parent may // Set the highest pivot key seen here, since the parent may
...@@ -352,13 +352,13 @@ toku_brt_hot_optimize(BRT brt, ...@@ -352,13 +352,13 @@ toku_brt_hot_optimize(BRT brt,
if (r == 0) { success = true; } if (r == 0) { success = true; }
{ {
toku_brt_header_note_hot_complete(brt, success, msn_at_start_of_hot); toku_ft_note_hot_complete(brt, success, msn_at_start_of_hot);
} }
if (success) { if (success) {
(void) __sync_fetch_and_add(&STATUS_VALUE(BRT_HOT_NUM_COMPLETED), 1); (void) __sync_fetch_and_add(&STATUS_VALUE(FT_HOT_NUM_COMPLETED), 1);
} else { } else {
(void) __sync_fetch_and_add(&STATUS_VALUE(BRT_HOT_NUM_ABORTED), 1); (void) __sync_fetch_and_add(&STATUS_VALUE(FT_HOT_NUM_ABORTED), 1);
} }
} }
return r; return r;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -2,32 +2,32 @@ ...@@ -2,32 +2,32 @@
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#ifndef BRT_SEARCH_H #ifndef FT_SEARCH_H
#define BRT_SEARCH_H #define FT_SEARCH_H
#if defined(__cplusplus) || defined(__cilkplusplus) #if defined(__cplusplus) || defined(__cilkplusplus)
extern "C" { extern "C" {
#endif #endif
enum brt_search_direction_e { enum ft_search_direction_e {
BRT_SEARCH_LEFT = 1, /* search left -> right, finds min xy as defined by the compare function */ FT_SEARCH_LEFT = 1, /* search left -> right, finds min xy as defined by the compare function */
BRT_SEARCH_RIGHT = 2, /* search right -> left, finds max xy as defined by the compare function */ FT_SEARCH_RIGHT = 2, /* search right -> left, finds max xy as defined by the compare function */
}; };
struct brt_search; struct ft_search;
/* the search compare function should return 0 for all xy < kv and 1 for all xy >= kv /* the search compare function should return 0 for all xy < kv and 1 for all xy >= kv
the compare function should be a step function from 0 to 1 for a left to right search the compare function should be a step function from 0 to 1 for a left to right search
and 1 to 0 for a right to left search */ and 1 to 0 for a right to left search */
typedef int (*brt_search_compare_func_t)(struct brt_search */*so*/, DBT *); typedef int (*ft_search_compare_func_t)(struct ft_search */*so*/, DBT *);
/* the search object contains the compare function, search direction, and the kv pair that /* the search object contains the compare function, search direction, and the kv pair that
is used in the compare function. the context is the user's private data */ is used in the compare function. the context is the user's private data */
typedef struct brt_search { typedef struct ft_search {
brt_search_compare_func_t compare; ft_search_compare_func_t compare;
enum brt_search_direction_e direction; enum ft_search_direction_e direction;
const DBT *k; const DBT *k;
void *context; void *context;
...@@ -53,10 +53,10 @@ typedef struct brt_search { ...@@ -53,10 +53,10 @@ typedef struct brt_search {
// way out with a DB_NOTFOUND we ought to unpin those nodes. See #3528. // way out with a DB_NOTFOUND we ought to unpin those nodes. See #3528.
BOOL have_pivot_bound; BOOL have_pivot_bound;
DBT pivot_bound; DBT pivot_bound;
} brt_search_t; } ft_search_t;
/* initialize the search compare object */ /* initialize the search compare object */
static inline brt_search_t *brt_search_init(brt_search_t *so, brt_search_compare_func_t compare, enum brt_search_direction_e direction, const DBT *k, void *context) { static inline ft_search_t *ft_search_init(ft_search_t *so, ft_search_compare_func_t compare, enum ft_search_direction_e direction, const DBT *k, void *context) {
so->compare = compare; so->compare = compare;
so->direction = direction; so->direction = direction;
so->k = k; so->k = k;
...@@ -65,7 +65,7 @@ static inline brt_search_t *brt_search_init(brt_search_t *so, brt_search_compare ...@@ -65,7 +65,7 @@ static inline brt_search_t *brt_search_init(brt_search_t *so, brt_search_compare
return so; return so;
} }
static inline void brt_search_finish(brt_search_t *so) { static inline void ft_search_finish(ft_search_t *so) {
if (so->have_pivot_bound) toku_free(so->pivot_bound.data); if (so->have_pivot_bound) toku_free(so->pivot_bound.data);
} }
......
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
#include "includes.h" #include "includes.h"
#include "ule.h" #include "ule.h"
#include <brt-cachetable-wrappers.h> #include <ft-cachetable-wrappers.h>
#include <brt-flusher.h> #include <ft-flusher.h>
// dummymsn needed to simulate msn because messages are injected at a lower level than toku_brt_root_put_cmd() // dummymsn needed to simulate msn because messages are injected at a lower level than toku_ft_root_put_cmd()
#define MIN_DUMMYMSN ((MSN) {(uint64_t)1 << 62}) #define MIN_DUMMYMSN ((MSN) {(uint64_t)1 << 62})
static MSN dummymsn; static MSN dummymsn;
static int testsetup_initialized = 0; static int testsetup_initialized = 0;
...@@ -32,10 +32,10 @@ next_dummymsn(void) { ...@@ -32,10 +32,10 @@ next_dummymsn(void) {
BOOL ignore_if_was_already_open; BOOL ignore_if_was_already_open;
int toku_testsetup_leaf(BRT brt, BLOCKNUM *blocknum, int n_children, char **keys, int *keylens) { int toku_testsetup_leaf(FT_HANDLE brt, BLOCKNUM *blocknum, int n_children, char **keys, int *keylens) {
BRTNODE node; FTNODE node;
assert(testsetup_initialized); assert(testsetup_initialized);
toku_create_new_brtnode(brt, &node, 0, n_children); toku_create_new_ftnode(brt, &node, 0, n_children);
int i; int i;
for (i=0; i<n_children; i++) { for (i=0; i<n_children; i++) {
BP_STATE(node,i) = PT_AVAIL; BP_STATE(node,i) = PT_AVAIL;
...@@ -47,16 +47,16 @@ int toku_testsetup_leaf(BRT brt, BLOCKNUM *blocknum, int n_children, char **keys ...@@ -47,16 +47,16 @@ int toku_testsetup_leaf(BRT brt, BLOCKNUM *blocknum, int n_children, char **keys
} }
*blocknum = node->thisnodename; *blocknum = node->thisnodename;
toku_unpin_brtnode(brt->h, node); toku_unpin_ftnode(brt->h, node);
return 0; return 0;
} }
// Don't bother to clean up carefully if something goes wrong. (E.g., it's OK to have malloced stuff that hasn't been freed.) // Don't bother to clean up carefully if something goes wrong. (E.g., it's OK to have malloced stuff that hasn't been freed.)
int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_children, BLOCKNUM *children, char **keys, int *keylens) { int toku_testsetup_nonleaf (FT_HANDLE brt, int height, BLOCKNUM *blocknum, int n_children, BLOCKNUM *children, char **keys, int *keylens) {
BRTNODE node; FTNODE node;
assert(testsetup_initialized); assert(testsetup_initialized);
assert(n_children<=BRT_FANOUT); assert(n_children<=FT_FANOUT);
toku_create_new_brtnode(brt, &node, height, n_children); toku_create_new_ftnode(brt, &node, height, n_children);
int i; int i;
for (i=0; i<n_children; i++) { for (i=0; i<n_children; i++) {
BP_BLOCKNUM(node, i) = children[i]; BP_BLOCKNUM(node, i) = children[i];
...@@ -67,21 +67,21 @@ int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_child ...@@ -67,21 +67,21 @@ int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_child
node->totalchildkeylens += keylens[i]; node->totalchildkeylens += keylens[i];
} }
*blocknum = node->thisnodename; *blocknum = node->thisnodename;
toku_unpin_brtnode(brt->h, node); toku_unpin_ftnode(brt->h, node);
return 0; return 0;
} }
int toku_testsetup_root(BRT brt, BLOCKNUM blocknum) { int toku_testsetup_root(FT_HANDLE brt, BLOCKNUM blocknum) {
assert(testsetup_initialized); assert(testsetup_initialized);
brt->h->root_blocknum = blocknum; brt->h->root_blocknum = blocknum;
return 0; return 0;
} }
int toku_testsetup_get_sersize(BRT brt, BLOCKNUM diskoff) // Return the size on disk int toku_testsetup_get_sersize(FT_HANDLE brt, BLOCKNUM diskoff) // Return the size on disk
{ {
assert(testsetup_initialized); assert(testsetup_initialized);
void *node_v; void *node_v;
struct brtnode_fetch_extra bfe; struct ftnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, brt->h); fill_bfe_for_full_read(&bfe, brt->h);
int r = toku_cachetable_get_and_pin( int r = toku_cachetable_get_and_pin(
brt->h->cf, diskoff, brt->h->cf, diskoff,
...@@ -89,25 +89,25 @@ int toku_testsetup_get_sersize(BRT brt, BLOCKNUM diskoff) // Return the size on ...@@ -89,25 +89,25 @@ int toku_testsetup_get_sersize(BRT brt, BLOCKNUM diskoff) // Return the size on
&node_v, &node_v,
NULL, NULL,
get_write_callbacks_for_node(brt->h), get_write_callbacks_for_node(brt->h),
toku_brtnode_fetch_callback, toku_ftnode_fetch_callback,
toku_brtnode_pf_req_callback, toku_ftnode_pf_req_callback,
toku_brtnode_pf_callback, toku_ftnode_pf_callback,
TRUE, TRUE,
&bfe &bfe
); );
assert(r==0); assert(r==0);
int size = toku_serialize_brtnode_size(node_v); int size = toku_serialize_ftnode_size(node_v);
toku_unpin_brtnode(brt->h, node_v); toku_unpin_ftnode(brt->h, node_v);
return size; return size;
} }
int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int keylen, char *val, int vallen) { int toku_testsetup_insert_to_leaf (FT_HANDLE brt, BLOCKNUM blocknum, char *key, int keylen, char *val, int vallen) {
void *node_v; void *node_v;
int r; int r;
assert(testsetup_initialized); assert(testsetup_initialized);
struct brtnode_fetch_extra bfe; struct ftnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, brt->h); fill_bfe_for_full_read(&bfe, brt->h);
r = toku_cachetable_get_and_pin( r = toku_cachetable_get_and_pin(
brt->h->cf, brt->h->cf,
...@@ -116,24 +116,24 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke ...@@ -116,24 +116,24 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke
&node_v, &node_v,
NULL, NULL,
get_write_callbacks_for_node(brt->h), get_write_callbacks_for_node(brt->h),
toku_brtnode_fetch_callback, toku_ftnode_fetch_callback,
toku_brtnode_pf_req_callback, toku_ftnode_pf_req_callback,
toku_brtnode_pf_callback, toku_ftnode_pf_callback,
TRUE, TRUE,
&bfe &bfe
); );
if (r!=0) return r; if (r!=0) return r;
BRTNODE node=node_v; FTNODE node=node_v;
toku_verify_or_set_counts(node); toku_verify_or_set_counts(node);
assert(node->height==0); assert(node->height==0);
DBT keydbt,valdbt; DBT keydbt,valdbt;
MSN msn = next_dummymsn(); MSN msn = next_dummymsn();
BRT_MSG_S cmd = {BRT_INSERT, msn, xids_get_root_xids(), FT_MSG_S cmd = {FT_INSERT, msn, xids_get_root_xids(),
.u.id={toku_fill_dbt(&keydbt, key, keylen), .u.id={toku_fill_dbt(&keydbt, key, keylen),
toku_fill_dbt(&valdbt, val, vallen)}}; toku_fill_dbt(&valdbt, val, vallen)}};
toku_brt_node_put_cmd ( toku_ft_node_put_cmd (
brt->h->compare_fun, brt->h->compare_fun,
brt->h->update_fun, brt->h->update_fun,
&brt->h->cmp_descriptor, &brt->h->cmp_descriptor,
...@@ -145,7 +145,7 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke ...@@ -145,7 +145,7 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke
toku_verify_or_set_counts(node); toku_verify_or_set_counts(node);
toku_unpin_brtnode(brt->h, node_v); toku_unpin_ftnode(brt->h, node_v);
return 0; return 0;
} }
...@@ -158,11 +158,11 @@ testhelper_string_key_cmp(DB *UU(e), const DBT *a, const DBT *b) ...@@ -158,11 +158,11 @@ testhelper_string_key_cmp(DB *UU(e), const DBT *a, const DBT *b)
void void
toku_pin_node_with_min_bfe(BRTNODE* node, BLOCKNUM b, BRT t) toku_pin_node_with_min_bfe(FTNODE* node, BLOCKNUM b, FT_HANDLE t)
{ {
struct brtnode_fetch_extra bfe; struct ftnode_fetch_extra bfe;
fill_bfe_for_min_read(&bfe, t->h); fill_bfe_for_min_read(&bfe, t->h);
toku_pin_brtnode_off_client_thread( toku_pin_ftnode_off_client_thread(
t->h, t->h,
b, b,
toku_cachetable_hash(t->h->cf, b), toku_cachetable_hash(t->h->cf, b),
...@@ -174,13 +174,13 @@ toku_pin_node_with_min_bfe(BRTNODE* node, BLOCKNUM b, BRT t) ...@@ -174,13 +174,13 @@ toku_pin_node_with_min_bfe(BRTNODE* node, BLOCKNUM b, BRT t)
); );
} }
int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM blocknum, enum brt_msg_type cmdtype, char *key, int keylen, char *val, int vallen) { int toku_testsetup_insert_to_nonleaf (FT_HANDLE brt, BLOCKNUM blocknum, enum ft_msg_type cmdtype, char *key, int keylen, char *val, int vallen) {
void *node_v; void *node_v;
int r; int r;
assert(testsetup_initialized); assert(testsetup_initialized);
struct brtnode_fetch_extra bfe; struct ftnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, brt->h); fill_bfe_for_full_read(&bfe, brt->h);
r = toku_cachetable_get_and_pin( r = toku_cachetable_get_and_pin(
brt->h->cf, brt->h->cf,
...@@ -189,18 +189,18 @@ int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM blocknum, enum brt_msg_t ...@@ -189,18 +189,18 @@ int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM blocknum, enum brt_msg_t
&node_v, &node_v,
NULL, NULL,
get_write_callbacks_for_node(brt->h), get_write_callbacks_for_node(brt->h),
toku_brtnode_fetch_callback, toku_ftnode_fetch_callback,
toku_brtnode_pf_req_callback, toku_ftnode_pf_req_callback,
toku_brtnode_pf_callback, toku_ftnode_pf_callback,
TRUE, TRUE,
&bfe &bfe
); );
if (r!=0) return r; if (r!=0) return r;
BRTNODE node=node_v; FTNODE node=node_v;
assert(node->height>0); assert(node->height>0);
DBT k; DBT k;
int childnum = toku_brtnode_which_child(node, int childnum = toku_ftnode_which_child(node,
toku_fill_dbt(&k, key, keylen), toku_fill_dbt(&k, key, keylen),
&brt->h->cmp_descriptor, brt->compare_fun); &brt->h->cmp_descriptor, brt->compare_fun);
...@@ -214,6 +214,6 @@ int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM blocknum, enum brt_msg_t ...@@ -214,6 +214,6 @@ int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM blocknum, enum brt_msg_t
node->max_msn_applied_to_node_on_disk = msn; node->max_msn_applied_to_node_on_disk = msn;
node->dirty = 1; node->dirty = 1;
toku_unpin_brtnode(brt->h, node_v); toku_unpin_ftnode(brt->h, node_v);
return 0; return 0;
} }
This diff is collapsed.
This diff is collapsed.
/* -*- mode: C; c-basic-offset: 4 -*- */
#ifndef FT_H
#define FT_H
#ident "$Id: ft.h 43422 2012-05-12 17:51:02Z zardosht $"
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include "fttypes.h"
#include "ybt.h"
#include <db.h>
#include "cachetable.h"
#include "log.h"
#include "ft-search.h"
#include "compress.h"
void toku_ft_suppress_rollbacks(FT h, TOKUTXN txn);
//Effect: suppresses rollback logs
void toku_ft_init_treelock(FT h);
void toku_ft_destroy_treelock(FT h);
void toku_ft_grab_treelock(FT h);
void toku_ft_release_treelock(FT h);
int toku_create_new_ft(FT_HANDLE t, CACHEFILE cf, TOKUTXN txn);
void toku_ft_free (FT h);
int toku_read_ft_and_store_in_cachefile (FT_HANDLE brt, CACHEFILE cf, LSN max_acceptable_lsn, FT *header, BOOL* was_open);
void toku_ft_note_ft_handle_open(FT_HANDLE live);
int toku_ft_needed(FT h);
int toku_remove_ft (FT h, char **error_string, BOOL oplsn_valid, LSN oplsn) __attribute__ ((warn_unused_result));
FT_HANDLE toku_ft_get_some_existing_ft_handle(FT h);
void toku_ft_note_hot_begin(FT_HANDLE brt);
void toku_ft_note_hot_complete(FT_HANDLE brt, BOOL success, MSN msn_at_start_of_hot);
void
toku_ft_init(
FT h,
BLOCKNUM root_blocknum_on_disk,
LSN checkpoint_lsn,
TXNID root_xid_that_created,
uint32_t target_nodesize,
uint32_t target_basementnodesize,
enum toku_compression_method compression_method
);
int toku_dictionary_redirect_abort(FT old_h, FT new_h, TOKUTXN txn) __attribute__ ((warn_unused_result));
int toku_dictionary_redirect (const char *dst_fname_in_env, FT_HANDLE old_ft, TOKUTXN txn);
void toku_reset_root_xid_that_created(FT h, TXNID new_root_xid_that_created);
// Reset the root_xid_that_created field to the given value.
// This redefines which xid created the dictionary.
BOOL
toku_ft_maybe_add_txn_ref(FT h, TOKUTXN txn);
void
toku_ft_remove_txn_ref(FT h, TOKUTXN txn);
void toku_calculate_root_offset_pointer ( FT h, CACHEKEY* root_key, u_int32_t *roothash);
void toku_ft_set_new_root_blocknum(FT h, CACHEKEY new_root_key);
LSN toku_ft_checkpoint_lsn(FT h) __attribute__ ((warn_unused_result));
int toku_ft_set_panic(FT h, int panic, char *panic_string) __attribute__ ((warn_unused_result));
void toku_ft_stat64 (FT h, struct ftstat64_s *s);
int toku_update_descriptor(FT h, DESCRIPTOR d, int fd);
// Note: See the locking discussion in ft-ops.c for toku_ft_change_descriptor and toku_update_descriptor.
void toku_ft_update_cmp_descriptor(FT h);
void toku_ft_update_stats(STAT64INFO headerstats, STAT64INFO_S delta);
void toku_ft_decrease_stats(STAT64INFO headerstats, STAT64INFO_S delta);
#endif
/* -*- mode: C; c-basic-offset: 4 -*- */
#ifndef FT_LAYOUT_VERSION_H
#define FT_LAYOUT_VERSION_H
#ident "$Id$"
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
//Must be defined before other recursive headers could include logger.h
enum ft_layout_version_e {
FT_LAYOUT_VERSION_5 = 5,
FT_LAYOUT_VERSION_6 = 6, // Diff from 5 to 6: Add leafentry_estimate
FT_LAYOUT_VERSION_7 = 7, // Diff from 6 to 7: Add exact-bit to leafentry_estimate #818, add magic to header #22, add per-subdatase flags #333
FT_LAYOUT_VERSION_8 = 8, // Diff from 7 to 8: Use murmur instead of crc32. We are going to make a simplification and stop supporting version 7 and before. Current As of Beta 1.0.6
FT_LAYOUT_VERSION_9 = 9, // Diff from 8 to 9: Variable-sized blocks and compression.
FT_LAYOUT_VERSION_10 = 10, // Diff from 9 to 10: Variable number of compressed sub-blocks per block, disk byte order == intel byte order, Subtree estimates instead of just leafentry estimates, translation table, dictionary descriptors, checksum in header, subdb support removed from brt layer
FT_LAYOUT_VERSION_11 = 11, // Diff from 10 to 11: Nested transaction leafentries (completely redesigned). FT_CMDs on disk now support XIDS (multiple txnids) instead of exactly one.
FT_LAYOUT_VERSION_12 = 12, // Diff from 11 to 12: Added FT_CMD 'FT_INSERT_NO_OVERWRITE', compressed block format, num old blocks
FT_LAYOUT_VERSION_13 = 13, // Diff from 12 to 13: Fixed loader pivot bug, added build_id to every node, timestamps to ft
FT_LAYOUT_VERSION_14 = 14, // Diff from 13 to 14: Added MVCC; deprecated TOKU_DB_VALCMP_BUILTIN(_13); Remove fingerprints; Support QUICKLZ; add end-to-end checksum on uncompressed data.
FT_LAYOUT_VERSION_15 = 15, // Diff from 14 to 15: basement nodes, last verification time
FT_LAYOUT_VERSION_16 = 16, // Dr. No: No subtree estimates, partition layout information represented more transparently.
// ALERT ALERT ALERT: version 16 never released to customers, internal and beta use only
FT_LAYOUT_VERSION_17 = 17, // Dr. No: Add STAT64INFO_S to brt_header
FT_LAYOUT_VERSION_18 = 18, // Dr. No: Add HOT info to brt_header
FT_LAYOUT_VERSION_19 = 19, // Doofenshmirtz: Add compression method, highest_unused_msn_for_upgrade
FT_LAYOUT_VERSION_20 = 20, // Clayface: Add compression method to log_fcreate
FT_NEXT_VERSION, // the version after the current version
FT_LAYOUT_VERSION = FT_NEXT_VERSION-1, // A hack so I don't have to change this line.
FT_LAYOUT_MIN_SUPPORTED_VERSION = FT_LAYOUT_VERSION_13, // Minimum version supported
// Define these symbolically so the knowledge of exactly which layout version got rid of fingerprints isn't spread all over the code.
FT_LAST_LAYOUT_VERSION_WITH_FINGERPRINT = FT_LAYOUT_VERSION_13,
FT_FIRST_LAYOUT_VERSION_WITH_END_TO_END_CHECKSUM = FT_LAYOUT_VERSION_14,
FT_FIRST_LAYOUT_VERSION_WITH_BASEMENT_NODES = FT_LAYOUT_VERSION_15,
};
#endif
...@@ -4,44 +4,44 @@ ...@@ -4,44 +4,44 @@
#include <toku_portability.h> #include <toku_portability.h>
#include "brttypes.h" #include "fttypes.h"
#include "xids.h" #include "xids.h"
#include "brt_msg.h" #include "ft_msg.h"
u_int32_t u_int32_t
brt_msg_get_keylen(BRT_MSG brt_msg) { ft_msg_get_keylen(FT_MSG ft_msg) {
u_int32_t rval = brt_msg->u.id.key->size; u_int32_t rval = ft_msg->u.id.key->size;
return rval; return rval;
} }
u_int32_t u_int32_t
brt_msg_get_vallen(BRT_MSG brt_msg) { ft_msg_get_vallen(FT_MSG ft_msg) {
u_int32_t rval = brt_msg->u.id.val->size; u_int32_t rval = ft_msg->u.id.val->size;
return rval; return rval;
} }
XIDS XIDS
brt_msg_get_xids(BRT_MSG brt_msg) { ft_msg_get_xids(FT_MSG ft_msg) {
XIDS rval = brt_msg->xids; XIDS rval = ft_msg->xids;
return rval; return rval;
} }
void * void *
brt_msg_get_key(BRT_MSG brt_msg) { ft_msg_get_key(FT_MSG ft_msg) {
void * rval = brt_msg->u.id.key->data; void * rval = ft_msg->u.id.key->data;
return rval; return rval;
} }
void * void *
brt_msg_get_val(BRT_MSG brt_msg) { ft_msg_get_val(FT_MSG ft_msg) {
void * rval = brt_msg->u.id.val->data; void * rval = ft_msg->u.id.val->data;
return rval; return rval;
} }
enum brt_msg_type enum ft_msg_type
brt_msg_get_type(BRT_MSG brt_msg) { ft_msg_get_type(FT_MSG ft_msg) {
enum brt_msg_type rval = brt_msg->type; enum ft_msg_type rval = ft_msg->type;
return rval; return rval;
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -35,9 +35,9 @@ ...@@ -35,9 +35,9 @@
#include <string.h> #include <string.h>
#include "block_allocator.h" #include "block_allocator.h"
#include "brt.h" #include "ft-ops.h"
#include "brt_header.h" #include "ft.h"
#include "brt-internal.h" #include "ft-internal.h"
#include "cachetable.h" #include "cachetable.h"
#include "rwlock.h" #include "rwlock.h"
#include "fifo.h" #include "fifo.h"
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#include "key.h" #include "key.h"
#include "leafentry.h" #include "leafentry.h"
#include "log-internal.h" #include "log-internal.h"
#include <newbrt/log_header.h> #include <ft/log_header.h>
#include "logcursor.h" #include "logcursor.h"
#include "logfilemgr.h" #include "logfilemgr.h"
#include "rbuf.h" #include "rbuf.h"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include "ybt.h" #include "ybt.h"
#include "brttypes.h" #include "fttypes.h"
#if defined(__cplusplus) || defined(__cilkplusplus) #if defined(__cplusplus) || defined(__cilkplusplus)
extern "C" { extern "C" {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment