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
868c5872
Commit
868c5872
authored
Apr 06, 2015
by
Rik Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DB-832 capture txn start time and make it available to the txn object and live txn iterator
Conflicts: ft/txn/txn.cc
parent
c8b7fd67
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
5 deletions
+23
-5
buildheader/make_tdb.cc
buildheader/make_tdb.cc
+2
-1
ft/txn/txn.cc
ft/txn/txn.cc
+5
-0
ft/txn/txn.h
ft/txn/txn.h
+3
-0
src/tests/test_iterate_live_transactions.cc
src/tests/test_iterate_live_transactions.cc
+3
-1
src/tests/test_stress0.cc
src/tests/test_stress0.cc
+3
-1
src/ydb.cc
src/ydb.cc
+1
-2
src/ydb_txn.cc
src/ydb_txn.cc
+6
-0
No files found.
buildheader/make_tdb.cc
View file @
868c5872
...
...
@@ -587,6 +587,7 @@ static void print_db_txn_struct (void) {
"uint64_t (*get_client_id)(DB_TXN *)"
,
"bool (*is_prepared)(DB_TXN *)"
,
"DB_TXN *(*get_child)(DB_TXN *)"
,
"uint64_t (*get_start_time)(DB_TXN *)"
,
NULL
};
sort_and_dump_fields
(
"db_txn"
,
false
,
extra
);
}
...
...
@@ -786,7 +787,7 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) {
printf
(
"typedef void (*lock_timeout_callback)(DB *db, uint64_t requesting_txnid, const DBT *left_key, const DBT *right_key, uint64_t blocking_txnid);
\n
"
);
printf
(
"typedef int (*iterate_row_locks_callback)(DB **db, DBT *left_key, DBT *right_key, void *extra);
\n
"
);
printf
(
"typedef int (*iterate_transactions_callback)(
uint64_t txnid, uint64_t client_id
, iterate_row_locks_callback cb, void *locks_extra, void *extra);
\n
"
);
printf
(
"typedef int (*iterate_transactions_callback)(
DB_TXN *dbtxn
, iterate_row_locks_callback cb, void *locks_extra, void *extra);
\n
"
);
printf
(
"typedef int (*iterate_requests_callback)(DB *db, uint64_t requesting_txnid, const DBT *left_key, const DBT *right_key, uint64_t blocking_txnid, uint64_t start_time, void *extra);
\n
"
);
print_db_env_struct
();
print_db_key_range_struct
();
...
...
ft/txn/txn.cc
View file @
868c5872
...
...
@@ -342,6 +342,7 @@ static txn_child_manager tcm;
.
state
=
TOKUTXN_LIVE
,
.
num_pin
=
0
,
.
client_id
=
0
,
.
start_time
=
time
(
NULL
),
};
TOKUTXN
result
=
NULL
;
...
...
@@ -785,6 +786,10 @@ void toku_txn_set_client_id(TOKUTXN txn, uint64_t client_id) {
txn
->
client_id
=
client_id
;
}
time_t
toku_txn_get_start_time
(
struct
tokutxn
*
txn
)
{
return
txn
->
start_time
;
}
int
toku_txn_reads_txnid
(
TXNID
txnid
,
TOKUTXN
txn
)
{
int
r
=
0
;
TXNID
oldest_live_in_snapshot
=
toku_get_oldest_in_live_root_txn_list
(
txn
);
...
...
ft/txn/txn.h
View file @
868c5872
...
...
@@ -253,6 +253,7 @@ struct tokutxn {
uint32_t
num_pin
;
// number of threads (all hot indexes) that want this
// txn to not transition to commit or abort
uint64_t
client_id
;
time_t
start_time
;
};
typedef
struct
tokutxn
*
TOKUTXN
;
...
...
@@ -368,6 +369,8 @@ bool toku_txn_has_spilled_rollback(struct tokutxn *txn);
uint64_t
toku_txn_get_client_id
(
struct
tokutxn
*
txn
);
void
toku_txn_set_client_id
(
struct
tokutxn
*
txn
,
uint64_t
client_id
);
time_t
toku_txn_get_start_time
(
struct
tokutxn
*
txn
);
//
// This function is used by the leafentry iterators.
// returns TOKUDB_ACCEPT if live transaction context is allowed to read a value
...
...
src/tests/test_iterate_live_transactions.cc
View file @
868c5872
...
...
@@ -104,9 +104,11 @@ struct iterate_extra {
bool
visited_txn
[
3
];
};
static
int
iterate_callback
(
uint64_t
txnid
,
uint64_t
client_id
,
static
int
iterate_callback
(
DB_TXN
*
txn
,
iterate_row_locks_callback
iterate_locks
,
void
*
locks_extra
,
void
*
extra
)
{
uint64_t
txnid
=
txn
->
id64
(
txn
);
uint64_t
client_id
=
txn
->
get_client_id
(
txn
);
iterate_extra
*
info
=
reinterpret_cast
<
iterate_extra
*>
(
extra
);
DB
*
db
;
DBT
left_key
,
right_key
;
...
...
src/tests/test_stress0.cc
View file @
868c5872
...
...
@@ -140,9 +140,11 @@ static int UU() iterate_pending_lock_requests_op(DB_TXN *UU(txn), ARG arg, void
return
r
;
}
static
int
iterate_txns
(
uint64_t
txnid
,
uint64_t
client_id
,
static
int
iterate_txns
(
DB_TXN
*
txn
,
iterate_row_locks_callback
iterate_locks
,
void
*
locks_extra
,
void
*
extra
)
{
uint64_t
txnid
=
txn
->
id64
(
txn
);
uint64_t
client_id
=
txn
->
get_client_id
(
txn
);
invariant_null
(
extra
);
invariant
(
txnid
>
0
);
invariant
(
client_id
==
0
);
...
...
src/ydb.cc
View file @
868c5872
...
...
@@ -2500,8 +2500,7 @@ static int iter_txns_callback(TOKUTXN txn, void *extra) {
toku_pthread_rwlock_rdlock
(
&
info
->
env
->
i
->
open_dbs_rwlock
);
iter_txn_row_locks_callback_extra
e
(
info
->
env
,
&
db_txn_struct_i
(
dbtxn
)
->
lt_map
);
const
int
r
=
info
->
callback
(
toku_txn_get_txnid
(
txn
).
parent_id64
,
toku_txn_get_client_id
(
txn
),
const
int
r
=
info
->
callback
(
dbtxn
,
iter_txn_row_locks_callback
,
&
e
,
info
->
extra
);
...
...
src/ydb_txn.cc
View file @
868c5872
...
...
@@ -432,6 +432,11 @@ static DB_TXN *toku_txn_get_child(DB_TXN *txn) {
return
db_txn_struct_i
(
txn
)
->
child
;
}
static
uint64_t
toku_txn_get_start_time
(
DB_TXN
*
txn
)
{
TOKUTXN
ttxn
=
db_txn_struct_i
(
txn
)
->
tokutxn
;
return
toku_txn_get_start_time
(
ttxn
);
}
static
inline
void
txn_func_init
(
DB_TXN
*
txn
)
{
#define STXN(name) txn->name = locked_txn_ ## name
STXN
(
abort
);
...
...
@@ -450,6 +455,7 @@ static inline void txn_func_init(DB_TXN *txn) {
txn
->
id64
=
toku_txn_id64
;
txn
->
is_prepared
=
toku_txn_is_prepared
;
txn
->
get_child
=
toku_txn_get_child
;
txn
->
get_start_time
=
toku_txn_get_start_time
;
}
//
...
...
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