Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion mysql_ch_replicator/binlog_replicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,14 +480,20 @@ def run(self):
continue

if log_event.event_type == EventType.QUERY.value:
logger.info(f'received query event: {event.query}')
db_name_from_query = self._try_parse_db_name_from_query(event.query)
if db_name_from_query:
log_event.db_name = db_name_from_query

if not self.settings.is_database_matches(log_event.db_name):

if log_event.event_type == EventType.QUERY.value:
logger.info(f'query event not matched')

continue

logger.debug(f'event matched {transaction_id}, {log_event.db_name}, {log_event.table_name}')
if log_event.event_type == EventType.QUERY.value:
logger.info(f'query event matched {transaction_id}, {log_event.db_name}, {log_event.table_name}')

log_event.transaction_id = transaction_id

Expand Down
6 changes: 3 additions & 3 deletions mysql_ch_replicator/db_replicator_realtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def handle_event(self, event: LogEvent):
if event.transaction_id <= self.replicator.state.last_processed_transaction_non_uploaded:
return

logger.debug(f'processing event {event.transaction_id}, {event.event_type}, {event.table_name}')
logger.info(f'processing event {event.transaction_id}, {event.event_type}, {event.table_name}')

event_handlers = {
EventType.ADD_EVENT.value: self.handle_insert_event,
Expand Down Expand Up @@ -166,8 +166,8 @@ def handle_erase_event(self, event: LogEvent):
current_table_records_to_insert.pop(record_id, None)

def handle_query_event(self, event: LogEvent):
if self.replicator.config.debug_log_level:
logger.debug(f'processing query event: {event.transaction_id}, query: {event.records}')
logger.info(f'processing query event: {event.transaction_id}, query: {event.records}')

query = strip_sql_comments(event.records)
if query.lower().startswith('alter'):
self.upload_records()
Expand Down