Skip to content

Latest commit

 

History

History
218 lines (141 loc) · 6.1 KB

File metadata and controls

218 lines (141 loc) · 6.1 KB

MygramDB v1.3.4 Release Notes

Release Date: 2025-11-25 Type: Patch Release (Bug Fix, Feature, Testing) Previous Version: v1.3.3


Overview

Version 1.3.4 adds zero-downtime log rotation support via SIGUSR1 signal, fixes permission errors when using multi-table databases, and significantly improves unit test coverage.


New Features

1. SIGUSR1 Signal Handler for Zero-Downtime Log Rotation

Type: Feature

Log files can now be rotated without restarting MygramDB, similar to nginx's log rotation approach.

Usage:

# 1. Rotate the log file
mv /var/log/mygramdb/mygramdb.log /var/log/mygramdb/mygramdb.log.1

# 2. Signal MygramDB to reopen log files
kill -USR1 $(pidof mygramdb)

# 3. New log file is created automatically

Benefits:

  • Zero-downtime log rotation
  • Compatible with logrotate and similar tools
  • No missed log entries during rotation

Files Changed:

  • src/app/signal_manager.cpp - Add SIGUSR1 handler
  • src/app/signal_manager.h - Add log_reopen_requested flag
  • src/app/configuration_manager.cpp - Add ReopenLogFile() method
  • src/app/configuration_manager.h - Declare ReopenLogFile()
  • src/app/application.cpp - Check SIGUSR1 in main loop
  • docs/en/operations.md - Documentation for log rotation
  • docs/ja/operations.md - Japanese documentation for log rotation

Bug Fixes

1. Skip FetchColumnNames for Non-Monitored Tables

Severity: Medium - Permission Errors

Problem: FetchColumnNames() was called for all TABLE_MAP_EVENTs regardless of whether the table was monitored. This caused SELECT permission errors for tables that MygramDB doesn't have access to (e.g., MySQL internal tables like performance_schema.ignore_threads).

Symptoms:

[error] SELECT query failed for table 'performance_schema.ignore_threads': SELECT command denied
[error] Failed to fetch column names for table 'ignore_threads'

Fix:

  • In multi-table mode: check if table_name exists in table_contexts_ before fetching columns
  • In single-table mode: check if table_name matches table_config_.name before fetching columns

Benefits:

  • No more permission errors for non-monitored tables
  • Reduced unnecessary SHOW COLUMNS queries
  • Cleaner error logs

Files Changed:

  • src/mysql/binlog_reader.cpp - Add table existence checks before FetchColumnNames()

Testing Improvements

New Unit Tests

This release adds comprehensive unit test coverage across multiple modules:

CommandLineParser tests (tests/app/command_line_parser_test.cpp):

  • Argument parsing, flags, options, error cases

BinlogFilterEvaluator tests (tests/mysql/binlog_filter_evaluator_test.cpp):

  • Filter value comparison and evaluation

GTIDEncoder tests (tests/mysql/gtid_encoder_test.cpp):

  • GTID encoding/decoding tests

TableCatalog tests (tests/server/table_catalog_test.cpp):

  • Table context management tests

SnapshotScheduler tests (tests/server/snapshot_scheduler_test.cpp):

  • Snapshot scheduling tests

BinlogReader tests (tests/mysql/binlog_reader_multitable_test.cpp):

  • Regression tests for non-monitored table handling

TableMetadataCache tests (tests/mysql/table_metadata_test.cpp):

  • 19 new tests covering Add, Get, Remove, Clear operations
  • Edge cases: large table IDs, empty strings, column types

CacheKey tests (tests/cache/cache_key_test.cpp):

  • 11 new tests for CacheKey operations
  • Constructor, equality, comparison, and hash function tests

ErrorCodeToString tests (tests/utils/error_test.cpp):

  • 13 new tests for comprehensive ErrorCodeToString coverage

SignalManager tests (tests/app/signal_manager_test.cpp):

  • Signal handling tests for new SIGUSR1 functionality

ConfigurationManager tests (tests/app/configuration_manager_test.cpp):

  • Log reopen functionality tests

Test Configuration Improvements

  • Add RUN_SERIAL for slow index tests to prevent parallel execution issues
  • Add RESOURCE_LOCK for posting_list and snapshot tests
  • Fix include ordering in sync_handler_test.cpp

Test Statistics

  • New test files: 11
  • New test cases: 60+
  • New lines of test code: ~3,300

Files Changed

File Changes
src/mysql/binlog_reader.cpp Skip FetchColumnNames for non-monitored tables
src/app/signal_manager.cpp Add SIGUSR1 handler
src/app/signal_manager.h Add log_reopen_requested flag
src/app/configuration_manager.cpp Add ReopenLogFile()
src/app/configuration_manager.h Declare ReopenLogFile()
src/app/application.cpp Check SIGUSR1 in main loop
docs/en/operations.md Log rotation documentation
docs/ja/operations.md Log rotation documentation (Japanese)
tests/app/command_line_parser_test.cpp New test file
tests/app/signal_manager_test.cpp New test file
tests/app/configuration_manager_test.cpp New test file
tests/mysql/binlog_filter_evaluator_test.cpp New test file
tests/mysql/gtid_encoder_test.cpp New test file
tests/mysql/binlog_reader_multitable_test.cpp New test file
tests/mysql/table_metadata_test.cpp New test file
tests/server/table_catalog_test.cpp New test file
tests/server/snapshot_scheduler_test.cpp New test file
tests/cache/cache_key_test.cpp New test file
tests/utils/error_test.cpp New test file
tests/index/CMakeLists.txt Test configuration improvements
tests/server/CMakeLists.txt New test targets
tests/mysql/CMakeLists.txt New test targets

Upgrade Instructions

From v1.3.3 or earlier

  1. Stop MygramDB
  2. Upgrade to v1.3.4
  3. Restart MygramDB

No configuration changes required.

Using Log Rotation (New Feature)

To enable log rotation with logrotate, create /etc/logrotate.d/mygramdb:

/var/log/mygramdb/*.log {
    daily
    rotate 7
    compress
    delaycompress
    missingok
    notifempty
    postrotate
        /bin/kill -USR1 $(cat /var/run/mygramdb.pid 2>/dev/null) 2>/dev/null || true
    endscript
}

Known Issues

None.


Migration Notes

No migration required. This is a backward-compatible release.