Release Date: 2025-11-25 Type: Patch Release (Bug Fix, Feature, Testing) Previous Version: v1.3.3
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.
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 automaticallyBenefits:
- 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 handlersrc/app/signal_manager.h- Addlog_reopen_requestedflagsrc/app/configuration_manager.cpp- AddReopenLogFile()methodsrc/app/configuration_manager.h- DeclareReopenLogFile()src/app/application.cpp- Check SIGUSR1 in main loopdocs/en/operations.md- Documentation for log rotationdocs/ja/operations.md- Japanese documentation for log rotation
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_nameexists intable_contexts_before fetching columns - In single-table mode: check if
table_namematchestable_config_.namebefore 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 beforeFetchColumnNames()
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
- Add
RUN_SERIALfor slow index tests to prevent parallel execution issues - Add
RESOURCE_LOCKfor posting_list and snapshot tests - Fix include ordering in
sync_handler_test.cpp
- New test files: 11
- New test cases: 60+
- New lines of test code: ~3,300
| 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 |
- Stop MygramDB
- Upgrade to v1.3.4
- Restart MygramDB
No configuration changes required.
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
}
None.
No migration required. This is a backward-compatible release.