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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
4b832c98
Commit
4b832c98
authored
Jul 20, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ha_berkeley.cc to handle BDB 4.3.28, and re-add two features to
BDB that we require.
parent
d8c07492
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
13 deletions
+44
-13
sql/ha_berkeley.cc
sql/ha_berkeley.cc
+16
-13
storage/bdb/dbinc/db.in
storage/bdb/dbinc/db.in
+8
-0
storage/bdb/env/env_method.c
storage/bdb/env/env_method.c
+17
-0
storage/bdb/log/log_put.c
storage/bdb/log/log_put.c
+3
-0
No files found.
sql/ha_berkeley.cc
View file @
4b832c98
...
...
@@ -93,7 +93,8 @@ u_int32_t berkeley_lock_types[]=
TYPELIB
berkeley_lock_typelib
=
{
array_elements
(
berkeley_lock_names
)
-
1
,
""
,
berkeley_lock_names
,
NULL
};
static
void
berkeley_print_error
(
const
char
*
db_errpfx
,
char
*
buffer
);
static
void
berkeley_print_error
(
const
DB_ENV
*
db_env
,
const
char
*
db_errpfx
,
const
char
*
buffer
);
static
byte
*
bdb_get_key
(
BDB_SHARE
*
share
,
uint
*
length
,
my_bool
not_used
__attribute__
((
unused
)));
static
BDB_SHARE
*
get_share
(
const
char
*
table_name
,
TABLE
*
table
);
...
...
@@ -173,7 +174,7 @@ handlerton *berkeley_init(void)
if
(
opt_endinfo
)
db_env
->
set_verbose
(
db_env
,
DB_VERB_
CHKPOINT
|
DB_VERB_
DEADLOCK
|
DB_VERB_RECOVERY
,
DB_VERB_DEADLOCK
|
DB_VERB_RECOVERY
,
1
);
db_env
->
set_cachesize
(
db_env
,
0
,
berkeley_cache_size
,
0
);
...
...
@@ -245,7 +246,7 @@ static int berkeley_commit(THD *thd, bool all)
DBUG_PRINT
(
"trans"
,(
"ending transaction %s"
,
all
?
"all"
:
"stmt"
));
berkeley_trx_data
*
trx
=
(
berkeley_trx_data
*
)
thd
->
ha_data
[
berkeley_hton
.
slot
];
DB_TXN
**
txn
=
all
?
&
trx
->
all
:
&
trx
->
stmt
;
int
error
=
txn_
commit
(
*
txn
,
0
);
int
error
=
(
*
txn
)
->
commit
(
*
txn
,
0
);
*
txn
=
0
;
#ifndef DBUG_OFF
if
(
error
)
...
...
@@ -260,7 +261,7 @@ static int berkeley_rollback(THD *thd, bool all)
DBUG_PRINT
(
"trans"
,(
"aborting transaction %s"
,
all
?
"all"
:
"stmt"
));
berkeley_trx_data
*
trx
=
(
berkeley_trx_data
*
)
thd
->
ha_data
[
berkeley_hton
.
slot
];
DB_TXN
**
txn
=
all
?
&
trx
->
all
:
&
trx
->
stmt
;
int
error
=
txn_
abort
(
*
txn
);
int
error
=
(
*
txn
)
->
abort
(
*
txn
);
*
txn
=
0
;
DBUG_RETURN
(
error
);
}
...
...
@@ -318,7 +319,8 @@ int berkeley_show_logs(Protocol *protocol)
}
static
void
berkeley_print_error
(
const
char
*
db_errpfx
,
char
*
buffer
)
static
void
berkeley_print_error
(
const
DB_ENV
*
db_env
,
const
char
*
db_errpfx
,
const
char
*
buffer
)
{
sql_print_error
(
"%s: %s"
,
db_errpfx
,
buffer
);
/* purecov: tested */
}
...
...
@@ -609,7 +611,7 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
berkeley_cmp_packed_key
));
if
(
!
hidden_primary_key
)
file
->
app_private
=
(
void
*
)
(
table
->
key_info
+
table_share
->
primary_key
);
if
((
error
=
txn_begin
(
db_env
,
0
,
(
DB_TXN
**
)
&
transaction
,
0
))
||
if
((
error
=
db_env
->
txn_begin
(
db_env
,
NULL
,
(
DB_TXN
**
)
&
transaction
,
0
))
||
(
error
=
(
file
->
open
(
file
,
transaction
,
fn_format
(
name_buff
,
name
,
""
,
ha_berkeley_ext
,
2
|
4
),
...
...
@@ -648,7 +650,8 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
DBUG_PRINT
(
"bdb"
,(
"Setting DB_DUP for key %u"
,
i
));
(
*
ptr
)
->
set_flags
(
*
ptr
,
DB_DUP
);
}
if
((
error
=
txn_begin
(
db_env
,
0
,
(
DB_TXN
**
)
&
transaction
,
0
))
||
if
((
error
=
db_env
->
txn_begin
(
db_env
,
NULL
,
(
DB_TXN
**
)
&
transaction
,
0
))
||
(
error
=
((
*
ptr
)
->
open
(
*
ptr
,
transaction
,
name_buff
,
part
,
DB_BTREE
,
open_mode
,
0
)))
||
(
error
=
transaction
->
commit
(
transaction
,
0
)))
...
...
@@ -1849,7 +1852,7 @@ int ha_berkeley::external_lock(THD *thd, int lock_type)
/* We have to start a master transaction */
DBUG_PRINT
(
"trans"
,(
"starting transaction all: options: 0x%lx"
,
(
ulong
)
thd
->
options
));
if
((
error
=
txn_begin
(
db_env
,
0
,
&
trx
->
all
,
0
)))
if
((
error
=
db_env
->
txn_begin
(
db_env
,
NULL
,
&
trx
->
all
,
0
)))
{
trx
->
bdb_lock_count
--
;
// We didn't get the lock
DBUG_RETURN
(
error
);
...
...
@@ -1859,7 +1862,7 @@ int ha_berkeley::external_lock(THD *thd, int lock_type)
DBUG_RETURN
(
0
);
// Don't create stmt trans
}
DBUG_PRINT
(
"trans"
,(
"starting transaction stmt"
));
if
((
error
=
txn_begin
(
db_env
,
trx
->
all
,
&
trx
->
stmt
,
0
)))
if
((
error
=
db_env
->
txn_begin
(
db_env
,
trx
->
all
,
&
trx
->
stmt
,
0
)))
{
/* We leave the possible master transaction open */
trx
->
bdb_lock_count
--
;
// We didn't get the lock
...
...
@@ -1884,7 +1887,7 @@ int ha_berkeley::external_lock(THD *thd, int lock_type)
We must in this case commit the work to keep the row locks
*/
DBUG_PRINT
(
"trans"
,(
"commiting non-updating transaction"
));
error
=
t
xn_
commit
(
trx
->
stmt
,
0
);
error
=
t
rx
->
stmt
->
commit
(
trx
->
stmt
,
0
);
trx
->
stmt
=
transaction
=
0
;
}
}
...
...
@@ -1913,7 +1916,7 @@ int ha_berkeley::start_stmt(THD *thd)
if
(
!
trx
->
stmt
)
{
DBUG_PRINT
(
"trans"
,(
"starting transaction stmt"
));
error
=
txn_begin
(
db_env
,
trx
->
all
,
&
trx
->
stmt
,
0
);
error
=
db_env
->
txn_begin
(
db_env
,
trx
->
all
,
&
trx
->
stmt
,
0
);
trans_register_ha
(
thd
,
FALSE
,
&
berkeley_hton
);
}
transaction
=
trx
->
stmt
;
...
...
@@ -2294,7 +2297,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
free
(
stat
);
stat
=
0
;
}
if
((
key_file
[
i
]
->
stat
)(
key_file
[
i
],
(
void
*
)
&
stat
,
0
))
if
((
key_file
[
i
]
->
stat
)(
key_file
[
i
],
NULL
,
(
void
*
)
&
stat
,
0
))
goto
err
;
/* purecov: inspected */
share
->
rec_per_key
[
i
]
=
(
stat
->
bt_ndata
/
(
stat
->
bt_nkeys
?
stat
->
bt_nkeys
:
1
));
...
...
@@ -2307,7 +2310,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
free
(
stat
);
stat
=
0
;
}
if
((
file
->
stat
)(
file
,
(
void
*
)
&
stat
,
0
))
if
((
file
->
stat
)(
file
,
NULL
,
(
void
*
)
&
stat
,
0
))
goto
err
;
/* purecov: inspected */
}
pthread_mutex_lock
(
&
share
->
mutex
);
...
...
storage/bdb/dbinc/db.in
View file @
4b832c98
...
...
@@ -172,6 +172,8 @@ struct __db_dbt {
u_int32_t dlen; /* RO: get/put record length. */
u_int32_t doff; /* RO: get/put record offset. */
void *app_private; /* Application-private handle. */
#define DB_DBT_APPMALLOC 0x001 /* Callback allocated memory. */
#define DB_DBT_ISSET 0x002 /* Lower level calls set value. */
#define DB_DBT_MALLOC 0x004 /* Return in malloc'd memory. */
...
...
@@ -1734,6 +1736,10 @@ struct __db_qam_stat {
*******************************************************/
#define DB_REGION_MAGIC 0x120897 /* Environment magic number. */
typedef enum {
DB_NOTICE_LOGFILE_CHANGED
} db_notices;
/* Database Environment handle. */
struct __db_env {
/*******************************************************
...
...
@@ -1751,6 +1757,7 @@ struct __db_env {
/* Other Callbacks. */
void (*db_feedback) __P((DB_ENV *, int, int));
void (*db_paniccall) __P((DB_ENV *, int));
void (*db_noticecall) __P((DB_ENV *, db_notices));
/* App-specified alloc functions. */
void *(*db_malloc) __P((size_t));
...
...
@@ -1925,6 +1932,7 @@ struct __db_env {
int (*set_feedback) __P((DB_ENV *, void (*)(DB_ENV *, int, int)));
int (*get_flags) __P((DB_ENV *, u_int32_t *));
int (*set_flags) __P((DB_ENV *, u_int32_t, int));
void (*set_noticecall) __P((DB_ENV *, void (*)(DB_ENV *, db_notices)));
int (*get_home) __P((DB_ENV *, const char **));
int (*set_intermediate_dir) __P((DB_ENV *, int, u_int32_t));
int (*get_open_flags) __P((DB_ENV *, u_int32_t *));
...
...
storage/bdb/env/env_method.c
View file @
4b832c98
...
...
@@ -156,6 +156,7 @@ __dbenv_init(dbenv)
dbenv
->
set_feedback
=
__dbcl_env_set_feedback
;
dbenv
->
get_flags
=
__dbcl_env_get_flags
;
dbenv
->
set_flags
=
__dbcl_env_flags
;
dbenv
->
set_noticecall
=
__dbcl_env_noticecall
;
dbenv
->
set_paniccall
=
__dbcl_env_paniccall
;
dbenv
->
set_rpc_server
=
__dbcl_envrpcserver
;
dbenv
->
get_shm_key
=
__dbcl_get_shm_key
;
...
...
@@ -194,6 +195,7 @@ __dbenv_init(dbenv)
dbenv
->
get_flags
=
__dbenv_get_flags
;
dbenv
->
set_flags
=
__dbenv_set_flags
;
dbenv
->
set_intermediate_dir
=
__dbenv_set_intermediate_dir
;
dbenv
->
set_noticecall
=
__dbenv_set_noticecall
;
dbenv
->
set_paniccall
=
__dbenv_set_paniccall
;
dbenv
->
set_rpc_server
=
__dbenv_set_rpc_server_noclnt
;
dbenv
->
get_shm_key
=
__dbenv_get_shm_key
;
...
...
@@ -808,6 +810,21 @@ __dbenv_set_msgfile(dbenv, msgfile)
dbenv
->
db_msgfile
=
msgfile
;
}
/*
* __dbenv_set_noticecall --
* {DB_ENV,DB}->set_noticecall.
*
* PUBLIC: int __dbenv_set_noticecall __P((DB_ENV *, void (*)(DB_ENV *, int)));
*/
int
__dbenv_set_noticecall
(
dbenv
,
noticecall
)
DB_ENV
*
dbenv
;
void
(
*
noticecall
)
__P
((
DB_ENV
*
,
int
));
{
dbenv
->
db_noticecall
=
noticecall
;
return
(
0
);
}
/*
* __dbenv_set_paniccall --
* {DB_ENV,DB}->set_paniccall.
...
...
storage/bdb/log/log_put.c
View file @
4b832c98
...
...
@@ -376,6 +376,9 @@ __log_put_next(dbenv, lsn, dbt, hdr, old_lsnp)
* anyway.
*/
newfile
=
1
;
if
(
dbenv
->
db_noticecall
!=
NULL
)
dbenv
->
db_noticecall
(
dbenv
,
DB_NOTICE_LOGFILE_CHANGED
);
}
/*
...
...
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