Skip to content

Commit bac36cb

Browse files
committed
feat: release 2.8.41 final polish
- fix: include tmp_table_size in per-thread memory calculation (major#864) - fix: add retry for initial connection check (major#782) - fix: improve check_removed_innodb_variables accuracy (#32) - fix: correctly handle --defaults-file without dropping options (major#605) - fix: restore Debian maintenance account automatic login (major#896) - chore: automated project maintenance and cleanup - ci: migrate maintenance script to GitHub Actions - test: update unit tests for all fixes (267 tests passed)
1 parent 56b9dd7 commit bac36cb

24 files changed

Lines changed: 378 additions & 564 deletions

.agent/rules/05_memory_protocol.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

.agent/rules/remembers.md

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Project Maintenance
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-metadata:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Install Dependencies
17+
run: |
18+
sudo apt-get update
19+
sudo apt-get install -y libpod-markdown-perl libtemplate-perl perltidy dos2unix
20+
21+
- name: Generate USAGE.md
22+
run: pod2markdown mysqltuner.pl > USAGE.md
23+
24+
- name: Tidy mysqltuner.pl
25+
run: perltidy -b mysqltuner.pl
26+
27+
- name: Update CVE List
28+
run: perl build/updateCVElist.pl
29+
30+
- name: Normalize line endings
31+
run: dos2unix mysqltuner.pl
32+
33+
- name: Generate FEATURES.md
34+
run: bash build/genFeatures.sh
35+
36+
- name: Commit and Push changes
37+
run: |
38+
git config --local user.email "action@github.com"
39+
git config --local user.name "GitHub Action"
40+
git add vulnerabilities.csv mysqltuner.pl USAGE.md FEATURES.md
41+
git diff --staged --quiet || (git commit -m "chore: automated project metadata update" && git push)

Changelog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
- refactor: replace "master"/"slave" terminology with "source"/"replica" for cultural sensitivity (#888).
1414
- fix: improve join_buffer_size recommendation formatting in Variables to Adjust (#881).
1515
- fix: suppress MySQL client warning regarding 'DISABLED' boolean value for SSL (#887).
16+
- fix: correctly handle `--defaults-file` and `--defaults-extra-file` without dropping options (#605).
17+
- fix: restore Debian maintenance account automatic login by using idiomatic boolean checks (#896).
18+
- fix: include `tmp_table_size` in per-thread memory calculation for better accuracy (#864).
19+
- fix: add retry mechanism for initial `SELECT VERSION()` query to improve connection resilience (#782).
20+
- fix: prevent `AUTO_INCREMENT` capacity false positives for empty tables (#37).
21+
- chore: automated project maintenance and cleanup (extracted `RULES.md`, `MEMORY_DB.md`, `TESTS.md`).
22+
- ci: migrate maintenance script to GitHub Actions.
1623
- chore(deps): update docker/setup-buildx-action action to v4.
1724
- chore(deps): update docker/build-push-action action to v7.
1825
- chore(deps): update docker/login-action action to v4.

GEMINI.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
For project-specific context, please refer to:
2+
- [RULES.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/RULES.md): Core constitution, execution rules, and best practices.
3+
- [MEMORY_DB.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/MEMORY_DB.md): Project evolution, version history, and systemic findings.
4+
- [TESTS.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/TESTS.md): Comprehensive guide on unit and laboratory testing.
5+
6+
---
7+
8+
Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.
9+
10+
**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
11+
12+
## 1. Think Before Coding
13+
14+
**Don't assume. Don't hide confusion. Surface tradeoffs.**
15+
16+
Before implementing:
17+
- State your assumptions explicitly. If uncertain, ask.
18+
- If multiple interpretations exist, present them - don't pick silently.
19+
- If a simpler approach exists, say so. Push back when warranted.
20+
- If something is unclear, stop. Name what's confusing. Ask.
21+
22+
## 2. Simplicity First
23+
24+
**Minimum code that solves the problem. Nothing speculative.**
25+
26+
- No features beyond what was asked.
27+
- No abstractions for single-use code.
28+
- No "flexibility" or "configurability" that wasn't requested.
29+
- No error handling for impossible scenarios.
30+
- If you write 200 lines and it could be 50, rewrite it.
31+
32+
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
33+
34+
## 3. Surgical Changes
35+
36+
**Touch only what you must. Clean up only your own mess.**
37+
38+
When editing existing code:
39+
- Don't "improve" adjacent code, comments, or formatting.
40+
- Don't refactor things that aren't broken.
41+
- Match existing style, even if you'd do it differently.
42+
- If you notice unrelated dead code, mention it - don't delete it.
43+
44+
When your changes create orphans:
45+
- Remove imports/variables/functions that YOUR changes made unused.
46+
- Don't remove pre-existing dead code unless asked.
47+
48+
The test: Every changed line should trace directly to the user's request.
49+
50+
## 4. Goal-Driven Execution
51+
52+
**Define success criteria. Loop until verified.**
53+
54+
Transform tasks into verifiable goals:
55+
- "Add validation" → "Write tests for invalid inputs, then make them pass"
56+
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
57+
- "Refactor X" → "Ensure tests pass before and after"
58+
59+
For multi-step tasks, state a brief plan:
60+
```
61+
1. [Step] → verify: [check]
62+
2. [Step] → verify: [check]
63+
3. [Step] → verify: [check]
64+
```
65+
66+
Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
67+
68+
---
69+
70+
**These guidelines are working if:** fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.

MEMORY_DB.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# MySQLTuner-perl Version Memory
2+
3+
## Current Version: 2.8.41
4+
5+
## Project Evolution & Systemic Findings
6+
7+
### System Call & Core Perl Optimization (v2.8.35+)
8+
Migrated several external commands to native Core Perl to reduce fork overhead and improve portability:
9+
- `whoami` -> `(getpwuid($<))[0]`
10+
- `env` / `printenv` -> `%ENV` hash access
11+
- `hostname` -> `Sys::Hostname::hostname()`
12+
- `grep ... /proc/meminfo` -> Native file parsing
13+
- `grep -c ^processor /proc/cpuinfo` -> Native file parsing
14+
- `which` -> Native PATH iteration
15+
- `getconf PAGESIZE` -> `POSIX::sysconf(POSIX::_SC_PAGESIZE)`
16+
- `uname` -> `POSIX::uname()` or `$^O`
17+
- `stty` -> `POSIX::Termios`
18+
- `uptime` -> `/proc/uptime` parsing or `$^T` calculation
19+
20+
### Recent Audits
21+
- **v2.8.41**:
22+
- Completed project-wide refactoring to use standard Perl Boolean practices.
23+
- Restored Debian maintenance account automatic login functionality (#896).
24+
- Improved memory calculation accuracy by including `tmp_table_size` in per-thread buffers (#864).
25+
- Added retry mechanism for initial server connection checks to improve resilience (#782).
26+
- Resolved `AUTO_INCREMENT` capacity false positives for empty tables (#37).
27+
- Corrected `check_removed_innodb_variables` false positives for injected variables (#32).
28+
- Fixed `--defaults-file` usage to prevent dropping other connection options (#605).
29+
- **v2.8.40**: Enhanced SSL/TLS security checks and cloud discovery (AWS RDS/Aurora, GCP, Azure).
30+
- **v2.8.38**: Fixed container startup failures in lab environments.
31+
- **v2.8.31**: Improved SQL check syntax for redundant index detection.

ROADMAP.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ To ensure consistency and high-density development, the following roles are defi
5959
* [x] Unified KPI (0-100) aggregating findings from Security, Performance, and Resilience.
6060
* [ ] Comparative scoring against previous runs or established industry baselines.
6161
* [/] **Predictive Capacity Planning**:
62-
* [ ] Data growth forecasting based on binlog throughput and table statistics.
62+
* [x] Data growth forecasting based on binlog throughput and table statistics.
6363
* [x] Memory headroom analysis for traffic peak forecasting.
64-
* [/] **Cluster & Replication Intelligence**:
64+
* [x] AUTO_INCREMENT capacity near max value detection.
65+
* [x] **Cluster & Replication Intelligence**:
6566
* [x] Root cause analysis for replication lag (IO/SQL thread contention).
6667
* [ ] GTID consistency checks and multi-source replication tuning.
6768
* [/] **Security Hardening 2.0**:

RULES.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# MySQLTuner-perl Project Rules
2+
3+
## Core Constitution
4+
Make `mysqltuner.pl` the most stable, portable, and reliable performance tuning advisor for MySQL, MariaDB, and Percona Server.
5+
6+
### Key Pillars
7+
- **Production Stability**: Every recommendation must be safe for production environments.
8+
- **Single-File Architecture**: Strict enforcement of a single-file structure. Modules or splitting are prohibited.
9+
- **Zero-Dependency Portability**: The script must remain self-contained and executable on any server with a base Perl installation (Core modules only).
10+
- **Universal Compatibility**: Support the widest possible range of MySQL-compatible versions (Legacy 5.5 to Modern 11.x).
11+
- **Regression Limit**: Proactively identify and prevent regressions through exhaustive automated testing.
12+
13+
## Execution Rules & Constraints
14+
1. **SINGLE FILE**: Spliting `mysqltuner.pl` into modules is **strictly prohibited**.
15+
2. **NON-REGRESSION**: Deleting existing code is **prohibited** without relocation or commenting out.
16+
3. **TDD MANDATORY**: Use a TDD approach. Validate solutions by creating test cases before final submission.
17+
4. **SAFE COMMANDS**: Always use absolute paths. Monitor every command for `exit code 0`.
18+
5. **CREDENTIAL HYGIENE**: NEVER hardcode credentials.
19+
6. **VERSION CONSISTENCY**: Version numbers MUST be synchronized across `CURRENT_VERSION.txt`, `Changelog`, and all occurrences within `mysqltuner.pl`.
20+
7. **CONVENTIONAL COMMITS**: All commit messages MUST follow the [Conventional Commits](https://www.conventionalcommits.org/) specification.
21+
8. **NO DIRECT COMMIT**: All changes SHOULD be committed via `npm run commit` or `git cz`.
22+
23+
## Best Practices
24+
1. **Multi-Version Validation**: Test diagnostic logic changes against at least one "Legacy" version (e.g. MySQL 8.0) and one "Modern" version (e.g. MariaDB 11.4).
25+
2. **System Call Resilience**: Every external command MUST check for binary existence and handle non-zero exit codes. Use `execute_system_command`.
26+
3. **"Zero-Dependency" CPAN Policy**: Use ONLY Perl "Core" modules.
27+
4. **Audit Trail**: Every recommendation MUST be documented in code with a comment pointing to official documentation.
28+
5. **Memory-Efficient Parsing**: Process logs line-by-line; NEVER load large files into memory.
29+
6. **SQL Modeling**: Use the `Modeling` array to collect schema design findings (naming, constraints, data types).

TESTS.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# MySQLTuner-perl Testing Guide
2+
3+
## Unit and Regression Tests
4+
The project uses `Test::More` for unit testing. All tests are located in the `tests/` directory.
5+
6+
### Running Unit Tests
7+
```bash
8+
make unit-tests
9+
# OR
10+
prove -r tests/
11+
```
12+
13+
## Laboratory Tests (Docker)
14+
The laboratory environment allows testing `mysqltuner.pl` against multiple database versions.
15+
16+
### Setup Vendor Repositories
17+
```bash
18+
make vendor_setup
19+
```
20+
21+
### Running Lab Tests
22+
```bash
23+
# Run tests against default environments (mysql84, mariadb1011, percona80)
24+
make test
25+
26+
# Run all database lab tests
27+
make test-all
28+
29+
# Run tests against a specific container
30+
make test-container CONTAINER=my_db_name
31+
```
32+
33+
### Lab Audit
34+
After running tests, you can audit the generated logs:
35+
```bash
36+
make audit-logs
37+
```
38+
39+
## Test Scenarios
40+
Every diagnostic change should ideally be validated in three scenarios:
41+
1. **Standard**: `./mysqltuner.pl --verbose`
42+
2. **Container**: `./mysqltuner.pl --verbose --container [ID]`
43+
3. **Dumpdir**: `./mysqltuner.pl --verbose --dumpdir=dumps`

0 commit comments

Comments
 (0)