From 0d3340a51db55ad773447c368238080ce55b8678 Mon Sep 17 00:00:00 2001 From: John Esmet Date: Wed, 2 Jul 2014 11:56:22 -0400 Subject: [PATCH] FT-294 Move cachetable files to ft/cachetable, txn files to ft/txn FT-295 Move ybt.h to utils/dbt.h --- ft/CMakeLists.txt | 27 +- ft/{ => cachetable}/background_job_manager.cc | 2 +- ft/{ => cachetable}/background_job_manager.h | 0 ft/{ => cachetable}/cachetable-internal.h | 2 +- ft/{ => cachetable}/cachetable.cc | 13 +- ft/{ => cachetable}/cachetable.h | 4 +- ft/{ => cachetable}/checkpoint.cc | 6 +- ft/{ => cachetable}/checkpoint.h | 6 +- ft/comparator.h | 6 +- ft/cursor.cc | 4 +- ft/ft-cachetable-wrappers.h | 2 +- ft/ft-internal.h | 4 +- ft/ft-ops.cc | 6 +- ft/ft-ops.h | 4 +- ft/ft.h | 4 +- ft/leafentry.h | 2 +- ft/loader/callbacks.cc | 2 +- ft/loader/loader.h | 4 +- ft/logger/log-internal.h | 6 +- ft/logger/log.h | 7 +- ft/logger/log_upgrade.cc | 2 +- ft/logger/logger.cc | 4 +- ft/logger/logger.h | 2 +- ft/{ => logger}/recover.cc | 6 +- ft/{ => logger}/recover.h | 25 +- ft/msg.cc | 4 +- ft/msg.h | 2 +- ft/msg_buffer.cc | 2 +- ft/msg_buffer.h | 4 +- ft/serialize/ft_layout_version.h | 2 +- ft/serialize/ft_node-serialize.cc | 4 +- ft/tdb-recover.cc | 15 +- ft/tests/cachetable-checkpoint-pending.cc | 2 +- ft/tests/cachetable-checkpoint-test.cc | 2 +- ft/tests/cachetable-checkpointer-class.cc | 2 +- ft/tests/cachetable-evictor-class.cc | 2 +- .../cachetable-prefetch-checkpoint-test.cc | 2 +- .../cachetable-prefetch-flowcontrol-test.cc | 2 +- ft/tests/cachetable-test.h | 2 +- ft/tests/ftloader-test-vm.cc | 2 +- ft/tests/is_empty.cc | 2 +- ft/tests/le-cursor-provdel.cc | 2 +- ft/tests/le-cursor-right.cc | 2 +- ft/tests/le-cursor-walk.cc | 2 +- ft/tests/recovery-test5123.cc | 2 +- ft/tests/test-bjm.cc | 2 +- ft/tests/test-checkpoint-during-flush.cc | 2 +- ft/tests/test-checkpoint-during-merge.cc | 2 +- ft/tests/test-checkpoint-during-rebalance.cc | 2 +- ft/tests/test-checkpoint-during-split.cc | 2 +- ft/tests/test-dirty-flushes-on-cleaner.cc | 2 +- ft/tests/test-flushes-on-cleaner.cc | 2 +- ft/tests/test-hot-with-bounds.cc | 2 +- ft/tests/test-merges-on-cleaner.cc | 2 +- ft/tests/test-pick-child-to-flush.cc | 2 +- ft/tests/test-txn-child-manager.cc | 2 +- ft/tests/test.h | 4 +- ft/tests/test3681.cc | 2 +- ...test_rightmost_leaf_seqinsert_heuristic.cc | 2 +- ft/tests/test_rightmost_leaf_split_merge.cc | 2 +- ft/tests/upgrade_test_simple.cc | 2 +- ft/tests/xid_lsn_independent.cc | 2 +- ft/tokuftdump.cc | 2 +- ft/{ => txn}/roll.cc | 4 +- ft/{ => txn}/rollback-apply.cc | 2 +- ft/{ => txn}/rollback-apply.h | 0 ft/{ => txn}/rollback-ct-callbacks.cc | 4 +- ft/{ => txn}/rollback-ct-callbacks.h | 2 +- ft/{ => txn}/rollback.cc | 2 +- ft/{ => txn}/rollback.h | 4 +- ft/{ => txn}/rollback_log_node_cache.cc | 2 +- ft/{ => txn}/rollback_log_node_cache.h | 2 +- ft/{ => txn}/txn.cc | 8 +- ft/{ => txn}/txn.h | 4 +- ft/{ => txn}/txn_child_manager.cc | 2 +- ft/{ => txn}/txn_child_manager.h | 4 +- ft/{ => txn}/txn_manager.cc | 8 +- ft/{ => txn}/txn_manager.h | 2 +- ft/{ => txn}/txn_state.h | 0 ft/{ => txn}/xids.cc | 2 +- ft/{ => txn}/xids.h | 2 +- ft/ule.cc | 6 +- ft/ule.h | 2 +- locktree/keyrange.cc | 288 +++++++++--------- locktree/lock_request.cc | 11 +- locktree/range_buffer.cc | 7 +- locktree/range_buffer.h | 3 +- locktree/tests/test.h | 2 +- locktree/treenode.h | 11 +- locktree/txnid_set.h | 2 +- src/indexer-internal.h | 2 +- src/indexer-undo-do.cc | 6 +- src/indexer.cc | 4 +- src/loader.cc | 2 +- src/tests/blackhole.cc | 2 +- src/tests/hotindexer-undo-do-test.cc | 3 +- src/tests/test_txn_nested1.cc | 2 +- src/tests/test_txn_nested2.cc | 11 +- src/tests/test_txn_nested3.cc | 2 +- src/tests/test_txn_nested4.cc | 2 +- src/tests/test_txn_nested5.cc | 2 +- src/tests/threaded_stress_test_helpers.h | 2 +- src/ydb-internal.h | 4 +- src/ydb.cc | 6 +- src/ydb_db.cc | 2 +- src/ydb_env_func.cc | 4 +- src/ydb_txn.cc | 10 +- src/ydb_write.cc | 2 +- util/CMakeLists.txt | 1 + ft/ybt.cc => util/dbt.cc | 43 +-- ft/ybt.h => util/dbt.h | 2 +- 111 files changed, 369 insertions(+), 378 deletions(-) rename ft/{ => cachetable}/background_job_manager.cc (99%) rename ft/{ => cachetable}/background_job_manager.h (100%) rename ft/{ => cachetable}/cachetable-internal.h (99%) rename ft/{ => cachetable}/cachetable.cc (99%) rename ft/{ => cachetable}/cachetable.h (99%) rename ft/{ => cachetable}/checkpoint.cc (99%) rename ft/{ => cachetable}/checkpoint.h (99%) rename ft/{ => logger}/recover.cc (99%) rename ft/{ => logger}/recover.h (88%) rename ft/{ => txn}/roll.cc (99%) rename ft/{ => txn}/rollback-apply.cc (99%) rename ft/{ => txn}/rollback-apply.h (100%) rename ft/{ => txn}/rollback-ct-callbacks.cc (99%) rename ft/{ => txn}/rollback-ct-callbacks.h (99%) rename ft/{ => txn}/rollback.cc (99%) rename ft/{ => txn}/rollback.h (99%) rename ft/{ => txn}/rollback_log_node_cache.cc (99%) rename ft/{ => txn}/rollback_log_node_cache.h (99%) rename ft/{ => txn}/txn.cc (99%) rename ft/{ => txn}/txn.h (99%) rename ft/{ => txn}/txn_child_manager.cc (99%) rename ft/{ => txn}/txn_child_manager.h (97%) rename ft/{ => txn}/txn_manager.cc (99%) rename ft/{ => txn}/txn_manager.h (99%) rename ft/{ => txn}/txn_state.h (100%) rename ft/{ => txn}/xids.cc (99%) rename ft/{ => txn}/xids.h (99%) rename ft/ybt.cc => util/dbt.cc (93%) rename ft/ybt.h => util/dbt.h (99%) diff --git a/ft/CMakeLists.txt b/ft/CMakeLists.txt index da08393f7..1ac723367 100644 --- a/ft/CMakeLists.txt +++ b/ft/CMakeLists.txt @@ -23,10 +23,10 @@ add_custom_target( ) set(FT_SOURCES - background_job_manager bndata - cachetable - checkpoint + cachetable/background_job_manager + cachetable/cachetable + cachetable/checkpoint cursor ft ft-cachetable-wrappers @@ -45,16 +45,11 @@ set(FT_SOURCES logger/logfilemgr logger/logger logger/log_upgrade + logger/recover msg msg_buffer node pivotkeys - recover - rollback - rollback-apply - rollback-ct-callbacks - rollback_log_node_cache - roll serialize/block_allocator serialize/block_table serialize/compress @@ -63,12 +58,16 @@ set(FT_SOURCES serialize/ft-serialize serialize/quicklz serialize/sub_block - txn - txn_child_manager - txn_manager + txn/rollback + txn/rollback-apply + txn/rollback-ct-callbacks + txn/rollback_log_node_cache + txn/roll + txn/txn + txn/txn_child_manager + txn/txn_manager + txn/xids ule - xids - ybt "${CMAKE_CURRENT_BINARY_DIR}/log_code" "${CMAKE_CURRENT_BINARY_DIR}/log_print" ) diff --git a/ft/background_job_manager.cc b/ft/cachetable/background_job_manager.cc similarity index 99% rename from ft/background_job_manager.cc rename to ft/cachetable/background_job_manager.cc index 6849909a2..12588cd06 100644 --- a/ft/background_job_manager.cc +++ b/ft/cachetable/background_job_manager.cc @@ -93,7 +93,7 @@ PATENT RIGHTS GRANT: #include #include -#include "background_job_manager.h" +#include "cachetable/background_job_manager.h" struct background_job_manager_struct { bool accepting_jobs; diff --git a/ft/background_job_manager.h b/ft/cachetable/background_job_manager.h similarity index 100% rename from ft/background_job_manager.h rename to ft/cachetable/background_job_manager.h diff --git a/ft/cachetable-internal.h b/ft/cachetable/cachetable-internal.h similarity index 99% rename from ft/cachetable-internal.h rename to ft/cachetable/cachetable-internal.h index f1dcb71a5..78c30bf78 100644 --- a/ft/cachetable-internal.h +++ b/ft/cachetable/cachetable-internal.h @@ -92,7 +92,7 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 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 "background_job_manager.h" +#include "cachetable/background_job_manager.h" #include #include #include diff --git a/ft/cachetable.cc b/ft/cachetable/cachetable.cc similarity index 99% rename from ft/cachetable.cc rename to ft/cachetable/cachetable.cc index 605302db2..b24f867bb 100644 --- a/ft/cachetable.cc +++ b/ft/cachetable/cachetable.cc @@ -91,6 +91,7 @@ PATENT RIGHTS GRANT: #include #include +#include #include #include @@ -100,9 +101,9 @@ PATENT RIGHTS GRANT: #include #include -#include "ft/cachetable.h" -#include "ft/cachetable-internal.h" -#include "ft/checkpoint.h" +#include "ft/cachetable/cachetable.h" +#include "ft/cachetable/cachetable-internal.h" +#include "ft/cachetable/checkpoint.h" #include "ft/logger/log-internal.h" #include "util/rwlock.h" #include "util/status.h" @@ -1588,7 +1589,7 @@ int toku_cachetable_get_and_pin_with_dep_pairs ( PAIR* dependent_pairs, enum cachetable_dirty* dependent_dirty // array stating dirty/cleanness of dependent pairs ) -// See cachetable.h +// See cachetable/cachetable.h { CACHETABLE ct = cachefile->cachetable; bool wait = false; @@ -2024,7 +2025,7 @@ int toku_cachetable_get_and_pin_nonblocking( void *read_extraargs, UNLOCKERS unlockers ) -// See cachetable.h. +// See cachetable/cachetable.h. { CACHETABLE ct = cf->cachetable; assert(lock_type == PL_READ || @@ -2207,7 +2208,7 @@ int toku_cachefile_prefetch(CACHEFILE cf, CACHEKEY key, uint32_t fullhash, CACHETABLE_PARTIAL_FETCH_CALLBACK pf_callback, void *read_extraargs, bool *doing_prefetch) -// Effect: See the documentation for this function in cachetable.h +// Effect: See the documentation for this function in cachetable/cachetable.h { int r = 0; PAIR p = NULL; diff --git a/ft/cachetable.h b/ft/cachetable/cachetable.h similarity index 99% rename from ft/cachetable.h rename to ft/cachetable/cachetable.h index 722facd81..b4aacd854 100644 --- a/ft/cachetable.h +++ b/ft/cachetable/cachetable.h @@ -94,9 +94,9 @@ PATENT RIGHTS GRANT: #include -#include "ft/serialize/block_table.h" #include "ft/logger/logger.h" -#include "ft/txn.h" +#include "ft/serialize/block_table.h" +#include "ft/txn/txn.h" #include "util/minicron.h" // Maintain a cache mapping from cachekeys to values (void*) diff --git a/ft/checkpoint.cc b/ft/cachetable/checkpoint.cc similarity index 99% rename from ft/checkpoint.cc rename to ft/cachetable/checkpoint.cc index 08ccfabfc..3da668a81 100644 --- a/ft/checkpoint.cc +++ b/ft/cachetable/checkpoint.cc @@ -131,11 +131,11 @@ PATENT RIGHTS GRANT: #include "portability/toku_portability.h" #include "portability/toku_atomic.h" -#include "ft/cachetable.h" +#include "ft/cachetable/cachetable.h" +#include "ft/cachetable/checkpoint.h" #include "ft/ft.h" #include "ft/logger/log-internal.h" -#include "ft/logger/logger.h" -#include "ft/checkpoint.h" +#include "ft/logger/recover.h" #include "util/frwlock.h" #include "util/status.h" diff --git a/ft/checkpoint.h b/ft/cachetable/checkpoint.h similarity index 99% rename from ft/checkpoint.h rename to ft/cachetable/checkpoint.h index fd08cd90e..2e4873084 100644 --- a/ft/checkpoint.h +++ b/ft/cachetable/checkpoint.h @@ -92,13 +92,13 @@ PATENT RIGHTS GRANT: #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 "$Id$" -#include "cachetable.h" - #include -void toku_set_checkpoint_period(CACHETABLE ct, uint32_t new_period); +#include "ft/cachetable/cachetable.h" + //Effect: Change [end checkpoint (n) - begin checkpoint (n+1)] delay to // new_period seconds. 0 means disable. +void toku_set_checkpoint_period(CACHETABLE ct, uint32_t new_period); uint32_t toku_get_checkpoint_period_unlocked(CACHETABLE ct); diff --git a/ft/comparator.h b/ft/comparator.h index 9533d0ca0..85a95819d 100644 --- a/ft/comparator.h +++ b/ft/comparator.h @@ -93,9 +93,9 @@ PATENT RIGHTS GRANT: #include #include -#include -//#include -#include +#include "portability/memory.h" + +#include "util/dbt.h" typedef int (*ft_compare_func)(DB *db, const DBT *a, const DBT *b); diff --git a/ft/cursor.cc b/ft/cursor.cc index d1679feb3..098721b28 100644 --- a/ft/cursor.cc +++ b/ft/cursor.cc @@ -90,8 +90,8 @@ PATENT RIGHTS GRANT: #include "ft/cursor.h" #include "ft/leafentry.h" -#include "ft/txn.h" -#include "ft/ybt.h" +#include "ft/txn/txn.h" +#include "util/dbt.h" int toku_ft_cursor_create(FT_HANDLE ft_handle, FT_CURSOR cursor, TOKUTXN ttxn, bool is_snapshot_read, diff --git a/ft/ft-cachetable-wrappers.h b/ft/ft-cachetable-wrappers.h index 044195c7f..5af425e18 100644 --- a/ft/ft-cachetable-wrappers.h +++ b/ft/ft-cachetable-wrappers.h @@ -92,7 +92,7 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 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 "ft/cachetable.h" +#include "ft/cachetable/cachetable.h" #include "ft/ft-internal.h" #include "ft/node.h" diff --git a/ft/ft-internal.h b/ft/ft-internal.h index 177484f31..87abf0675 100644 --- a/ft/ft-internal.h +++ b/ft/ft-internal.h @@ -96,12 +96,12 @@ PATENT RIGHTS GRANT: #include "portability/toku_list.h" #include "portability/toku_race_tools.h" -#include "ft/cachetable.h" +#include "ft/cachetable/cachetable.h" #include "ft/comparator.h" #include "ft/ft.h" #include "ft/ft-ops.h" #include "ft/node.h" -#include "ft/rollback.h" +#include "ft/txn/rollback.h" // Symbol TOKUDB_REVISION is not defined by fractal-tree makefiles, so // BUILD_ID of 1000 indicates development build of main, not a release build. diff --git a/ft/ft-ops.cc b/ft/ft-ops.cc index 12c99fc74..1f045bd8d 100644 --- a/ft/ft-ops.cc +++ b/ft/ft-ops.cc @@ -200,7 +200,7 @@ basement nodes, bulk fetch, and partial fetch: */ -#include "ft/checkpoint.h" +#include "ft/cachetable/checkpoint.h" #include "ft/cursor.h" #include "ft/ft.h" #include "ft/ft-cachetable-wrappers.h" @@ -215,9 +215,9 @@ basement nodes, bulk fetch, and partial fetch: #include "ft/serialize/ft-serialize.h" #include "ft/serialize/ft_layout_version.h" #include "ft/serialize/ft_node-serialize.h" -#include "ft/txn_manager.h" +#include "ft/txn/txn_manager.h" #include "ft/ule.h" -#include "ft/xids.h" +#include "ft/txn/xids.h" #include diff --git a/ft/ft-ops.h b/ft/ft-ops.h index 786cc3238..3565eedcb 100644 --- a/ft/ft-ops.h +++ b/ft/ft-ops.h @@ -96,10 +96,10 @@ PATENT RIGHTS GRANT: #include -#include "ft/cachetable.h" +#include "ft/cachetable/cachetable.h" #include "ft/comparator.h" #include "ft/msg.h" -#include "ft/ybt.h" +#include "util/dbt.h" typedef struct ft_handle *FT_HANDLE; diff --git a/ft/ft.h b/ft/ft.h index c90eb1b47..4df7ed9cc 100644 --- a/ft/ft.h +++ b/ft/ft.h @@ -93,10 +93,10 @@ PATENT RIGHTS GRANT: #include -#include "ft/cachetable.h" +#include "ft/cachetable/cachetable.h" #include "ft/ft-ops.h" #include "ft/logger/log.h" -#include "ft/ybt.h" +#include "util/dbt.h" typedef struct ft *FT; typedef struct ft_options *FT_OPTIONS; diff --git a/ft/leafentry.h b/ft/leafentry.h index 148c4092c..07ae06d64 100644 --- a/ft/leafentry.h +++ b/ft/leafentry.h @@ -97,7 +97,7 @@ PATENT RIGHTS GRANT: #include #include -#include "ft/txn_manager.h" +#include "ft/txn/txn_manager.h" #include "ft/serialize/rbuf.h" #include "ft/msg.h" diff --git a/ft/loader/callbacks.cc b/ft/loader/callbacks.cc index a6b7686e0..323196bc2 100644 --- a/ft/loader/callbacks.cc +++ b/ft/loader/callbacks.cc @@ -96,7 +96,7 @@ PATENT RIGHTS GRANT: #include #include "loader/loader-internal.h" -#include "ybt.h" +#include "util/dbt.h" static void error_callback_lock(ft_loader_error_callback loader_error) { toku_mutex_lock(&loader_error->mutex); diff --git a/ft/loader/loader.h b/ft/loader/loader.h index b4b8a2a1f..9ab0d482c 100644 --- a/ft/loader/loader.h +++ b/ft/loader/loader.h @@ -92,8 +92,8 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 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 "ft/txn.h" -#include "ft/cachetable.h" +#include "ft/txn/txn.h" +#include "ft/cachetable/cachetable.h" #include "ft/comparator.h" #include "ft/ft-ops.h" diff --git a/ft/logger/log-internal.h b/ft/logger/log-internal.h index f671eed6b..d1d19bdad 100644 --- a/ft/logger/log-internal.h +++ b/ft/logger/log-internal.h @@ -102,9 +102,9 @@ PATENT RIGHTS GRANT: #include "ft/ft-internal.h" #include "ft/logger/log.h" #include "ft/logger/logfilemgr.h" -#include "ft/txn.h" -#include "ft/txn_manager.h" -#include "ft/rollback_log_node_cache.h" +#include "ft/txn/txn.h" +#include "ft/txn/txn_manager.h" +#include "ft/txn/rollback_log_node_cache.h" #include "util/memarena.h" #include "util/omt.h" diff --git a/ft/logger/log.h b/ft/logger/log.h index eac895011..5dfb35315 100644 --- a/ft/logger/log.h +++ b/ft/logger/log.h @@ -98,10 +98,9 @@ PATENT RIGHTS GRANT: #include "portability/memory.h" #include "portability/toku_portability.h" -#include "ft/logger/logger.h" -#include "ft/rollback.h" -#include "ft/recover.h" -#include "ft/txn.h" +#include "ft/logger/recover.h" +#include "ft/txn/rollback.h" +#include "ft/txn/txn.h" #include "util/bytestring.h" struct roll_entry; diff --git a/ft/logger/log_upgrade.cc b/ft/logger/log_upgrade.cc index ca6f70e90..8fd65ae26 100644 --- a/ft/logger/log_upgrade.cc +++ b/ft/logger/log_upgrade.cc @@ -93,7 +93,7 @@ PATENT RIGHTS GRANT: #include "log-internal.h" #include "logger/logcursor.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" static uint64_t footprint = 0; // for debug and accountability diff --git a/ft/logger/logger.cc b/ft/logger/logger.cc index c534065cb..48844fd33 100644 --- a/ft/logger/logger.cc +++ b/ft/logger/logger.cc @@ -97,8 +97,8 @@ PATENT RIGHTS GRANT: #include "ft/serialize/block_table.h" #include "ft/ft.h" #include "ft/logger/log-internal.h" -#include "ft/txn_manager.h" -#include "ft/rollback_log_node_cache.h" +#include "ft/txn/txn_manager.h" +#include "ft/txn/rollback_log_node_cache.h" #include "util/status.h" diff --git a/ft/logger/logger.h b/ft/logger/logger.h index 2c04f6b8a..4068e8027 100644 --- a/ft/logger/logger.h +++ b/ft/logger/logger.h @@ -94,7 +94,7 @@ PATENT RIGHTS GRANT: #include "ft/serialize/block_table.h" #include "ft/serialize/ft_layout_version.h" -#include "ft/txn.h" +#include "ft/txn/txn.h" typedef struct tokulogger *TOKULOGGER; diff --git a/ft/recover.cc b/ft/logger/recover.cc similarity index 99% rename from ft/recover.cc rename to ft/logger/recover.cc index 9cf231323..ad05ecb18 100644 --- a/ft/recover.cc +++ b/ft/logger/recover.cc @@ -90,13 +90,13 @@ PATENT RIGHTS GRANT: #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 "ft/cachetable.h" -#include "ft/checkpoint.h" +#include "ft/cachetable/cachetable.h" +#include "ft/cachetable/checkpoint.h" #include "ft/ft.h" #include "ft/log_header.h" #include "ft/logger/log-internal.h" #include "ft/logger/logcursor.h" -#include "ft/txn_manager.h" +#include "ft/txn/txn_manager.h" #include "util/omt.h" int tokudb_recovery_trace = 0; // turn on recovery tracing, default off. diff --git a/ft/recover.h b/ft/logger/recover.h similarity index 88% rename from ft/recover.h rename to ft/logger/recover.h index 38d6903f4..134bbcdc4 100644 --- a/ft/recover.h +++ b/ft/logger/recover.h @@ -102,21 +102,22 @@ PATENT RIGHTS GRANT: #include "ft/ft-ops.h" #include "util/x1764.h" -typedef void (*prepared_txn_callback_t)(DB_ENV*, TOKUTXN); -typedef void (*keep_cachetable_callback_t)(DB_ENV*, CACHETABLE); +typedef void (*prepared_txn_callback_t)(DB_ENV *env, struct tokutxn *txn); +typedef void (*keep_cachetable_callback_t)(DB_ENV *env, struct cachetable *ct); // Run tokudb recovery from the log // Returns 0 if success -int tokudb_recover (DB_ENV *env, - prepared_txn_callback_t prepared_txn_callback, - keep_cachetable_callback_t keep_cachetable_callback, - struct tokulogger *logger, - const char *env_dir, const char *log_dir, - ft_compare_func bt_compare, - ft_update_func update_function, - generate_row_for_put_func generate_row_for_put, - generate_row_for_del_func generate_row_for_del, - size_t cachetable_size); +int tokudb_recover(DB_ENV *env, + prepared_txn_callback_t prepared_txn_callback, + keep_cachetable_callback_t keep_cachetable_callback, + struct tokulogger *logger, + const char *env_dir, + const char *log_dir, + ft_compare_func bt_compare, + ft_update_func update_function, + generate_row_for_put_func generate_row_for_put, + generate_row_for_del_func generate_row_for_del, + size_t cachetable_size); // Effect: Check the tokudb logs to determine whether or not we need to run recovery. // If the log is empty or if there is a clean shutdown at the end of the log, then we diff --git a/ft/msg.cc b/ft/msg.cc index c1ce9fdd4..09a9d17e3 100644 --- a/ft/msg.cc +++ b/ft/msg.cc @@ -91,8 +91,8 @@ PATENT RIGHTS GRANT: #include "portability/toku_portability.h" #include "ft/msg.h" -#include "ft/xids.h" -#include "ft/ybt.h" +#include "ft/txn/xids.h" +#include "util/dbt.h" ft_msg::ft_msg(const DBT *key, const DBT *val, enum ft_msg_type t, MSN m, XIDS x) : _key(key ? *key : toku_empty_dbt()), diff --git a/ft/msg.h b/ft/msg.h index 7d738a3cd..1c974a0c8 100644 --- a/ft/msg.h +++ b/ft/msg.h @@ -99,7 +99,7 @@ PATENT RIGHTS GRANT: #include "portability/toku_assert.h" #include "portability/toku_stdint.h" -#include "ft/xids.h" +#include "ft/txn/xids.h" #ident "Copyright (c) 2007-2013 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." diff --git a/ft/msg_buffer.cc b/ft/msg_buffer.cc index d6ff95436..9da03033e 100644 --- a/ft/msg_buffer.cc +++ b/ft/msg_buffer.cc @@ -87,7 +87,7 @@ PATENT RIGHTS GRANT: */ #include "ft/msg_buffer.h" -#include "ft/ybt.h" +#include "util/dbt.h" void message_buffer::create() { _num_entries = 0; diff --git a/ft/msg_buffer.h b/ft/msg_buffer.h index efd39b526..703f3c5fc 100644 --- a/ft/msg_buffer.h +++ b/ft/msg_buffer.h @@ -89,8 +89,8 @@ PATENT RIGHTS GRANT: #pragma once #include "ft/msg.h" -#include "ft/xids.h" -#include "ft/ybt.h" +#include "ft/txn/xids.h" +#include "util/dbt.h" class message_buffer { public: diff --git a/ft/serialize/ft_layout_version.h b/ft/serialize/ft_layout_version.h index 2479aff9c..9d9796e92 100644 --- a/ft/serialize/ft_layout_version.h +++ b/ft/serialize/ft_layout_version.h @@ -92,7 +92,7 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 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 +//Must be defined before other recursive headers could include logger/recover.h enum ft_layout_version_e { FT_LAYOUT_VERSION_5 = 5, FT_LAYOUT_VERSION_6 = 6, // Diff from 5 to 6: Add leafentry_estimate diff --git a/ft/serialize/ft_node-serialize.cc b/ft/serialize/ft_node-serialize.cc index b0eaa0af6..65eb8c741 100644 --- a/ft/serialize/ft_node-serialize.cc +++ b/ft/serialize/ft_node-serialize.cc @@ -91,12 +91,12 @@ PATENT RIGHTS GRANT: #include "portability/toku_atomic.h" -#include "ft/cachetable.h" +#include "ft/cachetable/cachetable.h" #include "ft/ft.h" #include "ft/ft-internal.h" #include "ft/node.h" #include "ft/logger/log-internal.h" -#include "ft/rollback.h" +#include "ft/txn/rollback.h" #include "ft/serialize/block_table.h" #include "ft/serialize/compress.h" #include "ft/serialize/ft_node-serialize.h" diff --git a/ft/tdb-recover.cc b/ft/tdb-recover.cc index 736fd6685..9c0239e63 100644 --- a/ft/tdb-recover.cc +++ b/ft/tdb-recover.cc @@ -95,18 +95,15 @@ PATENT RIGHTS GRANT: // cd ../src/tests/tmpdir // ../../../ft/recover ../dir.test_log2.c.tdb -#include "ft-ops.h" -#include "recover.h" +#include "ft/ft-ops.h" +#include "ft/logger/recover.h" static int recovery_main(int argc, const char *const argv[]); -int -main(int argc, const char *const argv[]) { - { - int rr = toku_ft_layer_init(); - assert(rr==0); - } - int r = recovery_main(argc, argv); +int main(int argc, const char *const argv[]) { + int r = toku_ft_layer_init(); + assert(r == 0); + r = recovery_main(argc, argv); toku_ft_layer_destroy(); return r; } diff --git a/ft/tests/cachetable-checkpoint-pending.cc b/ft/tests/cachetable-checkpoint-pending.cc index ff6ea6a48..e0bde782c 100644 --- a/ft/tests/cachetable-checkpoint-pending.cc +++ b/ft/tests/cachetable-checkpoint-pending.cc @@ -93,7 +93,7 @@ PATENT RIGHTS GRANT: #include #include #include "cachetable-test.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" #include static int N; // how many items in the table diff --git a/ft/tests/cachetable-checkpoint-test.cc b/ft/tests/cachetable-checkpoint-test.cc index 2be864d5e..fa6297942 100644 --- a/ft/tests/cachetable-checkpoint-test.cc +++ b/ft/tests/cachetable-checkpoint-test.cc @@ -93,7 +93,7 @@ PATENT RIGHTS GRANT: #include -#include "checkpoint.h" +#include "cachetable/checkpoint.h" static const int item_size = 1; diff --git a/ft/tests/cachetable-checkpointer-class.cc b/ft/tests/cachetable-checkpointer-class.cc index fa950d397..57e51820a 100644 --- a/ft/tests/cachetable-checkpointer-class.cc +++ b/ft/tests/cachetable-checkpointer-class.cc @@ -89,7 +89,7 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved." #include "test.h" -#include "cachetable-internal.h" +#include "cachetable/cachetable-internal.h" #include "cachetable-test.h" // diff --git a/ft/tests/cachetable-evictor-class.cc b/ft/tests/cachetable-evictor-class.cc index d0dff7d95..bd4eff4f8 100644 --- a/ft/tests/cachetable-evictor-class.cc +++ b/ft/tests/cachetable-evictor-class.cc @@ -89,7 +89,7 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved." #include "test.h" -#include "cachetable-internal.h" +#include "cachetable/cachetable-internal.h" class evictor_unit_test { public: diff --git a/ft/tests/cachetable-prefetch-checkpoint-test.cc b/ft/tests/cachetable-prefetch-checkpoint-test.cc index 6eed6428c..c409a62ba 100644 --- a/ft/tests/cachetable-prefetch-checkpoint-test.cc +++ b/ft/tests/cachetable-prefetch-checkpoint-test.cc @@ -95,7 +95,7 @@ PATENT RIGHTS GRANT: #include #include "cachetable-test.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" const int item_size = 1; diff --git a/ft/tests/cachetable-prefetch-flowcontrol-test.cc b/ft/tests/cachetable-prefetch-flowcontrol-test.cc index 612579944..e557930bf 100644 --- a/ft/tests/cachetable-prefetch-flowcontrol-test.cc +++ b/ft/tests/cachetable-prefetch-flowcontrol-test.cc @@ -93,7 +93,7 @@ PATENT RIGHTS GRANT: #include "test.h" -#include "cachetable-internal.h" +#include "cachetable/cachetable-internal.h" static int flush_calls = 0; static int flush_evict_calls = 0; diff --git a/ft/tests/cachetable-test.h b/ft/tests/cachetable-test.h index 75316469f..facdba398 100644 --- a/ft/tests/cachetable-test.h +++ b/ft/tests/cachetable-test.h @@ -90,7 +90,7 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved." -#include "cachetable-internal.h" +#include "cachetable/cachetable-internal.h" // // Dummy callbacks for checkpointing diff --git a/ft/tests/ftloader-test-vm.cc b/ft/tests/ftloader-test-vm.cc index d9a056614..d207fa574 100644 --- a/ft/tests/ftloader-test-vm.cc +++ b/ft/tests/ftloader-test-vm.cc @@ -90,7 +90,7 @@ PATENT RIGHTS GRANT: #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 "test.h" -#include "cachetable.h" +#include "cachetable/cachetable.h" #include /* Test for #2755. The ft_loader is using too much VM. */ diff --git a/ft/tests/is_empty.cc b/ft/tests/is_empty.cc index 40dfd6bb5..f38d0967b 100644 --- a/ft/tests/is_empty.cc +++ b/ft/tests/is_empty.cc @@ -92,7 +92,7 @@ PATENT RIGHTS GRANT: #include "test.h" #include "toku_os.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" #define FILENAME "test0.ft" diff --git a/ft/tests/le-cursor-provdel.cc b/ft/tests/le-cursor-provdel.cc index 868b23724..73894c6ad 100644 --- a/ft/tests/le-cursor-provdel.cc +++ b/ft/tests/le-cursor-provdel.cc @@ -91,7 +91,7 @@ PATENT RIGHTS GRANT: // test the LE_CURSOR next function with provisionally deleted rows -#include "checkpoint.h" +#include "cachetable/checkpoint.h" #include "le-cursor.h" #include "test.h" diff --git a/ft/tests/le-cursor-right.cc b/ft/tests/le-cursor-right.cc index 54d33397d..3f9593c1c 100644 --- a/ft/tests/le-cursor-right.cc +++ b/ft/tests/le-cursor-right.cc @@ -94,7 +94,7 @@ PATENT RIGHTS GRANT: // - LE_CURSOR somewhere else -#include "checkpoint.h" +#include "cachetable/checkpoint.h" #include "le-cursor.h" #include "test.h" diff --git a/ft/tests/le-cursor-walk.cc b/ft/tests/le-cursor-walk.cc index 158f870a3..7dc925100 100644 --- a/ft/tests/le-cursor-walk.cc +++ b/ft/tests/le-cursor-walk.cc @@ -91,7 +91,7 @@ PATENT RIGHTS GRANT: // test the LE_CURSOR next function -#include "checkpoint.h" +#include "cachetable/checkpoint.h" #include "le-cursor.h" #include "test.h" #include diff --git a/ft/tests/recovery-test5123.cc b/ft/tests/recovery-test5123.cc index 7020ea39b..7e912b6f9 100644 --- a/ft/tests/recovery-test5123.cc +++ b/ft/tests/recovery-test5123.cc @@ -92,7 +92,7 @@ PATENT RIGHTS GRANT: #include "test.h" #include "toku_os.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" #include "test-ft-txns.h" diff --git a/ft/tests/test-bjm.cc b/ft/tests/test-bjm.cc index dc0f83399..7218b597a 100644 --- a/ft/tests/test-bjm.cc +++ b/ft/tests/test-bjm.cc @@ -89,7 +89,7 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2011-2013 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 "background_job_manager.h" +#include "cachetable/background_job_manager.h" #include "test.h" diff --git a/ft/tests/test-checkpoint-during-flush.cc b/ft/tests/test-checkpoint-during-flush.cc index 9a42bed40..59f9748c4 100644 --- a/ft/tests/test-checkpoint-during-flush.cc +++ b/ft/tests/test-checkpoint-during-flush.cc @@ -96,7 +96,7 @@ PATENT RIGHTS GRANT: #include #include "ft-flusher.h" #include "ft-flusher-internal.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" static TOKUTXN const null_txn = 0; diff --git a/ft/tests/test-checkpoint-during-merge.cc b/ft/tests/test-checkpoint-during-merge.cc index 35a3ab794..2c1f88386 100644 --- a/ft/tests/test-checkpoint-during-merge.cc +++ b/ft/tests/test-checkpoint-during-merge.cc @@ -96,7 +96,7 @@ PATENT RIGHTS GRANT: #include #include "ft-flusher.h" #include "ft-flusher-internal.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" static TOKUTXN const null_txn = 0; diff --git a/ft/tests/test-checkpoint-during-rebalance.cc b/ft/tests/test-checkpoint-during-rebalance.cc index 03add082f..6446c2677 100644 --- a/ft/tests/test-checkpoint-during-rebalance.cc +++ b/ft/tests/test-checkpoint-during-rebalance.cc @@ -96,7 +96,7 @@ PATENT RIGHTS GRANT: #include #include "ft-flusher.h" #include "ft-flusher-internal.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" static TOKUTXN const null_txn = 0; diff --git a/ft/tests/test-checkpoint-during-split.cc b/ft/tests/test-checkpoint-during-split.cc index 2ab749858..94f174033 100644 --- a/ft/tests/test-checkpoint-during-split.cc +++ b/ft/tests/test-checkpoint-during-split.cc @@ -96,7 +96,7 @@ PATENT RIGHTS GRANT: #include #include "ft-flusher.h" #include "ft-flusher-internal.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" static TOKUTXN const null_txn = 0; diff --git a/ft/tests/test-dirty-flushes-on-cleaner.cc b/ft/tests/test-dirty-flushes-on-cleaner.cc index 332b86917..2c5b97a48 100644 --- a/ft/tests/test-dirty-flushes-on-cleaner.cc +++ b/ft/tests/test-dirty-flushes-on-cleaner.cc @@ -94,7 +94,7 @@ PATENT RIGHTS GRANT: #include #include "ft-flusher.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" static TOKUTXN const null_txn = 0; diff --git a/ft/tests/test-flushes-on-cleaner.cc b/ft/tests/test-flushes-on-cleaner.cc index b7f0edf7b..aba314efb 100644 --- a/ft/tests/test-flushes-on-cleaner.cc +++ b/ft/tests/test-flushes-on-cleaner.cc @@ -94,7 +94,7 @@ PATENT RIGHTS GRANT: #include #include "ft-flusher.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" static TOKUTXN const null_txn = 0; diff --git a/ft/tests/test-hot-with-bounds.cc b/ft/tests/test-hot-with-bounds.cc index af191232b..5966fe207 100644 --- a/ft/tests/test-hot-with-bounds.cc +++ b/ft/tests/test-hot-with-bounds.cc @@ -96,7 +96,7 @@ PATENT RIGHTS GRANT: #include #include "ft-flusher.h" #include "ft-flusher-internal.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" static TOKUTXN const null_txn = 0; diff --git a/ft/tests/test-merges-on-cleaner.cc b/ft/tests/test-merges-on-cleaner.cc index d4780db5f..437f33fcd 100644 --- a/ft/tests/test-merges-on-cleaner.cc +++ b/ft/tests/test-merges-on-cleaner.cc @@ -94,7 +94,7 @@ PATENT RIGHTS GRANT: #include #include "ft-flusher.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" static TOKUTXN const null_txn = 0; diff --git a/ft/tests/test-pick-child-to-flush.cc b/ft/tests/test-pick-child-to-flush.cc index 6203c9085..feadabd2b 100644 --- a/ft/tests/test-pick-child-to-flush.cc +++ b/ft/tests/test-pick-child-to-flush.cc @@ -97,7 +97,7 @@ PATENT RIGHTS GRANT: #include "ft-flusher.h" #include "ft-flusher-internal.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" static TOKUTXN const null_txn = 0; diff --git a/ft/tests/test-txn-child-manager.cc b/ft/tests/test-txn-child-manager.cc index 6ce44f0b3..258860318 100644 --- a/ft/tests/test-txn-child-manager.cc +++ b/ft/tests/test-txn-child-manager.cc @@ -92,7 +92,7 @@ PATENT RIGHTS GRANT: #include "test.h" #include "toku_os.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" #include "test-ft-txns.h" diff --git a/ft/tests/test.h b/ft/tests/test.h index cba8d96e2..19f44d784 100644 --- a/ft/tests/test.h +++ b/ft/tests/test.h @@ -103,8 +103,8 @@ PATENT RIGHTS GRANT: #include "ft/serialize/block_allocator.h" #include "ft/serialize/block_table.h" -#include "ft/cachetable.h" -#include "ft/cachetable-internal.h" +#include "ft/cachetable/cachetable.h" +#include "ft/cachetable/cachetable-internal.h" #include "ft/cursor.h" #include "ft/ft.h" #include "ft/ft-ops.h" diff --git a/ft/tests/test3681.cc b/ft/tests/test3681.cc index 2367c3d07..5e8f5b5e1 100644 --- a/ft/tests/test3681.cc +++ b/ft/tests/test3681.cc @@ -95,7 +95,7 @@ PATENT RIGHTS GRANT: // * Thread 1 calls apply_msg_to_in_memory_leaves, calls get_and_pin_if_in_memory, tries to get a read lock on the root node and blocks on the rwlock because there is a write request on the lock. -#include "checkpoint.h" +#include "cachetable/checkpoint.h" #include "test.h" CACHETABLE ct; diff --git a/ft/tests/test_rightmost_leaf_seqinsert_heuristic.cc b/ft/tests/test_rightmost_leaf_seqinsert_heuristic.cc index cb2e629f8..efa08d0c8 100644 --- a/ft/tests/test_rightmost_leaf_seqinsert_heuristic.cc +++ b/ft/tests/test_rightmost_leaf_seqinsert_heuristic.cc @@ -90,7 +90,7 @@ PATENT RIGHTS GRANT: #include "test.h" -#include +#include #include // Each FT maintains a sequential insert heuristic to determine if its diff --git a/ft/tests/test_rightmost_leaf_split_merge.cc b/ft/tests/test_rightmost_leaf_split_merge.cc index 4394217bf..caa01d83f 100644 --- a/ft/tests/test_rightmost_leaf_split_merge.cc +++ b/ft/tests/test_rightmost_leaf_split_merge.cc @@ -90,7 +90,7 @@ PATENT RIGHTS GRANT: #include "test.h" -#include +#include #include #include diff --git a/ft/tests/upgrade_test_simple.cc b/ft/tests/upgrade_test_simple.cc index d1ec3f7d3..fe3fd6049 100644 --- a/ft/tests/upgrade_test_simple.cc +++ b/ft/tests/upgrade_test_simple.cc @@ -97,7 +97,7 @@ PATENT RIGHTS GRANT: #include "ft-flusher.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" static TOKUTXN const null_txn = NULL; diff --git a/ft/tests/xid_lsn_independent.cc b/ft/tests/xid_lsn_independent.cc index 93762525a..43f810206 100644 --- a/ft/tests/xid_lsn_independent.cc +++ b/ft/tests/xid_lsn_independent.cc @@ -92,7 +92,7 @@ PATENT RIGHTS GRANT: #include "test.h" #include "toku_os.h" -#include "checkpoint.h" +#include "cachetable/checkpoint.h" #define ENVDIR TOKU_TEST_FILENAME #include "test-ft-txns.h" diff --git a/ft/tokuftdump.cc b/ft/tokuftdump.cc index e591bcec8..f6385b4f7 100644 --- a/ft/tokuftdump.cc +++ b/ft/tokuftdump.cc @@ -99,7 +99,7 @@ PATENT RIGHTS GRANT: #include #include "ft/serialize/block_table.h" -#include "ft/cachetable.h" +#include "ft/cachetable/cachetable.h" #include "ft/ft.h" #include "ft/ft-internal.h" #include "ft/serialize/ft-serialize.h" diff --git a/ft/roll.cc b/ft/txn/roll.cc similarity index 99% rename from ft/roll.cc rename to ft/txn/roll.cc index fd49dfd47..0d8855bb8 100644 --- a/ft/roll.cc +++ b/ft/txn/roll.cc @@ -96,8 +96,8 @@ PATENT RIGHTS GRANT: #include "ft/ft-ops.h" #include "ft/log_header.h" #include "ft/logger/log-internal.h" -#include "ft/xids.h" -#include "ft/rollback-apply.h" +#include "ft/txn/xids.h" +#include "ft/txn/rollback-apply.h" // functionality provided by roll.c is exposed by an autogenerated // header file, logheader.h diff --git a/ft/rollback-apply.cc b/ft/txn/rollback-apply.cc similarity index 99% rename from ft/rollback-apply.cc rename to ft/txn/rollback-apply.cc index 90157d85f..5bd531936 100644 --- a/ft/rollback-apply.cc +++ b/ft/txn/rollback-apply.cc @@ -90,7 +90,7 @@ PATENT RIGHTS GRANT: #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 "ft/logger/log-internal.h" -#include "ft/rollback-apply.h" +#include "ft/txn/rollback-apply.h" static void poll_txn_progress_function(TOKUTXN txn, uint8_t is_commit, uint8_t stall_for_checkpoint) { diff --git a/ft/rollback-apply.h b/ft/txn/rollback-apply.h similarity index 100% rename from ft/rollback-apply.h rename to ft/txn/rollback-apply.h diff --git a/ft/rollback-ct-callbacks.cc b/ft/txn/rollback-ct-callbacks.cc similarity index 99% rename from ft/rollback-ct-callbacks.cc rename to ft/txn/rollback-ct-callbacks.cc index e2810285b..cabf7cf54 100644 --- a/ft/rollback-ct-callbacks.cc +++ b/ft/txn/rollback-ct-callbacks.cc @@ -95,8 +95,8 @@ PATENT RIGHTS GRANT: #include "ft/serialize/block_table.h" #include "ft/ft-internal.h" #include "ft/serialize/ft_node-serialize.h" -#include "ft/rollback.h" -#include "ft/rollback-ct-callbacks.h" +#include "ft/txn/rollback.h" +#include "ft/txn/rollback-ct-callbacks.h" #include "util/memarena.h" diff --git a/ft/rollback-ct-callbacks.h b/ft/txn/rollback-ct-callbacks.h similarity index 99% rename from ft/rollback-ct-callbacks.h rename to ft/txn/rollback-ct-callbacks.h index 3c23473ed..4bcb004de 100644 --- a/ft/rollback-ct-callbacks.h +++ b/ft/txn/rollback-ct-callbacks.h @@ -92,7 +92,7 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 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 "ft/cachetable.h" +#include "ft/cachetable/cachetable.h" void toku_rollback_flush_callback(CACHEFILE cachefile, int fd, BLOCKNUM logname, void *rollback_v, void** UU(disk_data), void *extraargs, PAIR_ATTR size, PAIR_ATTR* new_size, bool write_me, bool keep_me, bool for_checkpoint, bool UU(is_clone)); int toku_rollback_fetch_callback(CACHEFILE cachefile, PAIR p, int fd, BLOCKNUM logname, uint32_t fullhash, void **rollback_pv, void** UU(disk_data), PAIR_ATTR *sizep, int * UU(dirtyp), void *extraargs); diff --git a/ft/rollback.cc b/ft/txn/rollback.cc similarity index 99% rename from ft/rollback.cc rename to ft/txn/rollback.cc index 9bdfbe6c9..15cd9054d 100644 --- a/ft/rollback.cc +++ b/ft/txn/rollback.cc @@ -94,7 +94,7 @@ PATENT RIGHTS GRANT: #include "ft/serialize/block_table.h" #include "ft/ft.h" #include "ft/logger/log-internal.h" -#include "ft/rollback-ct-callbacks.h" +#include "ft/txn/rollback-ct-callbacks.h" static void rollback_unpin_remove_callback(CACHEKEY* cachekey, bool for_checkpoint, void* extra) { FT CAST_FROM_VOIDP(ft, extra); diff --git a/ft/rollback.h b/ft/txn/rollback.h similarity index 99% rename from ft/rollback.h rename to ft/txn/rollback.h index d9b400b99..cddbe16c9 100644 --- a/ft/rollback.h +++ b/ft/txn/rollback.h @@ -92,9 +92,9 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 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 "ft/cachetable.h" +#include "ft/cachetable/cachetable.h" #include "ft/serialize/sub_block.h" -#include "ft/txn.h" +#include "ft/txn/txn.h" #include "util/memarena.h" diff --git a/ft/rollback_log_node_cache.cc b/ft/txn/rollback_log_node_cache.cc similarity index 99% rename from ft/rollback_log_node_cache.cc rename to ft/txn/rollback_log_node_cache.cc index d3ea34714..fca18702d 100644 --- a/ft/rollback_log_node_cache.cc +++ b/ft/txn/rollback_log_node_cache.cc @@ -92,7 +92,7 @@ PATENT RIGHTS GRANT: #include #include -#include "rollback_log_node_cache.h" +#include "txn/rollback_log_node_cache.h" void rollback_log_node_cache::init (uint32_t max_num_avail_nodes) { XMALLOC_N(max_num_avail_nodes, m_avail_blocknums); diff --git a/ft/rollback_log_node_cache.h b/ft/txn/rollback_log_node_cache.h similarity index 99% rename from ft/rollback_log_node_cache.h rename to ft/txn/rollback_log_node_cache.h index 8b2342505..baafcf979 100644 --- a/ft/rollback_log_node_cache.h +++ b/ft/txn/rollback_log_node_cache.h @@ -92,7 +92,7 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 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 "rollback.h" +#include "ft/txn/rollback.h" class rollback_log_node_cache { public: diff --git a/ft/txn.cc b/ft/txn/txn.cc similarity index 99% rename from ft/txn.cc rename to ft/txn/txn.cc index 90b8a1a3e..29890ad18 100644 --- a/ft/txn.cc +++ b/ft/txn/txn.cc @@ -90,13 +90,13 @@ PATENT RIGHTS GRANT: #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 "ft/checkpoint.h" +#include "ft/cachetable/checkpoint.h" #include "ft/ft.h" #include "ft/logger/log-internal.h" #include "ft/ule.h" -#include "ft/rollback-apply.h" -#include "ft/txn.h" -#include "ft/txn_manager.h" +#include "ft/txn/rollback-apply.h" +#include "ft/txn/txn.h" +#include "ft/txn/txn_manager.h" #include "util/status.h" /////////////////////////////////////////////////////////////////////////////////// diff --git a/ft/txn.h b/ft/txn/txn.h similarity index 99% rename from ft/txn.h rename to ft/txn/txn.h index a9380b0cb..b96e9b8f1 100644 --- a/ft/txn.h +++ b/ft/txn/txn.h @@ -94,7 +94,7 @@ PATENT RIGHTS GRANT: #include "portability/toku_stdint.h" -#include "ft/txn_state.h" +#include "ft/txn/txn_state.h" #include "ft/serialize/block_table.h" #include "util/omt.h" @@ -114,7 +114,7 @@ typedef struct txnid_pair_s { static const TXNID_PAIR TXNID_PAIR_NONE = { .parent_id64 = TXNID_NONE, .child_id64 = TXNID_NONE }; // We include the child manager here beacuse it uses the TXNID / TOKUTXN types -#include "ft/txn_child_manager.h" +#include "ft/txn/txn_child_manager.h" /* Log Sequence Number (LSN) * Make the LSN be a struct instead of an integer so that we get better type checking. */ diff --git a/ft/txn_child_manager.cc b/ft/txn/txn_child_manager.cc similarity index 99% rename from ft/txn_child_manager.cc rename to ft/txn/txn_child_manager.cc index fb71c346e..1282aea2e 100644 --- a/ft/txn_child_manager.cc +++ b/ft/txn/txn_child_manager.cc @@ -90,7 +90,7 @@ PATENT RIGHTS GRANT: #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 "ft/logger/log-internal.h" -#include "ft/txn_child_manager.h" +#include "ft/txn/txn_child_manager.h" // // initialized a txn_child_manager, diff --git a/ft/txn_child_manager.h b/ft/txn/txn_child_manager.h similarity index 97% rename from ft/txn_child_manager.h rename to ft/txn/txn_child_manager.h index efc6b3531..81136b02c 100644 --- a/ft/txn_child_manager.h +++ b/ft/txn/txn_child_manager.h @@ -1,7 +1,7 @@ /* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ // vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: -#ident "$Id: rollback.h 49033 2012-10-17 18:48:30Z zardosht $" +#ident "$Id: txn/rollback.h 49033 2012-10-17 18:48:30Z zardosht $" /* COPYING CONDITIONS NOTICE: @@ -89,7 +89,7 @@ PATENT RIGHTS GRANT: #pragma once -// We should be including ft/txn.h here but that header includes this one, +// We should be including ft/txn/txn.h here but that header includes this one, // so we don't. #include "portability/toku_pthread.h" diff --git a/ft/txn_manager.cc b/ft/txn/txn_manager.cc similarity index 99% rename from ft/txn_manager.cc rename to ft/txn/txn_manager.cc index 8da99aa20..b9bbddf5e 100644 --- a/ft/txn_manager.cc +++ b/ft/txn/txn_manager.cc @@ -91,12 +91,12 @@ PATENT RIGHTS GRANT: #include "portability/toku_race_tools.h" -#include "ft/checkpoint.h" +#include "ft/cachetable/checkpoint.h" #include "ft/logger/log-internal.h" #include "ft/ule.h" -#include "ft/txn.h" -#include "ft/txn_manager.h" -#include "ft/rollback.h" +#include "ft/txn/txn.h" +#include "ft/txn/txn_manager.h" +#include "ft/txn/rollback.h" #include "util/omt.h" bool garbage_collection_debug = false; diff --git a/ft/txn_manager.h b/ft/txn/txn_manager.h similarity index 99% rename from ft/txn_manager.h rename to ft/txn/txn_manager.h index a94a00351..c9fa158aa 100644 --- a/ft/txn_manager.h +++ b/ft/txn/txn_manager.h @@ -95,7 +95,7 @@ PATENT RIGHTS GRANT: #include "portability/toku_portability.h" #include "portability/toku_pthread.h" -#include "ft/txn.h" +#include "ft/txn/txn.h" typedef struct txn_manager *TXN_MANAGER; diff --git a/ft/txn_state.h b/ft/txn/txn_state.h similarity index 100% rename from ft/txn_state.h rename to ft/txn/txn_state.h diff --git a/ft/xids.cc b/ft/txn/xids.cc similarity index 99% rename from ft/xids.cc rename to ft/txn/xids.cc index 9d6293770..2d80192df 100644 --- a/ft/xids.cc +++ b/ft/txn/xids.cc @@ -109,7 +109,7 @@ PATENT RIGHTS GRANT: #include "portability/toku_htod.h" #include "portability/toku_portability.h" -#include "ft/xids.h" +#include "ft/txn/xids.h" ///////////////////////////////////////////////////////////////////////////////// // This layer of abstraction (xids_xxx) understands xids<> and nothing else. diff --git a/ft/xids.h b/ft/txn/xids.h similarity index 99% rename from ft/xids.h rename to ft/txn/xids.h index 4e37cb9a7..894c369a1 100644 --- a/ft/xids.h +++ b/ft/txn/xids.h @@ -103,7 +103,7 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 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 "ft/txn.h" +#include "ft/txn/txn.h" #include "ft/serialize/rbuf.h" #include "ft/serialize/wbuf.h" diff --git a/ft/ule.cc b/ft/ule.cc index 4c5ca3785..569c2d1ff 100644 --- a/ft/ule.cc +++ b/ft/ule.cc @@ -108,11 +108,11 @@ PATENT RIGHTS GRANT: #include "ft/leafentry.h" #include "ft/logger/logger.h" #include "ft/msg.h" -#include "ft/txn.h" -#include "ft/txn_manager.h" +#include "ft/txn/txn.h" +#include "ft/txn/txn_manager.h" #include "ft/ule.h" #include "ft/ule-internal.h" -#include "ft/xids.h" +#include "ft/txn/xids.h" #include "util/bytestring.h" #include "util/omt.h" #include "util/partitioned_counter.h" diff --git a/ft/ule.h b/ft/ule.h index 1441e39c7..2468d2c32 100644 --- a/ft/ule.h +++ b/ft/ule.h @@ -98,7 +98,7 @@ PATENT RIGHTS GRANT: #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 "leafentry.h" -#include "txn_manager.h" +#include "txn/txn_manager.h" #include void toku_ule_status_init(void); diff --git a/locktree/keyrange.cc b/locktree/keyrange.cc index 197e250ae..c44260c03 100644 --- a/locktree/keyrange.cc +++ b/locktree/keyrange.cc @@ -91,165 +91,165 @@ PATENT RIGHTS GRANT: #include "keyrange.h" -#include +#include namespace toku { -// create a keyrange by borrowing the left and right dbt -// pointers. no memory is copied. no checks for infinity needed. -void keyrange::create(const DBT *left, const DBT *right) { - init_empty(); - m_left_key = left; - m_right_key = right; -} - -// destroy the key copies. if they were never set, then destroy does nothing. -void keyrange::destroy(void) { - toku_destroy_dbt(&m_left_key_copy); - toku_destroy_dbt(&m_right_key_copy); -} - -// create a keyrange by copying the keys from the given range. -void keyrange::create_copy(const keyrange &range) { - // start with an initialized, empty range - init_empty(); - - // optimize the case where the left and right keys are the same. - // we'd like to only have one copy of the data. - if (toku_dbt_equals(range.get_left_key(), range.get_right_key())) { - set_both_keys(range.get_left_key()); - } else { - // replace our empty left and right keys with - // copies of the range's left and right keys - replace_left_key(range.get_left_key()); - replace_right_key(range.get_right_key()); + // create a keyrange by borrowing the left and right dbt + // pointers. no memory is copied. no checks for infinity needed. + void keyrange::create(const DBT *left, const DBT *right) { + init_empty(); + m_left_key = left; + m_right_key = right; } -} - -// extend this keyrange by choosing the leftmost and rightmost -// endpoints between this range and the given. replaced keys -// in this range are freed and inherited keys are copied. -void keyrange::extend(const comparator &cmp, const keyrange &range) { - const DBT *range_left = range.get_left_key(); - const DBT *range_right = range.get_right_key(); - if (cmp(range_left, get_left_key()) < 0) { - replace_left_key(range_left); + + // destroy the key copies. if they were never set, then destroy does nothing. + void keyrange::destroy(void) { + toku_destroy_dbt(&m_left_key_copy); + toku_destroy_dbt(&m_right_key_copy); } - if (cmp(range_right, get_right_key()) > 0) { - replace_right_key(range_right); + + // create a keyrange by copying the keys from the given range. + void keyrange::create_copy(const keyrange &range) { + // start with an initialized, empty range + init_empty(); + + // optimize the case where the left and right keys are the same. + // we'd like to only have one copy of the data. + if (toku_dbt_equals(range.get_left_key(), range.get_right_key())) { + set_both_keys(range.get_left_key()); + } else { + // replace our empty left and right keys with + // copies of the range's left and right keys + replace_left_key(range.get_left_key()); + replace_right_key(range.get_right_key()); + } } -} - -// how much memory does this keyrange take? -// - the size of the left and right keys -// --- ignore the fact that we may have optimized the point case. -// it complicates things for little gain. -// - the size of the keyrange class itself -uint64_t keyrange::get_memory_size(void) const { - const DBT *left_key = get_left_key(); - const DBT *right_key = get_right_key(); - return left_key->size + right_key->size + sizeof(keyrange); -} - -// compare ranges. -keyrange::comparison keyrange::compare(const comparator &cmp, const keyrange &range) const { - if (cmp(get_right_key(), range.get_left_key()) < 0) { - return comparison::LESS_THAN; - } else if (cmp(get_left_key(), range.get_right_key()) > 0) { - return comparison::GREATER_THAN; - } else if (cmp(get_left_key(), range.get_left_key()) == 0 && - cmp(get_right_key(), range.get_right_key()) == 0) { - return comparison::EQUALS; - } else { - return comparison::OVERLAPS; + + // extend this keyrange by choosing the leftmost and rightmost + // endpoints between this range and the given. replaced keys + // in this range are freed and inherited keys are copied. + void keyrange::extend(const comparator &cmp, const keyrange &range) { + const DBT *range_left = range.get_left_key(); + const DBT *range_right = range.get_right_key(); + if (cmp(range_left, get_left_key()) < 0) { + replace_left_key(range_left); + } + if (cmp(range_right, get_right_key()) > 0) { + replace_right_key(range_right); + } } -} - -bool keyrange::overlaps(const comparator &cmp, const keyrange &range) const { - // equality is a stronger form of overlapping. - // so two ranges "overlap" if they're either equal or just overlapping. - comparison c = compare(cmp, range); - return c == comparison::EQUALS || c == comparison::OVERLAPS; -} - -keyrange keyrange::get_infinite_range(void) { - keyrange range; - range.create(toku_dbt_negative_infinity(), toku_dbt_positive_infinity()); - return range; -} - -void keyrange::init_empty(void) { - m_left_key = nullptr; - m_right_key = nullptr; - toku_init_dbt(&m_left_key_copy); - toku_init_dbt(&m_right_key_copy); - m_point_range = false; -} - -const DBT *keyrange::get_left_key(void) const { - if (m_left_key) { - return m_left_key; - } else { - return &m_left_key_copy; + + // how much memory does this keyrange take? + // - the size of the left and right keys + // --- ignore the fact that we may have optimized the point case. + // it complicates things for little gain. + // - the size of the keyrange class itself + uint64_t keyrange::get_memory_size(void) const { + const DBT *left_key = get_left_key(); + const DBT *right_key = get_right_key(); + return left_key->size + right_key->size + sizeof(keyrange); } -} -const DBT *keyrange::get_right_key(void) const { - if (m_right_key) { - return m_right_key; - } else { - return &m_right_key_copy; + // compare ranges. + keyrange::comparison keyrange::compare(const comparator &cmp, const keyrange &range) const { + if (cmp(get_right_key(), range.get_left_key()) < 0) { + return comparison::LESS_THAN; + } else if (cmp(get_left_key(), range.get_right_key()) > 0) { + return comparison::GREATER_THAN; + } else if (cmp(get_left_key(), range.get_left_key()) == 0 && + cmp(get_right_key(), range.get_right_key()) == 0) { + return comparison::EQUALS; + } else { + return comparison::OVERLAPS; + } } -} - -// copy the given once and set both the left and right pointers. -// optimization for point ranges, so the left and right ranges -// are not copied twice. -void keyrange::set_both_keys(const DBT *key) { - if (toku_dbt_is_infinite(key)) { - m_left_key = key; - m_right_key = key; - } else { - toku_clone_dbt(&m_left_key_copy, *key); - toku_copyref_dbt(&m_right_key_copy, m_left_key_copy); + + bool keyrange::overlaps(const comparator &cmp, const keyrange &range) const { + // equality is a stronger form of overlapping. + // so two ranges "overlap" if they're either equal or just overlapping. + comparison c = compare(cmp, range); + return c == comparison::EQUALS || c == comparison::OVERLAPS; } - m_point_range = true; -} - -// destroy the current left key. set and possibly copy the new one -void keyrange::replace_left_key(const DBT *key) { - // a little magic: - // - // if this is a point range, then the left and right keys share - // one copy of the data, and it lives in the left key copy. so - // if we're replacing the left key, move the real data to the - // right key copy instead of destroying it. now, the memory is - // owned by the right key and the left key may be replaced. - if (m_point_range) { - m_right_key_copy = m_left_key_copy; - } else { - toku_destroy_dbt(&m_left_key_copy); + + keyrange keyrange::get_infinite_range(void) { + keyrange range; + range.create(toku_dbt_negative_infinity(), toku_dbt_positive_infinity()); + return range; } - if (toku_dbt_is_infinite(key)) { - m_left_key = key; - } else { - toku_clone_dbt(&m_left_key_copy, *key); + void keyrange::init_empty(void) { m_left_key = nullptr; - } - m_point_range = false; -} - -// destroy the current right key. set and possibly copy the new one -void keyrange::replace_right_key(const DBT *key) { - toku_destroy_dbt(&m_right_key_copy); - if (toku_dbt_is_infinite(key)) { - m_right_key = key; - } else { - toku_clone_dbt(&m_right_key_copy, *key); m_right_key = nullptr; + toku_init_dbt(&m_left_key_copy); + toku_init_dbt(&m_right_key_copy); + m_point_range = false; + } + + const DBT *keyrange::get_left_key(void) const { + if (m_left_key) { + return m_left_key; + } else { + return &m_left_key_copy; + } + } + + const DBT *keyrange::get_right_key(void) const { + if (m_right_key) { + return m_right_key; + } else { + return &m_right_key_copy; + } + } + + // copy the given once and set both the left and right pointers. + // optimization for point ranges, so the left and right ranges + // are not copied twice. + void keyrange::set_both_keys(const DBT *key) { + if (toku_dbt_is_infinite(key)) { + m_left_key = key; + m_right_key = key; + } else { + toku_clone_dbt(&m_left_key_copy, *key); + toku_copyref_dbt(&m_right_key_copy, m_left_key_copy); + } + m_point_range = true; + } + + // destroy the current left key. set and possibly copy the new one + void keyrange::replace_left_key(const DBT *key) { + // a little magic: + // + // if this is a point range, then the left and right keys share + // one copy of the data, and it lives in the left key copy. so + // if we're replacing the left key, move the real data to the + // right key copy instead of destroying it. now, the memory is + // owned by the right key and the left key may be replaced. + if (m_point_range) { + m_right_key_copy = m_left_key_copy; + } else { + toku_destroy_dbt(&m_left_key_copy); + } + + if (toku_dbt_is_infinite(key)) { + m_left_key = key; + } else { + toku_clone_dbt(&m_left_key_copy, *key); + m_left_key = nullptr; + } + m_point_range = false; + } + + // destroy the current right key. set and possibly copy the new one + void keyrange::replace_right_key(const DBT *key) { + toku_destroy_dbt(&m_right_key_copy); + if (toku_dbt_is_infinite(key)) { + m_right_key = key; + } else { + toku_clone_dbt(&m_right_key_copy, *key); + m_right_key = nullptr; + } + m_point_range = false; } - m_point_range = false; -} } /* namespace toku */ diff --git a/locktree/lock_request.cc b/locktree/lock_request.cc index 66ae43a42..3272f012b 100644 --- a/locktree/lock_request.cc +++ b/locktree/lock_request.cc @@ -89,13 +89,12 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 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 +#include "portability/toku_race_tools.h" -#include -#include - -#include "locktree.h" -#include "lock_request.h" +#include "ft/txn/txn.h" +#include "locktree/locktree.h" +#include "locktree/lock_request.h" +#include "util/dbt.h" namespace toku { diff --git a/locktree/range_buffer.cc b/locktree/range_buffer.cc index e33e6e842..acf3422ce 100644 --- a/locktree/range_buffer.cc +++ b/locktree/range_buffer.cc @@ -89,11 +89,12 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 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 #include -#include -#include "range_buffer.h" +#include "portability/memory.h" + +#include "locktree/range_buffer.h" +#include "util/dbt.h" namespace toku { diff --git a/locktree/range_buffer.h b/locktree/range_buffer.h index 845d6c98c..edd312110 100644 --- a/locktree/range_buffer.h +++ b/locktree/range_buffer.h @@ -91,8 +91,9 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 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 "ft/ybt.h" #include "portability/toku_stdint.h" + +#include "util/dbt.h" #include "util/memarena.h" namespace toku { diff --git a/locktree/tests/test.h b/locktree/tests/test.h index c5bf06a29..dc1eb2f5a 100644 --- a/locktree/tests/test.h +++ b/locktree/tests/test.h @@ -94,7 +94,7 @@ PATENT RIGHTS GRANT: #include #include "ft/comparator.h" -#include "ft/ybt.h" +#include "util/dbt.h" namespace toku { diff --git a/locktree/treenode.h b/locktree/treenode.h index 44c95e908..a83699d5d 100644 --- a/locktree/treenode.h +++ b/locktree/treenode.h @@ -91,15 +91,14 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 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 #include -#include -#include +#include "portability/memory.h" +#include "portability/toku_pthread.h" -#include - -#include "keyrange.h" +#include "ft/comparator.h" +#include "ft/txn/txn.h" +#include "locktree/keyrange.h" namespace toku { diff --git a/locktree/txnid_set.h b/locktree/txnid_set.h index 31b0a1990..0dfed5751 100644 --- a/locktree/txnid_set.h +++ b/locktree/txnid_set.h @@ -91,7 +91,7 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 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 "ft/txn.h" +#include "ft/txn/txn.h" #include "util/omt.h" diff --git a/src/indexer-internal.h b/src/indexer-internal.h index fb06c8f83..c3a00cef2 100644 --- a/src/indexer-internal.h +++ b/src/indexer-internal.h @@ -91,7 +91,7 @@ PATENT RIGHTS GRANT: #pragma once -#include +#include #include // the indexer_commit_keys is an ordered set of keys described by a DBT in the keys array. diff --git a/src/indexer-undo-do.cc b/src/indexer-undo-do.cc index b18efbed2..a97064119 100644 --- a/src/indexer-undo-do.cc +++ b/src/indexer-undo-do.cc @@ -99,9 +99,9 @@ PATENT RIGHTS GRANT: #include #include #include -#include -#include -#include +#include +#include +#include #include "ydb-internal.h" #include "ydb_row_lock.h" diff --git a/src/indexer.cc b/src/indexer.cc index 6d81b70da..926bf5c57 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -102,9 +102,9 @@ PATENT RIGHTS GRANT: #include #include #include -#include +#include #include -#include +#include #include #include "loader.h" #include diff --git a/src/loader.cc b/src/loader.cc index 0805b2d7d..1550af346 100644 --- a/src/loader.cc +++ b/src/loader.cc @@ -100,7 +100,7 @@ PATENT RIGHTS GRANT: #include #include -#include +#include #include "ydb-internal.h" #include "ydb_db.h" diff --git a/src/tests/blackhole.cc b/src/tests/blackhole.cc index 267eb8c1b..bf15283d0 100644 --- a/src/tests/blackhole.cc +++ b/src/tests/blackhole.cc @@ -92,7 +92,7 @@ PATENT RIGHTS GRANT: // Test that a db ignores insert messages in blackhole mode #include "test.h" -#include +#include static DB *db; static DB *blackhole_db; diff --git a/src/tests/hotindexer-undo-do-test.cc b/src/tests/hotindexer-undo-do-test.cc index a478666d8..9aa3ea1fc 100644 --- a/src/tests/hotindexer-undo-do-test.cc +++ b/src/tests/hotindexer-undo-do-test.cc @@ -95,11 +95,10 @@ PATENT RIGHTS GRANT: #include "test.h" -#include #include #include #include -#include +#include #include "indexer-internal.h" diff --git a/src/tests/test_txn_nested1.cc b/src/tests/test_txn_nested1.cc index 4b95a6466..748c6e447 100644 --- a/src/tests/test_txn_nested1.cc +++ b/src/tests/test_txn_nested1.cc @@ -95,7 +95,7 @@ PATENT RIGHTS GRANT: #include #include #include -#include +#include #define MAX_NEST MAX_NESTED_TRANSACTIONS diff --git a/src/tests/test_txn_nested2.cc b/src/tests/test_txn_nested2.cc index 8caa98e73..3cd2164d9 100644 --- a/src/tests/test_txn_nested2.cc +++ b/src/tests/test_txn_nested2.cc @@ -87,15 +87,18 @@ PATENT RIGHTS GRANT: */ #ident "Copyright (c) 2009-2013 Tokutek Inc. All rights reserved." -#include "test.h" -#include +#include +#include #include #include #include #include -#include -#include + +#include "src/tests/test.h" + +#include + #define MAX_NEST MAX_TRANSACTION_RECORDS #define MAX_SIZE MAX_TRANSACTION_RECORDS diff --git a/src/tests/test_txn_nested3.cc b/src/tests/test_txn_nested3.cc index 082a1dc87..0e74b0856 100644 --- a/src/tests/test_txn_nested3.cc +++ b/src/tests/test_txn_nested3.cc @@ -95,7 +95,7 @@ PATENT RIGHTS GRANT: #include #include #include -#include +#include #define MAX_NEST MAX_TRANSACTION_RECORDS #define MAX_SIZE MAX_TRANSACTION_RECORDS diff --git a/src/tests/test_txn_nested4.cc b/src/tests/test_txn_nested4.cc index 6f8c7a984..9b0645645 100644 --- a/src/tests/test_txn_nested4.cc +++ b/src/tests/test_txn_nested4.cc @@ -95,7 +95,7 @@ PATENT RIGHTS GRANT: #include #include #include -#include +#include #define MAX_NEST MAX_TRANSACTION_RECORDS #define MAX_SIZE MAX_TRANSACTION_RECORDS diff --git a/src/tests/test_txn_nested5.cc b/src/tests/test_txn_nested5.cc index 6009e3b4f..0f90c96bc 100644 --- a/src/tests/test_txn_nested5.cc +++ b/src/tests/test_txn_nested5.cc @@ -95,7 +95,7 @@ PATENT RIGHTS GRANT: #include #include #include -#include +#include #define MAX_NEST MAX_TRANSACTION_RECORDS #define MAX_SIZE (MAX_TRANSACTION_RECORDS + 1) diff --git a/src/tests/threaded_stress_test_helpers.h b/src/tests/threaded_stress_test_helpers.h index d587fbdf6..0fda39a50 100644 --- a/src/tests/threaded_stress_test_helpers.h +++ b/src/tests/threaded_stress_test_helpers.h @@ -122,7 +122,7 @@ PATENT RIGHTS GRANT: #include -#include +#include #include #include diff --git a/src/ydb-internal.h b/src/ydb-internal.h index 08fb4a26f..60be5338e 100644 --- a/src/ydb-internal.h +++ b/src/ydb-internal.h @@ -94,11 +94,11 @@ PATENT RIGHTS GRANT: #include #include -#include +#include #include #include #include -#include +#include #include #include diff --git a/src/ydb.cc b/src/ydb.cc index 9b527538a..4eeadfefc 100644 --- a/src/ydb.cc +++ b/src/ydb.cc @@ -103,13 +103,13 @@ const char *toku_copyright_string = "Copyright (c) 2007-2013 Tokutek Inc. All r #include "portability/toku_stdlib.h" #include "ft/ft-flusher.h" -#include "ft/cachetable.h" +#include "ft/cachetable/cachetable.h" +#include "ft/cachetable/checkpoint.h" #include "ft/logger/log.h" -#include "ft/checkpoint.h" #include "ft/loader/loader.h" #include "ft/log_header.h" #include "ft/ft.h" -#include "ft/txn_manager.h" +#include "ft/txn/txn_manager.h" #include "src/ydb.h" #include "src/ydb-internal.h" #include "src/ydb_cursor.h" diff --git a/src/ydb_db.cc b/src/ydb_db.cc index f3cc74be4..f33d965c9 100644 --- a/src/ydb_db.cc +++ b/src/ydb_db.cc @@ -95,7 +95,7 @@ PATENT RIGHTS GRANT: #include #include #include -#include +#include #include "ydb_cursor.h" #include "ydb_row_lock.h" diff --git a/src/ydb_env_func.cc b/src/ydb_env_func.cc index 550f853c2..3714b55c7 100644 --- a/src/ydb_env_func.cc +++ b/src/ydb_env_func.cc @@ -94,11 +94,11 @@ PATENT RIGHTS GRANT: #include #include +#include #include #include #include -#include -#include +#include #include #include "ydb_env_func.h" diff --git a/src/ydb_txn.cc b/src/ydb_txn.cc index 6f1105412..e513f0da0 100644 --- a/src/ydb_txn.cc +++ b/src/ydb_txn.cc @@ -89,15 +89,17 @@ PATENT RIGHTS GRANT: #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 "$Id$" -#include #include -#include -#include -#include +#include #include +#include +#include +#include + + #include "ydb-internal.h" #include "ydb_txn.h" #include "ydb_row_lock.h" diff --git a/src/ydb_write.cc b/src/ydb_write.cc index 62badd491..a0d355eb9 100644 --- a/src/ydb_write.cc +++ b/src/ydb_write.cc @@ -93,7 +93,7 @@ PATENT RIGHTS GRANT: #include "ydb-internal.h" #include "indexer.h" #include -#include +#include #include "ydb_row_lock.h" #include "ydb_write.h" #include "ydb_db.h" diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index 3af867238..6f6b899e5 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -1,5 +1,6 @@ set(util_srcs context + dbt frwlock kibbutz memarena diff --git a/ft/ybt.cc b/util/dbt.cc similarity index 93% rename from ft/ybt.cc rename to util/dbt.cc index 4e0fd2b94..99d5371a6 100644 --- a/ft/ybt.cc +++ b/util/dbt.cc @@ -94,29 +94,25 @@ PATENT RIGHTS GRANT: #include "portability/memory.h" -#include "ft/ybt.h" +#include "util/dbt.h" -DBT * -toku_init_dbt(DBT *dbt) { +DBT *toku_init_dbt(DBT *dbt) { memset(dbt, 0, sizeof(*dbt)); return dbt; } -DBT -toku_empty_dbt(void) { +DBT toku_empty_dbt(void) { static const DBT empty_dbt = { .data = 0, .size = 0, .ulen = 0, .flags = 0 }; return empty_dbt; } -DBT * -toku_init_dbt_flags(DBT *dbt, uint32_t flags) { +DBT *toku_init_dbt_flags(DBT *dbt, uint32_t flags) { toku_init_dbt(dbt); dbt->flags = flags; return dbt; } -DBT_ARRAY * -toku_dbt_array_init(DBT_ARRAY *dbts, uint32_t size) { +DBT_ARRAY *toku_dbt_array_init(DBT_ARRAY *dbts, uint32_t size) { uint32_t capacity = 1; while (capacity < size) { capacity *= 2; } @@ -129,8 +125,7 @@ toku_dbt_array_init(DBT_ARRAY *dbts, uint32_t size) { return dbts; } -void -toku_dbt_array_resize(DBT_ARRAY *dbts, uint32_t size) { +void toku_dbt_array_resize(DBT_ARRAY *dbts, uint32_t size) { if (size != dbts->size) { if (size > dbts->capacity) { const uint32_t old_capacity = dbts->capacity; @@ -158,14 +153,12 @@ toku_dbt_array_resize(DBT_ARRAY *dbts, uint32_t size) { } } -void -toku_dbt_array_destroy_shallow(DBT_ARRAY *dbts) { +void toku_dbt_array_destroy_shallow(DBT_ARRAY *dbts) { toku_free(dbts->dbts); ZERO_STRUCT(*dbts); } -void -toku_dbt_array_destroy(DBT_ARRAY *dbts) { +void toku_dbt_array_destroy(DBT_ARRAY *dbts) { for (uint32_t i = 0; i < dbts->capacity; i++) { toku_destroy_dbt(&dbts->dbts[i]); } @@ -174,8 +167,7 @@ toku_dbt_array_destroy(DBT_ARRAY *dbts) { -void -toku_destroy_dbt(DBT *dbt) { +void toku_destroy_dbt(DBT *dbt) { switch (dbt->flags) { case DB_DBT_MALLOC: case DB_DBT_REALLOC: @@ -185,8 +177,7 @@ toku_destroy_dbt(DBT *dbt) { } } -DBT * -toku_fill_dbt(DBT *dbt, const void *k, uint32_t len) { +DBT *toku_fill_dbt(DBT *dbt, const void *k, uint32_t len) { toku_init_dbt(dbt); dbt->size=len; dbt->data=(char*)k; @@ -218,8 +209,7 @@ toku_sdbt_cleanup(struct simple_dbt *sdbt) { memset(sdbt, 0, sizeof(*sdbt)); } -static inline int -sdbt_realloc(struct simple_dbt *sdbt) { +static inline int sdbt_realloc(struct simple_dbt *sdbt) { void *new_data = toku_realloc(sdbt->data, sdbt->len); int r; if (new_data == NULL) { @@ -231,8 +221,7 @@ sdbt_realloc(struct simple_dbt *sdbt) { return r; } -static inline int -dbt_realloc(DBT *dbt) { +static inline int dbt_realloc(DBT *dbt) { void *new_data = toku_realloc(dbt->data, dbt->ulen); int r; if (new_data == NULL) { @@ -244,13 +233,13 @@ dbt_realloc(DBT *dbt) { return r; } -int -toku_dbt_set (uint32_t len, const void *val, DBT *d, struct simple_dbt *sdbt) { // sdbt is the static value used when flags==0 // Otherwise malloc or use the user-supplied memory, as according to the flags in d->flags. +int toku_dbt_set(uint32_t len, const void *val, DBT *d, struct simple_dbt *sdbt) { int r; - if (!d) r = 0; - else { + if (d == nullptr) { + r = 0; + } else { switch (d->flags) { case (DB_DBT_USERMEM): d->size = len; diff --git a/ft/ybt.h b/util/dbt.h similarity index 99% rename from ft/ybt.h rename to util/dbt.h index 480790dcd..9d8329e78 100644 --- a/ft/ybt.h +++ b/util/dbt.h @@ -117,7 +117,7 @@ DBT *toku_clone_dbt(DBT *dst, const DBT &src); int toku_dbt_set(uint32_t len, const void *val, DBT *d, struct simple_dbt *sdbt); -int toku_dbt_set_value(DBT *, const void **val, uint32_t vallen, void **staticptrp, bool ybt1_disposable); +int toku_dbt_set_value(DBT *, const void **val, uint32_t vallen, void **staticptrp, bool dbt1_disposable); void toku_sdbt_cleanup(struct simple_dbt *sdbt);