|
| 1 | +# MygramDB v1.2.3 Release Notes |
| 2 | + |
| 3 | +**Release Date:** 2025-11-20 |
| 4 | +**Type:** Minor Release (Feature Addition) |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +Version 1.2.3 adds two important features: configurable MySQL session timeout to prevent disconnection during long operations, and a C API for parsing web-style search expressions. This release enables better integration with external applications and improves stability for large-scale data synchronization. |
| 11 | + |
| 12 | +## What's New |
| 13 | + |
| 14 | +### 1. Configurable MySQL Session Timeout |
| 15 | + |
| 16 | +**Problem:** During long-running operations like large table synchronization or slow binlog processing, MySQL connections would timeout and disconnect, causing synchronization failures. |
| 17 | + |
| 18 | +**Solution:** Added configurable session timeout settings that automatically configure MySQL's `wait_timeout` and `interactive_timeout` on connection. |
| 19 | + |
| 20 | +**Configuration:** |
| 21 | + |
| 22 | +```yaml |
| 23 | +replication: |
| 24 | + session_timeout_sec: 28800 # 8 hours (default) |
| 25 | +``` |
| 26 | +
|
| 27 | +**Benefits:** |
| 28 | +
|
| 29 | +- Prevents unexpected disconnections during large table sync operations |
| 30 | +- Configurable timeout value to match your workload requirements |
| 31 | +- Automatically applies to both initial connection and reconnections |
| 32 | +- Default value (8 hours) suitable for most production scenarios |
| 33 | +
|
| 34 | +**Use Cases:** |
| 35 | +
|
| 36 | +- Syncing tables with millions of rows |
| 37 | +- Slow network environments where binlog processing takes time |
| 38 | +- Batch processing scenarios requiring long-lived connections |
| 39 | +
|
| 40 | +**Example:** |
| 41 | +
|
| 42 | +```yaml |
| 43 | +# For very large tables requiring 24-hour sync operations |
| 44 | +replication: |
| 45 | + session_timeout_sec: 86400 # 24 hours |
| 46 | + |
| 47 | +# For faster environments with frequent reconnections |
| 48 | +replication: |
| 49 | + session_timeout_sec: 3600 # 1 hour |
| 50 | +``` |
| 51 | +
|
| 52 | +### 2. C API for Parsing Web-Style Search Expressions |
| 53 | +
|
| 54 | +**Feature:** New public C API for parsing MygramDB search query syntax, enabling integration with other C/C++ applications. |
| 55 | +
|
| 56 | +**API Function:** |
| 57 | +
|
| 58 | +```c |
| 59 | +/** |
| 60 | + * Parse web-style search expression into structured query |
| 61 | + * @param expr Search expression string |
| 62 | + * @param table_name Target table name |
| 63 | + * @param out_query Output query structure (caller must free) |
| 64 | + * @return 0 on success, error code on failure |
| 65 | + */ |
| 66 | +int mygram_parse_search_expr( |
| 67 | + const char* expr, |
| 68 | + const char* table_name, |
| 69 | + mygram_query_t** out_query |
| 70 | +); |
| 71 | +``` |
| 72 | + |
| 73 | +**Supported Syntax:** |
| 74 | + |
| 75 | +- `SEARCH "keywords"` - Full-text search |
| 76 | +- `FILTER col:value` - Column filtering |
| 77 | +- `SORT [-]field` - Sort by field (- for descending) |
| 78 | +- `LIMIT offset,count` - Result pagination |
| 79 | + |
| 80 | +**Example Usage:** |
| 81 | + |
| 82 | +```c |
| 83 | +#include "mygram_api.h" |
| 84 | + |
| 85 | +mygram_query_t* query = NULL; |
| 86 | +int ret = mygram_parse_search_expr( |
| 87 | + "SEARCH \"hello world\" FILTER status:active SORT -created_at LIMIT 10", |
| 88 | + "articles", |
| 89 | + &query |
| 90 | +); |
| 91 | + |
| 92 | +if (ret == 0) { |
| 93 | + // Use parsed query structure |
| 94 | + // ... |
| 95 | + mygram_query_free(query); |
| 96 | +} |
| 97 | +``` |
| 98 | + |
| 99 | +**Use Cases:** |
| 100 | + |
| 101 | +- Integrating MygramDB search into existing C/C++ applications |
| 102 | +- Building custom search interfaces |
| 103 | +- Embedding MygramDB query parser in other systems |
| 104 | +- Query validation and preprocessing |
| 105 | + |
| 106 | +## Migration Guide |
| 107 | + |
| 108 | +### From v1.2.2 |
| 109 | + |
| 110 | +**No breaking changes.** This is a backward-compatible feature release. |
| 111 | + |
| 112 | +**Optional Configuration:** |
| 113 | + |
| 114 | +```yaml |
| 115 | +# Add to config.yaml if you need custom session timeout |
| 116 | +replication: |
| 117 | + session_timeout_sec: 28800 # Default value, can be omitted |
| 118 | +``` |
| 119 | +
|
| 120 | +**For C API Users:** |
| 121 | +
|
| 122 | +```c |
| 123 | +// New header to include |
| 124 | +#include "mygram_api.h" |
| 125 | + |
| 126 | +// Link against libmygram when building |
| 127 | +gcc your_app.c -lmygram -o your_app |
| 128 | +``` |
| 129 | + |
| 130 | +### Upgrade Steps |
| 131 | + |
| 132 | +**Docker users:** |
| 133 | + |
| 134 | +```bash |
| 135 | +# Pull the new image |
| 136 | +docker pull ghcr.io/libraz/mygram-db:v1.2.3 |
| 137 | + |
| 138 | +# Or update docker-compose.yml |
| 139 | +services: |
| 140 | + mygramdb: |
| 141 | + image: ghcr.io/libraz/mygram-db:v1.2.3 |
| 142 | +``` |
| 143 | + |
| 144 | +**RPM users:** |
| 145 | + |
| 146 | +```bash |
| 147 | +# Download and install new RPM |
| 148 | +sudo rpm -Uvh mygram-db-1.2.3-1.el9.x86_64.rpm |
| 149 | +``` |
| 150 | + |
| 151 | +**Source build:** |
| 152 | + |
| 153 | +```bash |
| 154 | +git checkout v1.2.3 |
| 155 | +cmake -B build -DCMAKE_BUILD_TYPE=Release |
| 156 | +cmake --build build --parallel |
| 157 | +``` |
| 158 | + |
| 159 | +## Technical Details |
| 160 | + |
| 161 | +### MySQL Session Timeout Implementation |
| 162 | + |
| 163 | +**Relevant Code:** |
| 164 | +- `src/data/mysql_connection.cpp` - Connection initialization with timeout settings |
| 165 | + |
| 166 | +**Configuration Hierarchy:** |
| 167 | + |
| 168 | +1. User-specified `replication.session_timeout_sec` |
| 169 | +2. Default: 28800 seconds (8 hours) |
| 170 | +3. Applied via `SET SESSION wait_timeout=X, interactive_timeout=X` |
| 171 | + |
| 172 | +**Behavior:** |
| 173 | + |
| 174 | +- Setting is applied immediately after connection establishment |
| 175 | +- Applies to both initial connection and automatic reconnections |
| 176 | +- MySQL server must support session variable modification |
| 177 | +- Compatible with MySQL 5.7+ and MariaDB 10.2+ |
| 178 | + |
| 179 | +### C API Architecture |
| 180 | + |
| 181 | +**Header File:** `include/mygram_api.h` |
| 182 | +**Implementation:** `src/api/mygram_api.cpp` |
| 183 | + |
| 184 | +**Design Principles:** |
| 185 | + |
| 186 | +- Pure C interface for maximum compatibility |
| 187 | +- No C++ exceptions crossing API boundary |
| 188 | +- Caller-owned memory with explicit free functions |
| 189 | +- Error codes for all failure modes |
| 190 | + |
| 191 | +**Error Codes:** |
| 192 | + |
| 193 | +```c |
| 194 | +#define MYGRAM_OK 0 |
| 195 | +#define MYGRAM_ERR_PARSE 1 // Query syntax error |
| 196 | +#define MYGRAM_ERR_INVALID_ARG 2 // NULL pointer or invalid argument |
| 197 | +#define MYGRAM_ERR_NOMEM 3 // Memory allocation failure |
| 198 | +``` |
| 199 | +
|
| 200 | +## Performance Impact |
| 201 | +
|
| 202 | +**Negligible overhead:** |
| 203 | +
|
| 204 | +- Session timeout: One-time `SET SESSION` command per connection |
| 205 | +- C API: Zero overhead (direct calls to existing parser) |
| 206 | +
|
| 207 | +**No changes to:** |
| 208 | +
|
| 209 | +- Query execution performance |
| 210 | +- Binlog processing throughput |
| 211 | +- Memory usage patterns |
| 212 | +
|
| 213 | +## Known Issues |
| 214 | +
|
| 215 | +None. |
| 216 | +
|
| 217 | +## Contributors |
| 218 | +
|
| 219 | +- @libraz |
| 220 | +
|
| 221 | +## Links |
| 222 | +
|
| 223 | +- [Full Changelog](https://github.com/libraz/mygram-db/compare/v1.2.2...v1.2.3) |
| 224 | +- [Docker Image](https://github.com/libraz/mygram-db/pkgs/container/mygram-db) |
| 225 | +- [Configuration Reference](../en/configuration.md) |
| 226 | +- [API Documentation](../en/api.md) |
| 227 | +
|
| 228 | +--- |
| 229 | +
|
| 230 | +**Questions or Issues?** |
| 231 | +Please open an issue on [GitHub Issues](https://github.com/libraz/mygram-db/issues) |
0 commit comments