2007-07-13 19:37:47 +00:00
# ifndef BRTTYPES_H
# define BRTTYPES_H
2007-11-29 14:18:54 +00:00
2013-04-16 23:57:48 -04:00
# ident "$Id$"
2013-04-16 23:59:09 -04:00
# ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
2013-04-16 23:57:48 -04:00
# 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."
2007-11-29 14:18:54 +00:00
2007-11-14 17:58:38 +00:00
# include <sys/types.h>
2008-01-15 13:04:10 +00:00
# ifndef _XOPEN_SOURCE
2007-07-13 19:37:47 +00:00
# define _XOPEN_SOURCE 500
2008-01-15 13:04:10 +00:00
# endif
2007-07-13 19:37:47 +00:00
# define _FILE_OFFSET_BITS 64
2007-11-21 13:07:49 +00:00
2013-04-16 23:57:48 -04:00
# include <db.h>
2013-04-16 23:57:18 -04:00
# include <inttypes.h>
2008-02-29 20:47:11 +00:00
2013-04-16 23:59:09 -04:00
# if defined(__cplusplus) || defined(__cilkplusplus)
extern " C " {
# endif
2007-11-21 13:07:49 +00:00
typedef struct brt * BRT ;
struct brt_header ;
struct wbuf ;
2013-04-16 23:58:04 -04:00
typedef struct descriptor {
u_int32_t version ;
DBT dbt ;
} * DESCRIPTOR , DESCRIPTOR_S ;
2007-07-13 19:37:47 +00:00
typedef unsigned int ITEMLEN ;
typedef const void * bytevec ;
//typedef const void *bytevec;
2007-09-28 17:11:22 +00:00
2013-04-16 23:57:18 -04:00
typedef int64_t DISKOFF ; /* Offset in a disk. -1 is the NULL pointer. */
2007-11-22 20:30:38 +00:00
typedef u_int64_t TXNID ;
2013-04-16 23:57:56 -04:00
# define TXNID_NONE_LIVING ((TXNID)0)
2013-04-16 23:59:01 -04:00
# define TXNID_NONE ((TXNID)0)
2013-04-16 23:57:56 -04:00
2013-04-16 23:57:18 -04:00
typedef struct s_blocknum { int64_t b ; } BLOCKNUM ; // make a struct so that we will notice type problems.
2013-04-16 23:59:05 -04:00
# define ROLLBACK_NONE ((BLOCKNUM){0})
2013-04-16 23:57:18 -04:00
static inline BLOCKNUM make_blocknum ( int64_t b ) { BLOCKNUM result = { b } ; return result ; }
2007-09-28 17:11:22 +00:00
2007-11-22 07:13:08 +00:00
typedef struct {
2008-04-02 23:40:36 +00:00
u_int32_t len ;
2007-11-22 07:13:08 +00:00
char * data ;
2007-11-22 20:30:38 +00:00
} BYTESTRING ;
2007-11-22 07:13:08 +00:00
2007-11-14 17:58:38 +00:00
/* Make the LSN be a struct instead of an integer so that we get better type checking. */
typedef struct __toku_lsn { u_int64_t lsn ; } LSN ;
# define ZERO_LSN ((LSN){0})
2013-04-16 23:57:56 -04:00
# define MAX_LSN ((LSN){UINT64_MAX})
2007-11-14 17:58:38 +00:00
2013-04-16 23:59:01 -04:00
/* At the brt layer, a FILENUM uniquely identifies an open file.
* At the ydb layer , a DICTIONARY_ID uniquely identifies an open dictionary .
* With the introduction of the loader ( ticket 2216 ) , it is possible for the file that holds
* an open dictionary to change , so these are now separate and independent unique identifiers .
*/
typedef struct { u_int32_t fileid ; } FILENUM ;
2013-04-16 23:58:59 -04:00
# define FILENUM_NONE ((FILENUM){UINT32_MAX})
2007-11-14 17:58:38 +00:00
2013-04-16 23:59:01 -04:00
typedef struct { u_int32_t dictid ; } DICTIONARY_ID ;
# define DICTIONARY_ID_NONE ((DICTIONARY_ID){0})
2013-04-16 23:58:58 -04:00
typedef struct {
u_int32_t num ;
FILENUM * filenums ;
} FILENUMS ;
2013-04-16 23:57:45 -04:00
# if !TOKU_WINDOWS && !defined(BOOL_DEFINED)
# define BOOL_DEFINED
2007-11-14 17:58:38 +00:00
typedef enum __toku_bool { FALSE = 0 , TRUE = 1 } BOOL ;
2013-04-16 23:57:27 -04:00
# endif
2007-11-14 17:58:38 +00:00
typedef struct tokulogger * TOKULOGGER ;
# define NULL_LOGGER ((TOKULOGGER)0)
typedef struct tokutxn * TOKUTXN ;
2013-04-16 23:59:05 -04:00
typedef struct txninfo * TXNINFO ;
2007-11-18 12:48:36 +00:00
# define NULL_TXN ((TOKUTXN)0)
2007-11-14 17:58:38 +00:00
2013-04-16 23:57:44 -04:00
struct logged_btt_pair {
DISKOFF off ;
int32_t size ;
} ;
2008-01-11 22:24:43 +00:00
typedef struct cachetable * CACHETABLE ;
typedef struct cachefile * CACHEFILE ;
2008-02-29 20:47:11 +00:00
/* tree command types */
2013-04-16 23:58:00 -04:00
enum brt_msg_type {
2008-02-29 20:47:11 +00:00
BRT_NONE = 0 ,
BRT_INSERT = 1 ,
2008-04-07 01:30:25 +00:00
BRT_DELETE_ANY = 2 , // Delete any matching key. This used to be called BRT_DELETE.
2008-02-29 20:47:11 +00:00
BRT_DELETE_BOTH = 3 ,
2008-04-07 01:30:25 +00:00
BRT_ABORT_ANY = 4 , // Abort any commands on any matching key.
BRT_ABORT_BOTH = 5 , // Abort commands that match both the key and the value
BRT_COMMIT_ANY = 6 ,
2013-04-16 23:58:00 -04:00
BRT_COMMIT_BOTH = 7 ,
2013-04-16 23:58:02 -04:00
BRT_COMMIT_BROADCAST_ALL = 8 , // Broadcast to all leafentries, (commit all transactions).
BRT_COMMIT_BROADCAST_TXN = 9 , // Broadcast to all leafentries, (commit specific transaction).
BRT_ABORT_BROADCAST_TXN = 10 , // Broadcast to all leafentries, (commit specific transaction).
2013-04-16 23:59:00 -04:00
BRT_INSERT_NO_OVERWRITE = 11 ,
2008-02-29 20:47:11 +00:00
} ;
Addresses #1125 Merged nested transactions from temporary merge branch into main.
Current tests fail (not regressions, they fail as of 13461)
* {{{x1.tdbrun}}}
* {{{test_log(2,3,4,5,6,7,8,9,10).recover}}}
* {{{test-recover(1,2,3).tdbrun}}}
* {{{test1324.tdbrun}}}
ULE_DEBUG disabled (defined to 0) Can be re-enabled for test purposes (set to 1).
refs [t:1125]
Merging into the temp branch (tokudb.main_13461+1125)
{{{svn merge --accept=postpone -r 12527:13461 ../tokudb.1125 ./}}}
Merging into main
{{{svn merge --accept=postpone -r13462:13463 ../tokudb.main_13461+1125/ ./}}}
git-svn-id: file:///svn/toku/tokudb@13464 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-16 23:57:56 -04:00
typedef struct xids_t * XIDS ;
typedef struct fifo_msg_t * FIFO_MSG ;
2008-02-29 20:47:11 +00:00
/* tree commands */
2013-04-16 23:58:00 -04:00
struct brt_msg {
enum brt_msg_type type ;
Addresses #1125 Merged nested transactions from temporary merge branch into main.
Current tests fail (not regressions, they fail as of 13461)
* {{{x1.tdbrun}}}
* {{{test_log(2,3,4,5,6,7,8,9,10).recover}}}
* {{{test-recover(1,2,3).tdbrun}}}
* {{{test1324.tdbrun}}}
ULE_DEBUG disabled (defined to 0) Can be re-enabled for test purposes (set to 1).
refs [t:1125]
Merging into the temp branch (tokudb.main_13461+1125)
{{{svn merge --accept=postpone -r 12527:13461 ../tokudb.1125 ./}}}
Merging into main
{{{svn merge --accept=postpone -r13462:13463 ../tokudb.main_13461+1125/ ./}}}
git-svn-id: file:///svn/toku/tokudb@13464 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-16 23:57:56 -04:00
XIDS xids ;
2008-02-29 20:47:11 +00:00
union {
/* insert or delete */
struct brt_cmd_insert_delete {
DBT * key ;
DBT * val ;
} id ;
} u ;
} ;
Addresses #1125 Merged nested transactions from temporary merge branch into main.
Current tests fail (not regressions, they fail as of 13461)
* {{{x1.tdbrun}}}
* {{{test_log(2,3,4,5,6,7,8,9,10).recover}}}
* {{{test-recover(1,2,3).tdbrun}}}
* {{{test1324.tdbrun}}}
ULE_DEBUG disabled (defined to 0) Can be re-enabled for test purposes (set to 1).
refs [t:1125]
Merging into the temp branch (tokudb.main_13461+1125)
{{{svn merge --accept=postpone -r 12527:13461 ../tokudb.1125 ./}}}
Merging into main
{{{svn merge --accept=postpone -r13462:13463 ../tokudb.main_13461+1125/ ./}}}
git-svn-id: file:///svn/toku/tokudb@13464 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-16 23:57:56 -04:00
// Message sent into brt to implement command (insert, delete, etc.)
2013-04-16 23:58:00 -04:00
// This structure supports nested transactions, and obsoletes brt_msg.
typedef struct brt_msg BRT_MSG_S , * BRT_MSG ;
2013-04-16 23:57:21 -04:00
2013-04-16 23:57:59 -04:00
typedef int ( * brt_compare_func ) ( DB * , const DBT * , const DBT * ) ;
Addresses #1125 Merged nested transactions from temporary merge branch into main.
Current tests fail (not regressions, they fail as of 13461)
* {{{x1.tdbrun}}}
* {{{test_log(2,3,4,5,6,7,8,9,10).recover}}}
* {{{test-recover(1,2,3).tdbrun}}}
* {{{test1324.tdbrun}}}
ULE_DEBUG disabled (defined to 0) Can be re-enabled for test purposes (set to 1).
refs [t:1125]
Merging into the temp branch (tokudb.main_13461+1125)
{{{svn merge --accept=postpone -r 12527:13461 ../tokudb.1125 ./}}}
Merging into main
{{{svn merge --accept=postpone -r13462:13463 ../tokudb.main_13461+1125/ ./}}}
git-svn-id: file:///svn/toku/tokudb@13464 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-16 23:57:56 -04:00
2013-04-16 23:58:59 -04:00
typedef int ( * generate_row_for_put_func ) ( DB * dest_db , DB * src_db , DBT * dest_key , DBT * dest_val , const DBT * src_key , const DBT * src_val , void * extra ) ;
typedef int ( * generate_row_for_del_func ) ( DB * dest_db , DB * src_db , DBT * dest_val , const DBT * src_key , const DBT * src_val , void * extra ) ;
2013-04-16 23:58:58 -04:00
Addresses #1125 Merged nested transactions from temporary merge branch into main.
Current tests fail (not regressions, they fail as of 13461)
* {{{x1.tdbrun}}}
* {{{test_log(2,3,4,5,6,7,8,9,10).recover}}}
* {{{test-recover(1,2,3).tdbrun}}}
* {{{test1324.tdbrun}}}
ULE_DEBUG disabled (defined to 0) Can be re-enabled for test purposes (set to 1).
refs [t:1125]
Merging into the temp branch (tokudb.main_13461+1125)
{{{svn merge --accept=postpone -r 12527:13461 ../tokudb.1125 ./}}}
Merging into main
{{{svn merge --accept=postpone -r13462:13463 ../tokudb.main_13461+1125/ ./}}}
git-svn-id: file:///svn/toku/tokudb@13464 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-16 23:57:56 -04:00
# define UU(x) x __attribute__((__unused__))
2008-04-22 20:39:50 +00:00
2013-04-16 23:59:05 -04:00
typedef struct memarena * MEMARENA ;
typedef struct rollback_log_node * ROLLBACK_LOG_NODE ;
2013-04-16 23:59:09 -04:00
# if defined(__cplusplus) || defined(__cilkplusplus)
} ;
# endif
2007-07-13 19:37:47 +00:00
# endif
Addresses #1125 Merged nested transactions from temporary merge branch into main.
Current tests fail (not regressions, they fail as of 13461)
* {{{x1.tdbrun}}}
* {{{test_log(2,3,4,5,6,7,8,9,10).recover}}}
* {{{test-recover(1,2,3).tdbrun}}}
* {{{test1324.tdbrun}}}
ULE_DEBUG disabled (defined to 0) Can be re-enabled for test purposes (set to 1).
refs [t:1125]
Merging into the temp branch (tokudb.main_13461+1125)
{{{svn merge --accept=postpone -r 12527:13461 ../tokudb.1125 ./}}}
Merging into main
{{{svn merge --accept=postpone -r13462:13463 ../tokudb.main_13461+1125/ ./}}}
git-svn-id: file:///svn/toku/tokudb@13464 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-16 23:57:56 -04:00