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
cf467367
Commit
cf467367
authored
Jun 15, 2006
by
mats@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing code to avoid compile problem on Solaris (aCC).
parent
95b1c019
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
75 deletions
+83
-75
sql/handler.cc
sql/handler.cc
+83
-75
No files found.
sql/handler.cc
View file @
cf467367
...
...
@@ -3221,99 +3221,107 @@ namespace {
THD::lock
THD::locked_tables
*/
static
int
write_locked_table_maps
(
THD
*
thd
)
namespace
{
DBUG_ENTER
(
"write_locked_table_maps"
);
DBUG_PRINT
(
"enter"
,
(
"thd=%p, thd->lock=%p, thd->locked_tables=%p"
,
thd
,
thd
->
lock
,
thd
->
locked_tables
));
if
(
thd
->
get_binlog_table_maps
()
==
0
)
int
write_locked_table_maps
(
THD
*
thd
)
{
/*
Exactly one table has to be locked, otherwise this code is not
guaranteed to work.
*/
DBUG_ASSERT
((
thd
->
lock
!=
NULL
)
+
(
thd
->
locked_tables
!=
NULL
)
==
1
);
MYSQL_LOCK
*
lock
=
thd
->
lock
?
thd
->
lock
:
thd
->
locked_tables
;
DBUG_ASSERT
(
lock
->
table_count
>
0
);
TABLE
**
const
end_ptr
=
lock
->
table
+
lock
->
table_count
;
for
(
TABLE
**
table_ptr
=
lock
->
table
;
table_ptr
!=
end_ptr
;
++
table_ptr
)
DBUG_ENTER
(
"write_locked_table_maps"
);
DBUG_PRINT
(
"enter"
,
(
"thd=%p, thd->lock=%p, thd->locked_tables=%p"
,
thd
,
thd
->
lock
,
thd
->
locked_tables
));
if
(
thd
->
get_binlog_table_maps
()
==
0
)
{
TABLE
*
const
table
=
*
table_ptr
;
DBUG_PRINT
(
"info"
,
(
"Checking table %s"
,
table
->
s
->
table_name
));
if
(
table
->
current_lock
==
F_WRLCK
&&
check_table_binlog_row_based
(
thd
,
table
))
/*
Exactly one table has to be locked, otherwise this code is not
guaranteed to work.
*/
DBUG_ASSERT
((
thd
->
lock
!=
NULL
)
+
(
thd
->
locked_tables
!=
NULL
)
==
1
);
MYSQL_LOCK
*
lock
=
thd
->
lock
?
thd
->
lock
:
thd
->
locked_tables
;
DBUG_ASSERT
(
lock
->
table_count
>
0
);
TABLE
**
const
end_ptr
=
lock
->
table
+
lock
->
table_count
;
for
(
TABLE
**
table_ptr
=
lock
->
table
;
table_ptr
!=
end_ptr
;
++
table_ptr
)
{
int
const
has_trans
=
table
->
file
->
has_transactions
();
int
const
error
=
thd
->
binlog_write_table_map
(
table
,
has_trans
);
/*
If an error occurs, it is the responsibility of the caller to
roll back the transaction.
*/
if
(
unlikely
(
error
))
DBUG_RETURN
(
1
);
TABLE
*
const
table
=
*
table_ptr
;
DBUG_PRINT
(
"info"
,
(
"Checking table %s"
,
table
->
s
->
table_name
));
if
(
table
->
current_lock
==
F_WRLCK
&&
check_table_binlog_row_based
(
thd
,
table
))
{
int
const
has_trans
=
table
->
file
->
has_transactions
();
int
const
error
=
thd
->
binlog_write_table_map
(
table
,
has_trans
);
/*
If an error occurs, it is the responsibility of the caller to
roll back the transaction.
*/
if
(
unlikely
(
error
))
DBUG_RETURN
(
1
);
}
}
}
DBUG_RETURN
(
0
);
}
DBUG_RETURN
(
0
);
}
template
<
class
RowsEventT
>
int
binlog_log_row
(
TABLE
*
table
,
const
byte
*
before_record
,
const
byte
*
after_record
)
{
if
(
table
->
file
->
is_injective
())
return
0
;
bool
error
=
0
;
THD
*
const
thd
=
table
->
in_use
;
if
(
check_table_binlog_row_based
(
thd
,
table
))
template
<
class
RowsEventT
>
int
binlog_log_row
(
TABLE
*
table
,
const
byte
*
before_record
,
const
byte
*
after_record
)
{
MY_BITMAP
cols
;
/* Potential buffer on the stack for the bitmap */
uint32
bitbuf
[
BITMAP_STACKBUF_SIZE
/
sizeof
(
uint32
)];
uint
n_fields
=
table
->
s
->
fields
;
my_bool
use_bitbuf
=
n_fields
<=
sizeof
(
bitbuf
)
*
8
;
if
(
table
->
file
->
is_injective
())
return
0
;
bool
error
=
0
;
THD
*
const
thd
=
table
->
in_use
;
/*
If there are no table maps written to the binary log, this is
the first row handled in this statement. In that case, we need
to write table maps for all locked tables to the binary log.
*/
if
(
likely
(
!
(
error
=
bitmap_init
(
&
cols
,
use_bitbuf
?
bitbuf
:
NULL
,
(
n_fields
+
7
)
&
~
7UL
,
false
))))
if
(
check_table_binlog_row_based
(
thd
,
table
))
{
bitmap_set_all
(
&
cols
);
if
(
likely
(
!
(
error
=
write_locked_table_maps
(
thd
))))
MY_BITMAP
cols
;
/* Potential buffer on the stack for the bitmap */
uint32
bitbuf
[
BITMAP_STACKBUF_SIZE
/
sizeof
(
uint32
)];
uint
n_fields
=
table
->
s
->
fields
;
my_bool
use_bitbuf
=
n_fields
<=
sizeof
(
bitbuf
)
*
8
;
/*
If there are no table maps written to the binary log, this is
the first row handled in this statement. In that case, we need
to write table maps for all locked tables to the binary log.
*/
if
(
likely
(
!
(
error
=
bitmap_init
(
&
cols
,
use_bitbuf
?
bitbuf
:
NULL
,
(
n_fields
+
7
)
&
~
7UL
,
false
))))
{
error
=
RowsEventT
::
binlog_row_logging_function
(
thd
,
table
,
table
->
file
->
has_transactions
(),
&
cols
,
table
->
s
->
fields
,
before_record
,
after_record
);
bitmap_set_all
(
&
cols
);
if
(
likely
(
!
(
error
=
write_locked_table_maps
(
thd
))))
{
error
=
RowsEventT
::
binlog_row_logging_function
(
thd
,
table
,
table
->
file
->
has_transactions
(),
&
cols
,
table
->
s
->
fields
,
before_record
,
after_record
);
}
if
(
!
use_bitbuf
)
bitmap_free
(
&
cols
);
}
if
(
!
use_bitbuf
)
bitmap_free
(
&
cols
);
}
return
error
?
HA_ERR_RBR_LOGGING_FAILED
:
0
;
}
return
error
?
HA_ERR_RBR_LOGGING_FAILED
:
0
;
}
/*
Instantiate the versions we need for the above template function, because we
have -fno-implicit-template as compiling option.
*/
/*
Instantiate the versions we need for the above template function,
because we
have -fno-implicit-template as compiling option.
*/
template
int
binlog_log_row
<
Write_rows_log_event
>(
TABLE
*
,
const
byte
*
,
const
byte
*
);
template
int
binlog_log_row
<
Delete_rows_log_event
>(
TABLE
*
,
const
byte
*
,
const
byte
*
);
template
int
binlog_log_row
<
Update_rows_log_event
>(
TABLE
*
,
const
byte
*
,
const
byte
*
);
template
int
binlog_log_row
<
Write_rows_log_event
>(
TABLE
*
,
const
byte
*
,
const
byte
*
);
template
int
binlog_log_row
<
Delete_rows_log_event
>(
TABLE
*
,
const
byte
*
,
const
byte
*
);
template
int
binlog_log_row
<
Update_rows_log_event
>(
TABLE
*
,
const
byte
*
,
const
byte
*
);
}
#endif
/* HAVE_ROW_BASED_REPLICATION */
...
...
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