Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
4edd04f5
Commit
4edd04f5
authored
Oct 15, 2007
by
Bradley C. Kuszmaul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Logging
git-svn-id:
file:///svn/tokudb@462
c7de825b-a66e-492c-adef-691d508d4ae1
parent
168b8d8e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
31 deletions
+22
-31
include/db.h
include/db.h
+2
-0
newbrt/log.c
newbrt/log.c
+9
-3
newbrt/log.h
newbrt/log.h
+3
-1
newbrt/pma.c
newbrt/pma.c
+5
-5
src/tests/Makefile
src/tests/Makefile
+2
-0
src/ydb.c
src/ydb.c
+1
-22
No files found.
include/db.h
View file @
4edd04f5
...
...
@@ -2,6 +2,8 @@
#define _DB_H
/* This code generated by make_db_h. Copyright (c) 2007 Tokutek */
#include <sys/types.h>
/*stdio is needed for the FILE* in db->verify*/
#include <stdio.h>
#if defined(__cplusplus)
extern
"C"
{
#endif
...
...
newbrt/log.c
View file @
4edd04f5
#include <unistd.h>
#include "brttypes.h"
#include "log-internal.h"
#include "wbuf.h"
#include "memory.h"
#include "../src/ydb-internal.h"
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
...
...
@@ -131,16 +131,22 @@ n
}
#endif
int
tokulogger_log_phys_add_or_delete_in_leaf
(
TOKUTXN
txn
,
diskoff
diskoff
,
int
is_add
,
const
struct
kv_pair
*
pair
)
{
int
tokulogger_log_phys_add_or_delete_in_leaf
(
DB
*
db
,
TOKUTXN
txn
,
diskoff
diskoff
,
int
is_add
,
const
struct
kv_pair
*
pair
)
{
if
(
txn
==
0
)
return
0
;
int
keylen
=
pair
->
keylen
;
int
vallen
=
pair
->
vallen
;
int
buflen
=
30
+
keylen
+
vallen
;
int
buflen
=
(
keylen
+
vallen
+
4
+
4
// the key and value
+
1
// log command
+
8
// txnid
+
8
// fileid
+
8
// diskoff
);
unsigned
char
buf
[
buflen
];
struct
wbuf
wbuf
;
wbuf_init
(
&
wbuf
,
buf
,
buflen
)
;
wbuf_char
(
&
wbuf
,
is_add
?
LT_INSERT_WITH_NO_OVERWRITE
:
LT_DELETE
);
wbuf_txnid
(
&
wbuf
,
txn
->
txnid64
);
wbuf_fileid
(
&
wbuf
,
db
->
i
->
fileid
);
wbuf_diskoff
(
&
wbuf
,
diskoff
);
wbuf_bytes
(
&
wbuf
,
kv_pair_key_const
(
pair
),
keylen
);
wbuf_bytes
(
&
wbuf
,
kv_pair_val_const
(
pair
),
vallen
);
...
...
newbrt/log.h
View file @
4edd04f5
#ifndef TOKULOGGGER_H
#define TOKULOGGGER_H
#include "../include/db.h"
#include "brttypes.h"
#include "kv-pair.h"
typedef
struct
tokulogger
*
TOKULOGGER
;
typedef
struct
tokutxn
*
TOKUTXN
;
...
...
@@ -7,7 +9,7 @@ int tokulogger_create_and_open_logger (const char *directory, TOKULOGGER *result
int
tokulogger_log_bytes
(
TOKULOGGER
logger
,
int
nbytes
,
void
*
bytes
);
int
tokulogger_log_close
(
TOKULOGGER
*
logger
);
int
tokulogger_log_phys_add_or_delete_in_leaf
(
TOKUTXN
txn
,
diskoff
diskoff
,
int
is_add
,
const
struct
kv_pair
*
pair
);
int
tokulogger_log_phys_add_or_delete_in_leaf
(
DB
*
db
,
TOKUTXN
txn
,
diskoff
diskoff
,
int
is_add
,
const
struct
kv_pair
*
pair
);
int
tokulogger_log_commit
(
TOKUTXN
txn
);
...
...
newbrt/pma.c
View file @
4edd04f5
...
...
@@ -737,7 +737,7 @@ int pma_insert (PMA pma, DBT *k, DBT *v, DB* db, TOKUTXN txn, diskoff diskoff) {
pma_mfree_kv_pair
(
pma
,
pma
->
pairs
[
idx
]);
pma
->
pairs
[
idx
]
=
pma_malloc_kv_pair
(
pma
,
k
->
data
,
k
->
size
,
v
->
data
,
v
->
size
);
assert
(
pma
->
pairs
[
idx
]);
int
r
=
tokulogger_log_phys_add_or_delete_in_leaf
(
txn
,
diskoff
,
0
,
pma
->
pairs
[
idx
]);
int
r
=
tokulogger_log_phys_add_or_delete_in_leaf
(
db
,
txn
,
diskoff
,
0
,
pma
->
pairs
[
idx
]);
return
r
;
}
else
return
BRT_ALREADY_THERE
;
/* It is already here. Return an error. */
...
...
@@ -750,7 +750,7 @@ int pma_insert (PMA pma, DBT *k, DBT *v, DB* db, TOKUTXN txn, diskoff diskoff) {
pma
->
pairs
[
idx
]
=
pma_malloc_kv_pair
(
pma
,
k
->
data
,
k
->
size
,
v
->
data
,
v
->
size
);
assert
(
pma
->
pairs
[
idx
]);
pma
->
n_pairs_present
++
;
return
tokulogger_log_phys_add_or_delete_in_leaf
(
txn
,
diskoff
,
1
,
pma
->
pairs
[
idx
]);
return
tokulogger_log_phys_add_or_delete_in_leaf
(
db
,
txn
,
diskoff
,
1
,
pma
->
pairs
[
idx
]);
}
int
pma_delete
(
PMA
pma
,
DBT
*
k
,
DB
*
db
)
{
...
...
@@ -866,7 +866,7 @@ int pma_insert_or_replace (PMA pma, DBT *k, DBT *v,
if
(
0
==
pma
->
compare_fun
(
db
,
k
,
fill_dbt
(
&
k2
,
kv
->
key
,
kv
->
keylen
)))
{
if
(
!
kv_pair_deleted
(
pma
->
pairs
[
idx
]))
{
*
replaced_v_size
=
kv
->
vallen
;
r
=
tokulogger_log_phys_add_or_delete_in_leaf
(
txn
,
diskoff
,
0
,
kv
);
r
=
tokulogger_log_phys_add_or_delete_in_leaf
(
db
,
txn
,
diskoff
,
0
,
kv
);
if
(
r
!=
0
)
return
r
;
}
if
(
v
->
size
==
(
unsigned
int
)
kv_pair_vallen
(
kv
))
{
...
...
@@ -876,7 +876,7 @@ int pma_insert_or_replace (PMA pma, DBT *k, DBT *v,
pma
->
pairs
[
idx
]
=
pma_malloc_kv_pair
(
pma
,
k
->
data
,
k
->
size
,
v
->
data
,
v
->
size
);
assert
(
pma
->
pairs
[
idx
]);
}
r
=
tokulogger_log_phys_add_or_delete_in_leaf
(
txn
,
diskoff
,
0
,
pma
->
pairs
[
idx
]);
r
=
tokulogger_log_phys_add_or_delete_in_leaf
(
db
,
txn
,
diskoff
,
0
,
pma
->
pairs
[
idx
]);
return
r
;
}
}
...
...
@@ -890,7 +890,7 @@ int pma_insert_or_replace (PMA pma, DBT *k, DBT *v,
pma
->
n_pairs_present
++
;
*
replaced_v_size
=
-
1
;
//printf("%s:%d txn=%p\n", __FILE__, __LINE__, txn);
r
=
tokulogger_log_phys_add_or_delete_in_leaf
(
txn
,
diskoff
,
1
,
pma
->
pairs
[
idx
]);
r
=
tokulogger_log_phys_add_or_delete_in_leaf
(
db
,
txn
,
diskoff
,
1
,
pma
->
pairs
[
idx
]);
return
r
;
}
...
...
src/tests/Makefile
View file @
4edd04f5
...
...
@@ -27,3 +27,5 @@ test_log1.bdb_link: test_log1.c
test_log1.tokudb_link
:
test_log1.c
cc
-Wall
-Werror
-O2
-g
test_log1.c
-o
$@
$(LOADLIBES)
clean
:
rm
-f
test_log0 test_log1 test_db_close_no_open test_db_version
src/ydb.c
View file @
4edd04f5
...
...
@@ -2,7 +2,7 @@
#include <assert.h>
#include <brt.h>
#include
<db.h>
#include
"ydb-internal.h"
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
...
...
@@ -18,27 +18,6 @@
#include "log.h"
#include "memory.h"
struct
db_header
{
int
n_databases
;
// Or there can be >=1 named databases. This is the count.
char
*
database_names
;
// These are the names
BRT
*
database_brts
;
// These
};
struct
__toku_db_internal
{
int
freed
;
int
(
*
bt_compare
)(
DB
*
,
const
DBT
*
,
const
DBT
*
);
struct
db_header
*
header
;
int
database_number
;
// -1 if it is the single unnamed database. Nonnengative number otherwise.
DB_ENV
*
env
;
char
*
full_fname
;
char
*
database_name
;
//int fd;
u_int32_t
open_flags
;
int
open_mode
;
BRT
brt
;
int
is_db_dup
;
};
static
inline
void
*
malloc_zero
(
size_t
size
)
{
void
*
vp
=
toku_malloc
(
size
);
if
(
vp
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment