Commit edd27237 authored by Rich Prohaska's avatar Rich Prohaska

remove out of date man pages

parent 51cc8acb
.\" Process this file with
.\" groff -man -Tascii foo.1
.\"
.\" Copyright (c) 2007 Tokutek. All Rights Reserved.
.TH DB_ENV->close 3 "November 2007" Tokutek "TokuDB Programmer's Manual"
.SH NAME
DB_ENV->close
.SH SYNOPSIS
.LP
\fB #include <db.h>
.br
.sp
.HP 13
.BI "int DB_ENV->close(DB_ENV *" dbenv ", u_int32_t " flags ");"
.SH DESCRIPTION
Closes \fIenv\fR, a TokuDB environment, freeing any allocated resources and closing any underlying subystems.
Close all databases, cursors, and abort or commit all transactions
that refer the environment before closing the environment.
Do not use the environment after closing it (even if the close
operation returns some sort of failure). Its underlying memory is
likely to have been \fBfree()\fR'd.
.SH PARAMETERS
.IP \fIdbenv
The environment. The \fBDB_ENV->close()\fR environment does something like \fBfree(\fIdbenv\fB)\fR as part of its operation.
.IP \fIflags
The \fIflags\fR parameter must be set to 0.
.SH RETURN VALUE
.LP
Returns zero on success, and nonzero on failure.
.SH CONFORMING TO
The TokuDB embedded database provides a subset of the functionality of
the Berkeley DB. Programs that work with TokuDB probably work with
with most versions of Berkeley DB with only recompilation or
relinking. The database files are incompatible, however, so to
convert from one library to the other you would need to dump the
database with one library's tool and load it with the other's.
.SH AUTHOR
Tokutek, Inc.
.SH COPYRIGHT
Copyright (c) 2007 Tokutek. All Rights Reserved.
.\" Process this file with
.\" groff -man -Tascii foo.1
.\"
.\" Copyright (c) 2007 Tokutek. All Rights Reserved.
.TH db_env_create 3 "November 2007" Tokutek "TokuDB Programmer's Manual"
.SH NAME
db_env_create
.SH SYNOPSIS
.LP
\fB #include <db.h>
.br
.sp
.HP 13
.BI "int db_env_create(DB_ENV **" dbenvp ", u_int32_t " flags ");"
.SH DESCRIPTION
\fBdb_env_create\fR creates a DB_ENV handle, allocating memory and initializing its contents.
.LP
After creating the handle, you open a database using \fBdb_create\fR and then \fBDB->open()\fR.
To free the memory associated with the handle call \fB*\fIdbenvp\fB->close()\fR
(or \fBremove\fR when that is ready.)
The handle contains a field called \fBapp_private\fR which is declared
as type \fBvoid*\fR. This field is provided for the use of the
application and is not further used by TokuDB.
.SH PARAMETERS
.IP \fIdbenvp
A pointer to a \fBDB_ENV\fR variable. The \fBdb_env_create\fR function does something like \fB*\fIdbenvp\fB=malloc(...)\fR.
.IP \fIflags
The \fIflags\fR parameter must be set to 0.
.SH RETURN VALUE
.LP
Returns zero on success. The following non-zero errors can be returned:
.IP \fBEINVAL
You passed invalid parameters to this operation. In many cases
\fBEINVAL\fR
is not a very helpful error code, indicating only that you did something wrong.
.SH CONFORMING TO
The TokuDB embedded database provides a subset of the functionality of
the Berkeley DB. Programs that work with TokuDB probably work with
with most versions of Berkeley DB with only recompilation or
relinking. The database files are incompatible, however, so to
convert from one library to the other you would need to dump the
database with one library's tool and load it with the other's.
.SH RESTRICTIONS
.LP
Restrictions: At most a few thousand databases per file.
.SH AUTHOR
Tokutek, Inc.
.SH COPYRIGHT
Copyright (c) 2007 Tokutek. All Rights Reserved.
.\" Process this file with
.\" groff -man -Tascii foo.1
.\"
.\" Copyright (c) 2007 Tokutek. All Rights Reserved.
.TH DB_ENV->err 3 "November 2007" Tokutek "TokuDB Programmer's Manual"
.SH NAME
DB_ENV->err
.SH SYNOPSIS
.LP
\fB #include <db.h>
.br
.sp
.HP 13
.BI "void DB_ENV->err(DB_ENV *" dbenv ", int " error ", const char *" fmt ", ...);"
.SH DESCRIPTION
Prints an error message. The error comprises
.IP prefix
An optional prefix string (set with \fBDB_ENV->set_errpfx\fR), followed by a colon and a space.
.IP printf
An optional printf-style message (provided by \fIfmt\fR, or no printf message is \fIfmt\fR is \fBNULL\fR.
.IP separator
A colon and a space
.IP errstring
An error string provided by \fBdb_strerror\fR.
.SH PARAMETERS
.IP \fIerror
The error number.
.IP \fIfmt
Either \fBNULL\fR or a printf-style message.
.IP ...
The extra arguments needed by the printf.
.SH CONFORMING TO
The TokuDB embedded database provides a subset of the functionality of
the Berkeley DB. Programs that work with TokuDB probably work with
with most versions of Berkeley DB with only recompilation or
relinking. The database files are incompatible, however, so to
convert from one library to the other you would need to dump the
database with one library's tool and load it with the other's.
.SH AUTHOR
Tokutek, Inc.
.SH COPYRIGHT
Copyright (c) 2007 Tokutek. All Rights Reserved.
.\" Process this file with
.\" groff -man -Tascii foo.1
.\"
.\" Copyright (c) 2007 Tokutek. All Rights Reserved.
.TH DB_ENV->open 3 "November 2007" Tokutek "TokuDB Programmer's Manual"
.SH NAME
DB_ENV->open
.SH SYNOPSIS
.LP
\fB #include <db.h>
.br
.sp
.HP 13
.BI "int DB_ENV->open(DB_ENV *" dbenv ", char *" db_home ", u_int32_t " flags " int " mode ");"
.SH DESCRIPTION
Open a TokuDB environment (which should previously have been created using \fBdb_env_create\fR, and which should eventually be closed using \fBDB_env->close()\fR.
.SH PARAMETERS
.IP \fIdbenv
The environment.
.IP \fIdb_home
The name of the environment's directory if non-\fBNULL\fR. Can be
either a relative pathame (relative to the current working directory),
or an absolute pathname.
If \fidb_home\fR is \fBNULL\fR and the \fBDB_USE_ENVIRON\fR or \fBDB_USE_ENVIRON_ROOT\fB flag is set, then the value of the
\fBDB_HOME\fR environment variable is used.
.IP \fIflags
The \fIflags\fR parameter must be set to 0 or the bitwise or of one or more of the following values:
..RS 4
.IP \fBDB_INIT_LOCK
.IP \fBDB_INIT_LOG
.IP \fBDB_INIT_MPOOL
.IP \fBDB_INIT_TXN
.IP \fBDB_RECOVER
.IP \fBDB_RECOVER_FATAL
.IP \fBDB_USE_ENVIRON
.IP \fBDB_USE_ENVIRON_ROOT
.IP \fBDB_CREATE
.IP \fBDB_PRIVATE
.IP \fBDB_THREAD
If \fBDB_THREAD\fR is specified, then \fBDB_CREATE\fR must also be specified, even if the environment already exists. This restriction is in place in Berkeley DB 4.6 and 4.7, and so TokuDB also enforces it for compatibility.
.SH RETURN VALUE
.LP
Returns zero on success, and nonzero on failure.
.SH CONFORMING TO
The TokuDB embedded database provides a subset of the functionality of
the Berkeley DB. Programs that work with TokuDB probably work with
with most versions of Berkeley DB with only recompilation or
relinking. The database files are incompatible, however, so to
convert from one library to the other you would need to dump the
database with one library's tool and load it with the other's.
.SH AUTHOR
Tokutek, Inc.
.SH COPYRIGHT
Copyright (c) 2007 Tokutek. All Rights Reserved.
.\" Process this file with
.\" groff -man -Tascii foo.1
.\"
.\" Copyright (c) 2007 Tokutek. All Rights Reserved.
.TH DB_ENV->set_cachesize 3 "November 2007" Tokutek "TokuDB Programmer's Manual"
.SH NAME
DB->set_cachesize
.SH SYNOPSIS
.LP
\fB #include <db.h>
.br
.sp
.HP 13
.BI "int DB_ENV->set_cachesize(DB_ENV *" dbenv ", u_int32_t " gbytes ", u_int32_t " bytes ", int " ncache ");"
.br
.SH DESCRIPTION
\fBDB_ENV->set_cachesize\fr sets the size of the shared-memory buffer
pool (the cache) to \fIgbytes\fR* gibibytes plus \fIbytes\fR bytes.
.SH PARAMETERS
.IP \fIdbenv
The environment (which must have been created but not yet opened).
The environment is modified, not just this particular handle. If some
other thread or process has opened the same environment, then this call
is ignored.
.IP \fIgbytes
The number of gibibytes (gibi equals 2^30, giga equals 10^9) to allocate.
.IP \fIbytes
The number of additional bytes to allocate.
.IP \fIncache
Ignored in TokuDB.
.SH RETURN VALUE
.LP
Returns zero on success. The following non-zero errors can be returned:
.IP \fBEINVAL
You passed invalid parameters to this operation. In many cases
\fBEINVAL\fR
is not a very helpful error code, indicating only that you did something wrong.
.SH CONFORMING TO
The TokuDB embedded database provides a subset of the functionality of
the Berkeley DB. Programs that work with TokuDB probably work with
with most versions of Berkeley DB with only recompilation or
relinking. The database files are incompatible, however, so to
convert from one library to the other you would need to dump the
database with one library's tool and load it with the other's.
.SH AUTHOR
Tokutek, Inc.
.SH COPYRIGHT
Copyright (c) 2007 Tokutek. All Rights Reserved.
.\" Process this file with
.\" groff -man -Tascii foo.1
.\"
.\" Copyright (c) 2007 Tokutek. All Rights Reserved.
.TH DB_ENV->set_lk_max_locks 3 "November 2007" Tokutek "TokuDB Programmer's Manual"
.SH NAME
DB_ENV->set_lk_max_locks
.SH SYNOPSIS
.LP
\fB #include <db.h>
.br
.sp
.BI "int DB_ENV->set_lk_max_locks(DB_ENV *" dbenv ", u_int32_t " max ");"
.br
.BI "int DB_ENV->set_lk_max(DB_ENV *" dbenv ", u_int32_t " max ");"
.SH DESCRIPTION
These functions provide compatibility with Berkeley DB. The TokuDB
locking system has no limits on the number of locks, and these function ignore their arguments, returning 0.
.LP
.SH RETURN VALUE
.LP
Returns zero.
.SH CONFORMING TO
The TokuDB embedded database provides a subset of the functionality of
the Berkeley DB. Programs that work with TokuDB probably work with
with most versions of Berkeley DB with only recompilation or
relinking. The database files are incompatible, however, so to
convert from one library to the other you would need to dump the
database with one library's tool and load it with the other's.
.SH RESTRICTIONS
.LP
Restrictions: At most a few thousand databases per file.
.SH AUTHOR
Tokutek, Inc.
.SH COPYRIGHT
Copyright (c) 2007 Tokutek. All Rights Reserved.
# -*- Mode: Makefile -*-
.DEFAULT_GOAL=default
TOKUROOT=../../
include $(TOKUROOT)toku_include/Makefile.include
MANPAGES = tdb_create tdb_del tdb_put tdb_open tdb_log_max
MANPAGES_TEXI = $(patsubst %,%.texi,$(MANPAGES))
MANPAGES_POD = $(patsubst %,%.pod,$(MANPAGES))
MANPAGES_3 = $(patsubst %,%.3,$(MANPAGES))
SECTIONS = intro
SECTIONS_TEXI = $(patsubst %,%.texi,$(SECTIONS))
.PHONY: default
ifeq ($(OS_CHOICE),windows)
default: $(MANPAGES_3) ;
else
default: $(MANPAGES_3) tokudb.dvi;
endif
build: default;
tokudb.dvi: tokudb.texi $(MANPAGES_TEXI) $(SECTIONS_TEXI)
LC_ALL=C texi2dvi4a2ps -c -q tokudb.texi
$(MANPAGES_POD): everyman.texi
%.pod: %.texi
perl texi2pod.pl $< > $@
%.3: %.pod
pod2man --center "TokuDB Programmer's Manual" --section 3 $< > $@
clean:
rm -f tokudb.aux tokudb.dvi tokudb.cp tokudb.fn tokudb.ky tokudb.log tokudb.pg tokudb.tmp tokudb.toc tokudb.tp tokudb.vr *.3 *.pod
@ifnottex
@c man begin CONFORMINGTO
The TokuDB embedded database provides a subset of the functionality of
the Berkeley DB. Programs that work with TokuDB probably work with
with most versions of Berkeley DB with only recompilation or
relinking. The database files are incompatible, however, so to
convert from one library to the other you would need to dump the
database with one library's tool and load it with the other's.
@c man end
@c man begin COPYRIGHT
Copyright @copyright{} 2007 Tokutek, Inc. All rights reserved.
@c man end
@c man begin AUTHOR
Tokutek, Inc.
@c man end
@end ifnottex
@node Introduction to TokuDB
@chapter Introduction to TokuDB
TokuDB is an embedded transactional database that provides very fast
insertions and range queries on dictionaries.
TokUDB provides transactions with full ACID properties.
TokuDB is a library that can be linked directly into applications,
making it an @dfn{embedded} database.
TokuDB provides an API that is very similar to the Berkeley@tie{}DB.
@node Dictionaries and Associative Memories
@section Dictionaries and Associative Memories
Here we describe what we mean by ``dictionary''.
A @dfn{dictionary} is an ordered set of key-data pairs.
@itemize @bullet
@item
An @dfn{insertion} stores a key-data pair into a dictionary.
(One of the API calls that inserts pairs is called @code{DB->put}.)
@item
A @dfn{point query} finds the data associated with a particular key.
(One of the API calls that executes a point query is called @code{DB->get}.)
@item
A @dfn{range query} iterates through all the key-value pairs in a
range. For example, in a phone book, you could step through all the
people whose last names are between @samp{Jones} and @samp{Smith}. In
the API, range queries are supported using cursors.
@end itemize
An @dfn{associative memory} is like a dictionary but it supports only
insertions and point queries, but not range queries. Often hash
tables are used to implement associative memories. (In some
languages, such as Perl, an ``dictionary'' is really an associative
memory.)
@node Asymptotic Performance of Fractal Trees
@section Asymptotic Performance of Fractal Trees
For in-memory dictionaries, trees are often the data structure of
choice. For example, red-black trees or AVL trees implement all of
the above operations in @math{O(\log N)} time for in-memory data
structures, where $math{N} is the number of entries in the dictionary
(assuming constant-size key-data pairs).
For disk-resident dictionaries, most systems (such as
Berkeley@tie{}DB) employ B-trees, which can implement insertions and
point queries with @math{O(\log_B N)} disk operations in the worst
case, where @math{B} is the block size of the B-tree (assuming
constant-size key-data pairs).
The @dfn{effective block size} of a disk is the size at which the
disk-head movement does not dominate the cost of storing or retrieving
data off the disk. The effective block size is difficult to calculate
for actual disk systems, since it depends on how far the head must
move (the disk head moves short distances faster than long distances,
reducing the effective block size), whether the data is near the
center of the disk (where the bandwidth is small and hence the
effective block size tends to be small) or at the outer edge of the
disk (where the bandwidth is larger), and on how much prefetching the
operating system and disk firmware perform.
TokuDB, on the other hand, employs @dfn{fractal trees}, a new class of
data structures that provide the same API as B-trees, but are much
faster. Fractal tree point-queries have the same asymptotic cost as
B-trees (@math{O(\log_B N)}), but insertions require only
@math{O((\log N)/B)} disk operations on average, where @math{B} is the
effective block size of the disk system.
How much faster is that in concrete terms? In 2007, the effective
block size of a disk is about a megabyte. If you use 100-byte
key-data pairs, then you can fit about 10,000 pairs into an effective
block. If you have a 100 Terabyte database then @math{N=2^{40}}, so
on average a fractal tree requires about @math{(\log N)/B = 40/10000 =
1/250} of a disk transfer per insertion. That is, on average, you can
perform 250 insertions per disk I/O. In contrast, a traditional
B-tree equires @math{\log_B N = 2} disk I/O's per insertion. In
practice, because of caching in main memory, traditional B-trees
require 1 disk read and 1 disk write per insertion. Thus TokuDB's
insertions are orders of magnitude faster than dictionaries based on
traditional B-trees.
Range queries are also faster for TokuDB than in a typical B-tree.
Since B-trees usually use blocks sizes that relatively small compared
to the effective block size of the disk they require many disk-head
movements to traverse a range. Fractal trees use block sizes that are
the effective block size of the disk.
@section @code{db_create}
@setfilename tokudb
@settitle db_create
@c man title db_create tokudb
@unnumberedsubsec Synopsis
@c man begin SYNOPSIS
@code{#include <db.h>}
@noindent
@code{int db_create(DB **}@var{dbp}@code{, DB_ENV *}@var{env}@code{, u_int32_t }@var{flags}@code{);}
@c man end
@unnumberedsubsec Description
@c man begin DESCRIPTION
@code{db_create} creates a @code{DB} handle, allocating memory and initializing its contents.
After creating the handle, you open a database using @code{(*}@var{dbp}@code{)->open(...)}.
To free the memory associated with the handle call @code{(*}@var{dbp}@code{)->close(...)}
(or @code{->remove} or @code{->rename} or @code{->verify\}when those are ready).
The handle contains a field called @code{app_private} which is declared
as type @code{void*}. This field is provided for the use of the
application and is not further used by TokuDB. One typical use of
@code{app_private} is to pass information about the database to a
user-defined sort-order function.
@c man end
@unnumberedsubsec Parameters
@c man begin PARAMETERS
@table @var
@item dbp
A pointer to a @code{DB} variable. The @code{db_create} function does something like @code{*}@var{dbp}@code{=malloc(...)}.
@item env
If @var{env}@code{==NULL} then the database is not part of an environment
(hence it has no transactions, locking, or recovery).
Otherwise the database is created within the specified environment,
and inherits the properties of that environment. (For example if
logging for recovery is enabled by the environment, then the database
will have logging too.)
@item flags
The @var{flags} parameter must be set to 0.
@end table
@c man end
@unnumberedsubsec Return Value
@c man begin RETURNVALUE
Returns zero on success. The following non-zero errors can be returned:
@table @code
@item EINVAL
You passed invalid parameters to this operation.
@end table
@c man end
@unnumberedsubsec Notes
@c man begin NOTES
TokuDB allows at most a few thousand databases per file.
@c man end
@include everyman.texi
@page
@section @code{DB->del}
@setfilename tokudb
@settitle DB->del
@c man title db_del tokudb
@unnumberedsubsec Synopsis
@c man begin SYNOPSIS
@code{#include <db.h>}
@noindent
@code{int DB->del(DB *}@var{db}@code{, DB_TXN *}@var{txnid}@code{, DBT*}@var{key}@code{, u_int32_t }@var{flags}@code{);}
@c man end
@unnumberedsubsec Description
@c man begin DESCRIPTION
@code{DB->del}
removes all the key/data pairs that match @var{key}. If there are
duplicates, all matching records are removed.
When called on a secondary index (associated via
@code{DB->associate(3)}), all the matching keys in the secondary
database are used to identify keys/data pairs in the primary database.
The keys in the primary are all removed, and all the corresponding
records in all the secondary indices are removed.
@c man end
@unnumberedsubsec Parameters
@c man begin PARAMETERS
@table @var
@item db
The @code{DB} handle for the database.
@item txnid
Either @code{NULL} or a @code{TXNID}.
@item key
The key to be deleted.
@item flags
Must be zero or @code{DB_DELETE_ANY}.
Using @code{DB_DELETE_ANY} causes @code{DB->del()} to possibly return @code{0} even if
there are no matching key/data pairs.
Note: @code{DB_DELETE_ANY} is a Tokutek extension to the
Berkeley@tie{}DB API. A program developed for TokuDB can be used with Berkeley@tie{}DB by adding this to the code:
@example
#ifndef TOKUDB
#define DB_DELETE_ANY 0
#endif
@end example
@end table
@c man end
@unnumberedsubsec Return Value
@c man begin RETURNVALUE
Returns zero on success. Success is defined to be that either there
was at least one matching key/data pair and it was deleted, or there were zero or more
matching key/data pairs, and they were all deleted, and @code{BDB_DELETE_ANY} was passed.
The following non-zero values can be returned:
@table @code
@item DB_NOTFOUND
If the flags do not include @code{BDB_DELETE_ANY} and there was no
matching key/data pair, then @code{DB->del} returns @code{BDB_NOTFOUND}.
It is allowed for TokuDB to return @code{DB_NOTFOUND} even if
@code{BDB_DELETE_ANY} is specified. Using @code{DB_DELETE_ANY} means
that the caller does not care whether the result is @code{0} or
@code{DB_NOTFOUND}.
@item DB_DEADLOCK
The system discovered deadlock cycle involving this and other transactions.
This operation was killed.
@item DB_LOCK_NOTGRANTED
In an environment configured for lock timeouts, the system was unable to grant a lock within the allowed time.
@item EINVAL
You passed invalid parameters to this operation.
@end table
@c man end
@unnumberedsubsec Notes
@c man begin NOTES
Performing a deletion without @code{DB_DELETE_ANY} is relatively
expensive. For example, suppose you have a large database that is
stored on disk and is much larger than main memory. Then
@code{DB->get()} using a randomly selected key usually requires at
least one disk-head movement, limiting you about 100 to 150 get
operations per second per disk drive. A delete operation that doesn't
require the @code{DB_NOTFOUND} result to be computed can run much
faster, however (orders of magnitude faster in some cases.) For the
@code{DB->del} operation to compute the @code{DB_NOTFOUND} result
requires a get, which slows down the deletions.
However, suppose that the key you are deleting is already in main
memory (because you recently accessed it). In that case, there is
likely to be little or no performance difference between using
@code{DB_DELETE_ANY} or not.
Associated secondary indexes can also slow down deletion operations,
since TokuDB performs a @code{DB->get} to get the primary key/data pair
so that it can use the callback function to compute all the secondary
keys that must be deleted.
One way to achieve fast deletions with secondary indices is to design
your primary key so that contiguous ranges will be removed from your
database at the same time. For example, if you design your primary
key to be a timestamp, and you expire the oldest data first, then
deletions can run fast: Use a cursor to find the leftmost item, and
delete it, move right, delete some more, and so forth. The cursor
scan is fast, and the deletes on all the secondary keys will be fast
too.
@c man end
@include everyman.texi
@page
@section @code{DB_ENV->set_lg_max}
@setfilename tokudb
@settitle DB_ENV->set_lg_max
@c man title db_del tokudb
@unnumberedsubsec Synopsis
@c man begin SYNOPSIS
@code{#include <db.h>}
@noindent
@code{int DB_ENV->set_lg_max(DB_ENV *}@var{env}@code{, u_int32_t }@var{lg_max}@code{);}
@code{int DB_ENV->get_lg_max(DB_ENV *}@var{env}@code{, u_int32_t*}@var{lg_max_p}@code{);}
@c man end
@unnumberedsubsec Description
@c man begin DESCRIPTION
Set or get the maximum size, in bytes, of any given log file.
When logging is configured, the default maximum log size is 100MiB.
It is possible that a log file will be larger than @var{lg_max}: The
logs comprise log entries, and TokuDB always writes a complete log
entry into a log file. Thus if a log entry is larger than
@var{lg_max}, then the resulting log file could be larger.
You may call @code{DB_ENV->set_log_max} at any time on any environment
that has been created but hasn't yet been closed. Subsequently
written log files will be smaller than the specified size.
@c man end
@unnumberedsubsec Parameters
@c man begin PARAMETERS
@table @var
@item env
The @code{DB_ENV} handle.
@item lg_max
For @code{DB_ENV->set_log_max}, the new maximum logfile size, in bytes.
@item lg_max_p
For @code{DB_ENV->get_log_max}, the return result will be stored in @code{*}@var{lg_max_p}.
@end table
@c man end
@unnumberedsubsec Return Value
@c man begin RETURNVALUE
Returns zero on success.
@c man end
@include everyman.texi
@page
@section @code{DB->open}
@setfilename tokudb
@settitle DB->open
@c man title db_open tokudb
@unnumberedsubsec Synopsis
@c man begin SYNOPSIS
@code{#include <db.h>}
@noindent
@code{int DB->open(DB *}@var{db}@code{, DB_TXN *}@var{txnid}@code{, const char *}@var{file}@code{, const char *}@var{database}@code{, DBTYPE }@var{type}@code{, u_int32_t }@var{flags}@code{, int }@var{mode}@code{);}
@c this works for latex (sort of) but not for texi2pod. It doesn't really work for latex either:
@c @multitable {@code{int DB->open(}} {for column two asdfasdfasdf}
@c @item @code{int DB->open(}
@c @tab @code{DB *}@var{db}@code{,}
@c @item @tie{}
@c @tab @code{DB_TXN *}@var{txnid}@code{,}
@c @item @tie{}
@c @tab @code{const char *}@var{file}@code{,}
@c @item @tie{}
@c @tab @code{const char *}@var{database}@code{,}
@c @item @tie{}
@c @tab @code{DBTYPE }@var{type}@code{,}
@c @item }
@c @tab @code{u_int32_t }@var{flags}@code{,}
@c @item
@c @tab @code{int }@var{mode}@code{);}
@c @end multitable
@c man end
@unnumberedsubsec Description
@c man begin DESCRIPTION
@code{DB->open} opens the database named by
@var{file}
and
@var{database.}
The database is opened read/write.
The @code{DB->open} operation is expensive. If possible, open a
database once, and reuse the @code{DB} handle for many operations.
TokuDB supports at most a few thousand databases per file.
@c man end
@unnumberedsubsec Parameters
@c man begin PARAMETERS
@table @var
@item db
A unopened @code{DB} handle that was created using @code{db_create()}.
@item txnid
Either @code{NULL} or a @code{TXNID}.
@item file
The name of the file that holds the database.
The @var{file} must be non-@code{NULL}. TokuDB does not currently support in-memory databases.
@item database
If @code{NULL} then the file contains only one unnamed database.
Otherwise @var{database} specifies the name of a database, stored
within the file, to open.
@item type
must be set to @code{DB_BTREE}. (TokuDB supports only dictionaries, not hash tables or queues.)
@item flags
must be zero or the bitwise-or of one or more of the following values:
@table @code
@item DB_CREATE
Create the database if it does not exist. If the database does not
already exist and @code{DB_CREATE} is not specified, then the
@code{DB->open} will fail.
@end table
@item mode
The mode (see @code{chmod(2)}) modified by the @code{umask(2)}, used when a file is created.
@end table
@c man end
@unnumberedsubsec Return Value
@c man begin RETURNVALUE
Returns zero on success. The following non-zero errors can be returned:
@table @code
@item DB_DEADLOCK
The system discovered deadlock cycle involving this and other transactions.
This operation was killed.
@item DB_LOCK_NOTGRANTED
In an environment configured for lock timeouts, the system was unable to grant a lock within the allowed time.
@item ENOENT
The file or directory does not exist.
@item EINVAL
You passed invalid parameters to this operation.
@end table
@c man end
@include everyman.texi
@page
@section @code{DB->put}
@setfilename tokudb
@settitle DB->put
@c man title db_put tokudb
@unnumberedsubsec Synopsis
@c man begin SYNOPSIS
@code{#include <db.h>}
@code{int DB->put(DB *}@var{db}@code{, DB_TXN *}@var{txnid}@code{, DBT*}@var{key}@code{, DBT*}@var{data}@code{, u_int32_t }@var{flags}@code{);}
@c man end
@unnumberedsubsec Description
@c man begin DESCRIPTION
@code{DB->put} stores a key/data pair into a database, replacing any
previously existing key if duplicates are not enabled, or adding a
duplicate if sorted duplicates are enabled. (TokuDB does not support
unsorted duplicates, hence the new key-data pair is inserted at the
correct sorted location.)
Key items are limited to 16KB in size.
Data items are limited to 256KB in size (for now.)
@c man end
@unnumberedsubsec Parameters
@c man begin PARAMETERS
@table @var
@item db
The @code{DB} handle for the database.
@item txnid
Either @code{NULL} or a @code{TXNID}.
@item key
The key to be inserted.
@item data
The data to be inserted.
@item flags
Must be zero or must be one of the following flags. However, @code{flags} must be nonzero for sorted duplicates.
@table @code
@item 0
For non-dup databases, insert the new key/data pair, overwriting any pair with a matching key.
Zero is not allowed databases with duplicates (returns @code{EINVAL}).
@item DB_YESOVERWRITE
Insert the new key/data pair, overwriting any matching pair. If the
database supports sorted duplicates, then the matching key/data pair
(if any) is overwritten. If the database does not support duplicates,
then the pair with a matching key (if any) is overwritten. (TokuDB
supports only sorted duplicates, not unsorted duplicates.)
@item DB_NOOVERWRITE
Insert the new key/data pair only if the no key/data pair with a
matching key already exists in the database.
The @code{DB->put} function returns @code{DB_KEYEXIST} if
@code{DB_NOOVERWRITE} is set and the key already exists in the
database.
@item DB_NODUPDATA
Insert the new key/data pair only if it is not already present in the database.
@code{DB_NODUPDATA} may only be specifed when operating on databases that provide sorted duplicates.
The @code{DB->put} function returns @code{DB_KEYEXIST} if @code{DB_NODUPDATA} is set and the key/data pair is already present in the database.
Using @code{DB_NODUPDATA} can dramatically slow down deletions, since
it the implementation must perform a @code{DB->get} to determine
whether the pair already exists.
@end table
Rationale: Using @code{0} for flags does not give the results that
many users expect. The Berkeley DB documentation says that someday
they will support duplicate duplicates, and that if you want the
current behavior you should use @code{DB_NOOVERWRITE}. On the other
hand, the current behavior is very expensive, since it requires that
the implementation perform a @code{DB->get()}.
Further confounding issues that for Berkeley@tie{}DB has the following
behavior: For sorted duplicates, inserting the same pair twice returns
@code{DB_KEYEXIST}. For no-duplicates or unsorted duplicates,
inserting the same pair twice overwrites the pair returning @code{0}.
We wanted a mode in which matching data is overwritten, however
``matching'' is defined. Thus for non-duplicates, a matching pair is
one with the same key. For sorted duplicates, a matching pair is one
with the same key and data.
For high performance, use @code{DB_YESOVERWRITE}.
@end table
@c man end
@unnumberedsubsec Return Value
@c man begin RETURNVALUE
Returns zero on success. The following non-zero errors can be returned:
@table @code
@item DB_DEADLOCK
The system discovered deadlock cycle involving this and other transactions.
This operation was killed.
@item DB_LOCK_NOTGRANTED
In an environment configured for lock timeouts, the system was unable to grant a lock within the allowed time.
@item ENOENT
The file or directory does not exist.
@item EINVAL
You passed invalid parameters to this operation.
In particular, if you pass 0 to a database configured for duplicates,
then @code{DB->put()} returns @code{EINVAL}.
@end table
@c man end
@include everyman.texi
This diff is collapsed.
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename tokudb.info
@settitle The TokuDB Embedded Database
@c %**end of header
@copying
Copyright @copyright{} 2007, Tokutek, Inc.
@end copying
@titlepage
@title TokuDB Programmmer's Manual
@subtitle for the Tokutek Embedded Database
@author Tokutek, Inc.
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage
@contents
@ifnottex
@node Top
@top TokuDB
@menu tdb_create::
@insertcopying
@end ifnottex
@include intro.texi
@node TokuDB C API
@chapter TokuDB C API
@include tdb_create.texi
@include tdb_open.texi
@include tdb_del.texi
@include tdb_put.texi
@include tdb_log_max.texi
@node Index
@unnumbered Index
@printindex
@bye
.\" Process this file with
.\" groff -man -Tascii foo.1
.\"
.\" Copyright (c) 2007 Tokutek. All Rights Reserved.
.TH tokudb_dump 1 "November 2007" Tokutek "TokuDB Programmer's Manual"
.SH NAME
tokudb_dump
.SH SYNOPSIS
.B tokudb_dump [-pVT] [-f
.I output-file
.B ] [-h
.I home
.B ] [-s
.I database
.B ]
.I db_file
.LP
.SH DESCRIPTION
The
.B tokudb_dump
program reads a TokuDB database and writes its key/data pairs to the standard output.
The format of the key/data pairs is compatible with the
.B tokudb_load
program and with the Berkeley DB load and dump programs.
.SH CONFORMING TO
The TokuDB embedded database provides a subset of the functionality of
the Berkeley DB. Programs that work with TokuDB probably work with
with most versions of Berkeley DB with only recompilation or
relinking. The database files are incompatible, however, so to
convert from one library to the other you would need to dump the
database with one library's tool and load it with the other's.
.SH ADDITIONAL OPTIONS
.IP -T
Output in a format acceptable for
.B tokudb_load
with the
.B -T
option.
.SH UNSUPPORTED BDB OPTIONS
.IP -d
Unsupported.
.IP -k
Unsupported.
.IP -l
Unsupported.
.IP -N
Unsupported.
.IP -P
Unsupported.
.IP -R
Unsupported.
.IP -r
Unsupported.
.SH DIFFERENCES
You must use the
.B -s
option to dump each subdatabase individually for a file with multiple databases.
Transactions are not yet supported.
The database to be dumped must not be currently in use.
.SH AUTHOR
Tokutek, Inc.
.SH COPYRIGHT
Copyright (c) 2007 Tokutek. All Rights Reserved.
.\" Process this file with
.\" groff -man -Tascii foo.1
.\"
.\" Copyright (c) 2007 Tokutek. All Rights Reserved.
.TH tokudb_gen 1 "November 2007" Tokutek "TokuDB Programmer's Manual"
.SH NAME
tokudb_gen
.SH SYNOPSIS
.B tokudb_gen [-PpTuVhHfF] [-o
.I output
.B ] [-r
.I seed
.B ] [-m
.I minsize
.B ] [-M
.I limitsize
.B ] [-n
.I numpairs
.B ] [-d
.I delimiter
.B ] [-s
.I delimiter
.B ]
.LP
.SH DESCRIPTION
The
.B tokudb_gen
program generates random key/data pairs onto the standard output that match
the input requirements of the
.B tokudb_load
program and the output requirements of the
.B tokudb_dump
program.
.SH CONFORMING TO
The TokuDB embedded database provides a subset of the functionality of
the Berkeley DB. Programs that work with TokuDB probably work with
with most versions of Berkeley DB with only recompilation or
relinking. The database files are incompatible, however, so to
convert from one library to the other you would need to dump the
database with one library's tool and load it with the other's.
.SH OPTIONS
.IP -P
Generate only printable characters (as defined by
.B isprint
).
.IP -p
Output in the same format as
.B tokudb_dump
-p.
Output in the same format as
.B tokudb_dump
-T (and the input format for
.B tokudb_load
-T.)
.IP -u
Disable forcing of unique keys. By default a unique identifier is appended
to the end of every key to make certain they are unique, which may allow
keys greater than the lengthlimit provided by -M. Setting -u will enforce
the length limit strictly, and might result in duplicate keys.
.IP -V
Print version information and exit.
.IP -h
Prevent output of header information.
.IP -H
Output ONLY the header information.
.IP -f
Prevent output of footer information.
.IP -F
Output ONLY the footer information.
.IP "-o output"
Write generated data to output instead of standard out.
.IP "-r seed"
Set the random seed for reproducible results. Default seed is 1.
.IP "-m minsize"
Set the minimum size (inclusive) for keys and values. Default is 0.
.IP "-M limitsize"
Set the maximum size (exclusive) for keys and values. Default is 1024.
Note that if -u is not provided, a unique identifier is appended to all keys
which can cause key sizes to exceed limitsize by up to 10 bytes.
Value size limits are enforced strictly.
.IP "-n numpairs"
The number of key/value pairs to generate.
Default is 1024.
.IP "-d delimiter"
A delimiter placed at the end of every key and value.
Default is '\n'. It must be either a single character or any of the following
escape sequences: \\a, \\b, \\e, \\f, \\n, \\r, \\t, \\v, \\0, or \\\\. The delimiter
may not be a hexadecimal character.
.IP "-s delimiter"
A delimiter placed placed at the end of every key/value pair.
There is no default if omitted.
It has the same restrictions as -d.
.SH AUTHOR
Tokutek, Inc.
.SH COPYRIGHT
Copyright (c) 2007 Tokutek. All Rights Reserved.
.\" Process this file with
.\" groff -man -Tascii foo.1
.\"
.\" Copyright (c) 2007 Tokutek. All Rights Reserved.
.TH tokudb_load 1 "November 2007" Tokutek "TokuDB Programmer's Manual"
.SH NAME
tokudb_load
.SH SYNOPSIS
.B tokudb_load [-TV] [-c
.I name=value
.B ] [-f
.I file
.B ] [-h
.I home
.B ] [-t
.I btree
.B ]
.I db_file
.LP
.SH DESCRIPTION
The
.B tokudb_load
program reads key/data pairs from standard input and writes them into a TokuDB
database.
The format of the key/data pairs is compatible with the
.B tokudb_dump
program and the Berkeley DB load and dump
programs.
.SH CONFORMING TO
The TokuDB embedded database provides a subset of the functionality of
the Berkeley DB. Programs that work with TokuDB probably work with
with most versions of Berkeley DB with only recompilation or
relinking. The database files are incompatible, however, so to
convert from one library to the other you would need to dump the
database with one library's tool and load it with the other's.
.SH UNSUPPORTED BDB OPTIONS
.IP -n
Unsupported.
.IP -P
Unsupported.
.IP "-t hash"
Unsupported.
.IP "-t recno"
Unsupported.
.IP "-t queue"
Unsupported.
.IP "-c keys=0"
Unsupported.
.IP "-c extentsize=value"
Unsupported.
.IP "-c h_ffactor=value"
Unsupported.
.IP "-c h_nelem=value"
Unsupported.
.IP "-c re_len=value"
Unsupported.
.IP "-c re_pad=value"
Unsupported.
.IP "-c renumber=value"
Unsupported.
.IP "-c recnum=value"
Unsupported.
.SH IGNORED BDB OPTIONS
These options will be accepted but not alter behavior. They may be implemented
in the future.
.IP "-c bt_minkey=value"
Unsupported.
.IP "-c chksum=value"
Unsupported.
.IP "-c db_lorder=value"
Unsupported.
.IP "-c db_pagesize=value"
Unsupported.
.SH DIFFERENCES
Transactions are not yet supported.
The database(s) to be loaded must not be currently in use.
.SH AUTHOR
Tokutek, Inc.
.SH COPYRIGHT
Copyright (c) 2007 Tokutek. All Rights Reserved.
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