1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

WL#3339 (Issue warnings when statement-based replication may fail):

Replacing binlog_row_based_if_mixed with variable binlog_stmt_flags
holding several flags and adding member functions to manipulate the
flags.

Added code to generate a warning when an attempt to log an unsafe
statement to the binary log was made. The warning is both pushed to the
SHOW WARNINGS table and written to the error log. The prevent flooding
the error log, the warning is just written to the error log once per
open session.
This commit is contained in:
mats@romeo.kindahl.net
2007-05-14 14:45:38 +02:00
parent 9064773393
commit 6a7925a262
13 changed files with 108 additions and 18 deletions

View File

@ -909,14 +909,6 @@ public:
byte **sroutines_list_own_last;
uint sroutines_list_own_elements;
/*
Tells if the parsing stage detected that some items require row-based
binlogging to give a reliable binlog/replication, or if we will use
stored functions or triggers which themselves need require row-based
binlogging.
*/
bool binlog_row_based_if_mixed;
/*
These constructor and destructor serve for creation/destruction
of Query_tables_list instances which are used as backup storage.
@ -964,6 +956,41 @@ public:
query_tables_own_last= 0;
}
}
/**
Has the parser/scanner detected that this statement is unsafe?
*/
inline bool is_stmt_unsafe() const {
return binlog_stmt_flags & (1U << BINLOG_STMT_FLAG_UNSAFE);
}
/**
Flag the current (top-level) statement as unsafe.
The flag will be reset after the statement has finished.
*/
inline void set_stmt_unsafe() {
binlog_stmt_flags|= (1U << BINLOG_STMT_FLAG_UNSAFE);
}
inline void clear_stmt_unsafe() {
binlog_stmt_flags&= ~(1U << BINLOG_STMT_FLAG_UNSAFE);
}
private:
enum enum_binlog_stmt_flag {
BINLOG_STMT_FLAG_UNSAFE,
BINLOG_STMT_FLAG_COUNT
};
/*
Tells if the parsing stage detected properties of the statement,
for example: that some items require row-based binlogging to give
a reliable binlog/replication, or if we will use stored functions
or triggers which themselves need require row-based binlogging.
*/
uint32 binlog_stmt_flags;
};
@ -1299,6 +1326,7 @@ typedef struct st_lex : public Query_tables_list
void restore_backup_query_tables_list(Query_tables_list *backup);
bool table_or_sp_used();
} LEX;
struct st_lex_local: public st_lex