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
d83bc171
Commit
d83bc171
authored
Aug 23, 2006
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed global variables
parent
cd40855e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
16 deletions
+12
-16
storage/maria/trxman.c
storage/maria/trxman.c
+10
-13
storage/maria/trxman.h
storage/maria/trxman.h
+1
-1
unittest/maria/trxman-t.c
unittest/maria/trxman-t.c
+1
-2
No files found.
storage/maria/trxman.c
View file @
d83bc171
...
...
@@ -8,7 +8,7 @@ TRX active_list_min, active_list_max,
committed_list_min
,
committed_list_max
,
*
pool
;
pthread_mutex_t
LOCK_trx_list
;
uint
active
_transactions
;
uint
trxman_active_transactions
,
trxman_allocated
_transactions
;
TrID
global_trid_generator
;
TRX
**
short_id_to_trx
;
...
...
@@ -30,7 +30,8 @@ int trxman_init()
active_list_max
.
next
=
active_list_min
.
prev
=
0
;
active_list_max
.
prev
=
&
active_list_min
;
active_list_min
.
next
=
&
active_list_max
;
active_transactions
=
0
;
trxman_active_transactions
=
0
;
trxman_allocated_transactions
=
0
;
committed_list_max
.
commit_trid
=
~
0
;
committed_list_max
.
next
=
committed_list_min
.
prev
=
0
;
...
...
@@ -54,7 +55,7 @@ int trxman_init()
int
trxman_destroy
()
{
DBUG_ASSERT
(
trid_to_trx
.
count
==
0
);
DBUG_ASSERT
(
active_transactions
==
0
);
DBUG_ASSERT
(
trxman_
active_transactions
==
0
);
DBUG_ASSERT
(
active_list_max
.
prev
==
&
active_list_min
);
DBUG_ASSERT
(
active_list_min
.
next
==
&
active_list_max
);
DBUG_ASSERT
(
committed_list_max
.
prev
==
&
committed_list_min
);
...
...
@@ -62,7 +63,7 @@ int trxman_destroy()
while
(
pool
)
{
TRX
*
tmp
=
pool
->
next
;
my_free
(
pool
,
MYF
(
0
));
my_free
(
(
void
*
)
pool
,
MYF
(
0
));
pool
=
tmp
;
}
lf_hash_destroy
(
&
trid_to_trx
);
...
...
@@ -93,21 +94,17 @@ static void set_short_id(TRX *trx)
trx
->
short_id
=
i
;
}
extern
int
global_malloc
;
TRX
*
trxman_new_trx
()
{
TRX
*
trx
;
my_atomic_add32
(
&
active_transactions
,
1
);
my_atomic_add32
(
&
trxman_
active_transactions
,
1
);
/*
we need a mutex here to ensure that
transactions in the active list are ordered by the trid.
So, incrementing global_trid_generator and
adding to the list must be atomic.
see trxman_end_trx to see why we need a mutex here
and as we have a mutex, we can as well do everything
under it - allocating a TRX, incrementing active_transactions,
under it - allocating a TRX, incrementing
trxman_
active_transactions,
setting trx->min_read_from.
Note that all the above is fast. generating short_id may be slow,
...
...
@@ -123,7 +120,7 @@ TRX *trxman_new_trx()
if
(
!
trx
)
{
trx
=
(
TRX
*
)
my_malloc
(
sizeof
(
TRX
),
MYF
(
MY_WME
));
global_malloc
++
;
trxman_allocated_transactions
++
;
}
if
(
!
trx
)
return
0
;
...
...
@@ -213,7 +210,7 @@ void trxman_end_trx(TRX *trx, my_bool commit)
}
pthread_mutex_unlock
(
&
LOCK_trx_list
);
my_atomic_add32
(
&
active_transactions
,
-
1
);
my_atomic_add32
(
&
trxman_
active_transactions
,
-
1
);
while
(
free_me
)
{
...
...
storage/maria/trxman.h
View file @
d83bc171
...
...
@@ -12,7 +12,7 @@ typedef struct st_transaction
#define SHORT_ID_MAX 65535
extern
uint
active
_transactions
;
extern
uint
trxman_active_transactions
,
trxman_allocated
_transactions
;
extern
TRX
**
short_id_to_trx
;
extern
my_atomic_rwlock_t
LOCK_short_id_to_trx
;
...
...
unittest/maria/trxman-t.c
View file @
d83bc171
...
...
@@ -106,7 +106,6 @@ void run_test(const char *test, pthread_handler handler, int n, int m)
ok
(
litmus
==
0
,
"tested %s in %g secs (%d)"
,
test
,
((
double
)
now
)
/
1e7
,
litmus
);
}
int
global_malloc
=
0
;
int
main
()
{
plan
(
1
);
...
...
@@ -127,7 +126,7 @@ int main()
trxman_init
();
run_test
(
"trxman"
,
test_trxman
,
THREADS
,
CYCLES
);
trxman_destroy
();
diag
(
"mallocs: %d
\n
"
,
global_malloc
);
diag
(
"mallocs: %d
\n
"
,
trxman_allocated_transactions
);
pthread_mutex_destroy
(
&
rt_mutex
);
pthread_cond_destroy
(
&
rt_cond
);
...
...
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