Skip to content

Commit 0d55ab5

Browse files
authored
Merge branch 'v3.0' into v3.0_get_server_version
Signed-off-by: René Cannaò <[email protected]>
2 parents ae30eea + 65dbe90 commit 0d55ab5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+7513
-1081
lines changed

.aider.conf.yml

Lines changed: 456 additions & 0 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# Internal Repos
2+
priv-infra/
3+
4+
# direnv
5+
.envrc.local
6+
7+
8+
# Intelij
9+
.idea/
10+
11+
# VS Code
12+
.vs/
13+
14+
# Sonar
15+
.scannerwork/
16+
.vs/
17+
bw-output/
18+
out/
19+
sonar/
20+
21+
122
# Object files
223
*.o
324
*.ko
@@ -151,4 +172,5 @@ proxysql-save.cfg
151172
test/tap/tests/test_cluster_sync_config/cluster_sync_node_stderr.txt
152173
test/tap/tests/test_cluster_sync_config/proxysql*.pem
153174
test/tap/tests/test_cluster_sync_config/test_cluster_sync.cnf
175+
.aider*
154176
GEMINI.md

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ amd64-almalinux: almalinux8 almalinux8-clang almalinux8-dbg almalinux9 almalinux
319319
amd64-centos: centos9 centos9-clang centos9-dbg centos10 centos10-clang centos10-dbg
320320
amd64-debian: debian12 debian12-clang debian12-dbg debian13 debian13-clang debian13-dbg
321321
amd64-fedora: fedora40 fedora40-clang fedora40-dbg fedora41 fedora41-clang fedora41-dbg fedora42 fedora42-clang fedora42-dbg
322-
amd64-opensuse: opensuse15 opensuse15-clang opensuse15-dbg
322+
amd64-opensuse: opensuse15 opensuse15-clang opensuse15-dbg opensuse16 opensuse16-clang opensuse16-dbg
323323
amd64-ubuntu: ubuntu22 ubuntu22-clang ubuntu22-dbg ubuntu24 ubuntu24-clang ubuntu24-dbg
324324
amd64-pkglist:
325325
@${MAKE} -nk amd64-packages 2>/dev/null | grep -Po '(?<=binaries/)proxysql\S+$$'
@@ -330,7 +330,7 @@ arm64-almalinux: almalinux8 almalinux9 almalinux10
330330
arm64-centos: centos9 centos10
331331
arm64-debian: debian12 debian13
332332
arm64-fedora: fedora40 fedora41 fedora42
333-
arm64-opensuse: opensuse15
333+
arm64-opensuse: opensuse15 opensuse16
334334
arm64-ubuntu: ubuntu22 ubuntu24
335335
arm64-pkglist:
336336
@${MAKE} -nk arm64-packages 2>/dev/null | grep -Po '(?<=binaries/)proxysql\S+$$'

deps/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ postgresql/postgresql/src/interfaces/libpq/libpq.a:
306306
cd postgresql/postgresql && patch -p0 < ../handle_row_data.patch
307307
cd postgresql/postgresql && patch -p0 < ../fmt_err_msg.patch
308308
cd postgresql/postgresql && patch -p0 < ../bind_fmt_text.patch
309+
cd postgresql/postgresql && patch -p0 < ../pqsendpipelinesync.patch
309310
#cd postgresql/postgresql && LD_LIBRARY_PATH="$(shell pwd)/libssl/openssl" ./configure --with-ssl=openssl --with-includes="$(shell pwd)/libssl/openssl/include/" --with-libraries="$(shell pwd)/libssl/openssl/" --without-readline --enable-debug CFLAGS="-ggdb -O0 -fno-omit-frame-pointer" CPPFLAGS="-g -O0"
310311
cd postgresql/postgresql && LD_LIBRARY_PATH="$(SSL_LDIR)" ./configure --with-ssl=openssl --with-includes="$(SSL_IDIR)" --with-libraries="$(SSL_LDIR)" --without-readline
311312
cd postgresql/postgresql/src/interfaces/libpq && CC=${CC} CXX=${CXX} ${MAKE} MAKELEVEL=0
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
diff --git src/interfaces/libpq/fe-exec.c src/interfaces/libpq/fe-exec.c
2+
index b833e76..51ad8d8 100644
3+
--- src/interfaces/libpq/fe-exec.c
4+
+++ src/interfaces/libpq/fe-exec.c
5+
@@ -4558,3 +4558,65 @@ int PShandleRowData(PGconn *conn, bool is_first_packet, PSresult* result) {
6+
return psHandleRowData(conn, is_first_packet, result);
7+
}
8+
9+
+int
10+
+PQsendPipelineSync(PGconn *conn)
11+
+{
12+
+ PGcmdQueueEntry *entry;
13+
+
14+
+ if (!conn)
15+
+ return 0;
16+
+
17+
+ if (conn->pipelineStatus == PQ_PIPELINE_OFF)
18+
+ {
19+
+ libpq_append_conn_error(conn, "cannot send pipeline when not in pipeline mode");
20+
+ return 0;
21+
+ }
22+
+
23+
+ switch (conn->asyncStatus)
24+
+ {
25+
+ case PGASYNC_COPY_IN:
26+
+ case PGASYNC_COPY_OUT:
27+
+ case PGASYNC_COPY_BOTH:
28+
+ /* should be unreachable */
29+
+ appendPQExpBufferStr(&conn->errorMessage,
30+
+ "internal error: cannot send pipeline while in COPY\n");
31+
+ return 0;
32+
+ case PGASYNC_READY:
33+
+ case PGASYNC_READY_MORE:
34+
+ case PGASYNC_BUSY:
35+
+ case PGASYNC_IDLE:
36+
+ case PGASYNC_PIPELINE_IDLE:
37+
+ /* OK to send sync */
38+
+ break;
39+
+ }
40+
+
41+
+ entry = pqAllocCmdQueueEntry(conn);
42+
+ if (entry == NULL)
43+
+ return 0; /* error msg already set */
44+
+
45+
+ entry->queryclass = PGQUERY_SYNC;
46+
+ entry->query = NULL;
47+
+
48+
+ /* construct the Sync message */
49+
+ if (pqPutMsgStart('S', conn) < 0 ||
50+
+ pqPutMsgEnd(conn) < 0)
51+
+ goto sendFailed;
52+
+
53+
+ /*
54+
+ * Give the data a push (in pipeline mode, only if we're past the size
55+
+ * threshold). In nonblock mode, don't complain if we're unable to send
56+
+ * it all; PQgetResult() will do any additional flushing needed.
57+
+ */
58+
+ if (pqPipelineFlush(conn) < 0)
59+
+ goto sendFailed;
60+
+
61+
+ /* OK, it's launched! */
62+
+ pqAppendCmdQueueEntry(conn, entry);
63+
+
64+
+ return 1;
65+
+
66+
+sendFailed:
67+
+ pqRecycleCmdQueueEntry(conn, entry);
68+
+ /* error message should be set up already */
69+
+ return 0;
70+
+}
71+
diff --git src/interfaces/libpq/libpq-fe.h src/interfaces/libpq/libpq-fe.h
72+
index 47f25e0..b769b64 100644
73+
--- src/interfaces/libpq/libpq-fe.h
74+
+++ src/interfaces/libpq/libpq-fe.h
75+
@@ -688,6 +688,9 @@ extern const PGresult *PQgetResultFromPGconn(PGconn *conn);
76+
/* ProxySQL special handler function */
77+
extern int PShandleRowData(PGconn *conn, bool is_first_packet, PSresult* result);
78+
79+
+/* Send a pipeline sync message without flushing the send buffer */
80+
+extern int PQsendPipelineSync(PGconn *conn);
81+
+
82+
#ifdef __cplusplus
83+
}
84+
#endif

doc/AI-DOCUMENTATION-FRAMEWORK.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# AI Documentation Framework
2+
3+
## Overview
4+
5+
ProxySQL uses AI-generated documentation to accelerate developer onboarding and codebase exploration while maintaining transparency about accuracy limitations.
6+
7+
## Documentation Tiers
8+
9+
### 🔬 AI-Generated (Tier 1)
10+
- **Purpose**: Exploration guides and starting points
11+
- **Verification**: NON-VERIFIED
12+
- **Maintenance**: Community contributions encouraged
13+
- **Update**: As needed when codebase changes significantly
14+
15+
### 📋 Human-Verified (Tier 2)
16+
- **Purpose**: Critical operational documentation
17+
- **Verification**: REQUIRED
18+
- **Maintenance**: Maintainer-reviewed
19+
- **Update**: With each relevant change
20+
21+
### 🔧 Living Documentation (Tier 3)
22+
- **Purpose**: Auto-generated from source
23+
- **Verification**: Automated validation
24+
- **Maintenance**: CI/CD integration
25+
- **Update**: Continuous
26+
27+
## AI Documentation Standards
28+
29+
### Required Disclaimer
30+
Every AI-generated document must include:
31+
32+
```markdown
33+
> **⚠️ Important Notice**: This documentation was generated by AI and may contain inaccuracies.
34+
> It should be used as a starting point for exploration only. Always verify critical information
35+
> against the actual source code.
36+
>
37+
> **Last AI Update**: [DATE]
38+
> **Status**: NON-VERIFIED
39+
> **Maintainer**: [ASSIGNED]
40+
```
41+
42+
### File Organization
43+
```
44+
doc/
45+
├── ai-generated/ # AI-generated exploration guides
46+
│ ├── architecture/ # Architecture documentation
47+
│ └── DOCUMENTATION-INDEX.md
48+
├── internal/ # Human-verified technical docs
49+
├── release_notes/ # Official release notes
50+
└── README.md # This guide
51+
```
52+
53+
## Verification Process
54+
55+
### When to Verify
56+
- Security-related documentation
57+
- Build and installation instructions
58+
- API contracts and interfaces
59+
- Performance-critical information
60+
61+
### Verification Checklist
62+
- [ ] Code references are accurate
63+
- [ ] File paths are correct
64+
- [ ] Technical details match implementation
65+
- [ ] Examples work as described
66+
67+
## Maintenance Guidelines
68+
69+
### AI Documentation Updates
70+
1. Review after major feature changes
71+
2. Update when architectural patterns shift
72+
3. Community corrections welcome
73+
4. Maintain disclaimer format
74+
75+
### Automated Validation
76+
Where possible, include validation commands:
77+
```markdown
78+
**Validation Command**:
79+
```bash
80+
grep -n "class MySQL_Handler" src/protocol/mysql/protocol_mysql.cpp
81+
```
82+
```
83+
84+
## Contributing
85+
86+
### Improving AI Documentation
87+
1. Identify inaccuracies
88+
2. Submit corrections via PR
89+
3. Add validation commands
90+
4. Update disclaimer date
91+
92+
### Adding New AI Documentation
93+
1. Follow the template format
94+
2. Include required disclaimer
95+
3. Place in appropriate `ai-generated/` subdirectory
96+
4. Update main documentation index
97+
98+
## Benefits
99+
100+
- **Faster Onboarding**: Developers get immediate guidance
101+
- **Reduced Burden**: Critical verification focused on essential docs
102+
- **Transparency**: Clear status indicators for all documentation
103+
- **Community-Driven**: Easy contribution process for improvements
104+
105+
## Limitations
106+
107+
- AI documentation may contain technical inaccuracies
108+
- Not suitable for critical operational procedures
109+
- Requires human verification for security-sensitive information
110+
- May become outdated between major updates
111+
112+
---
113+
114+
This framework balances the productivity benefits of AI-generated documentation with the accuracy requirements of a critical database proxy system.

doc/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# ProxySQL Documentation Guide
2+
3+
## Documentation Structure
4+
5+
ProxySQL documentation is organized into different tiers to help developers find the information they need:
6+
7+
### 🔬 AI-Generated Documentation (Exploration Guides)
8+
9+
The `ai-generated/` directory contains documentation created by AI assistants to help developers explore the codebase:
10+
11+
> **⚠️ Important Notice**: AI-generated documentation may contain inaccuracies and should be used as a starting point for exploration only. Always verify critical information against the actual source code.
12+
13+
**Available AI-generated guides:**
14+
- **`ai-generated/DOCUMENTATION-INDEX.md`** - Comprehensive index of all documentation
15+
- **`ai-generated/architecture/ARCHITECTURE-OVERVIEW.md`** - System architecture and design patterns
16+
- **`ai-generated/architecture/PROJECT-LAYOUT.md`** - Directory structure and module organization
17+
- **`ai-generated/architecture/VISUAL-GUIDE.md`** - Architecture diagrams and visual references
18+
- **`ai-generated/architecture/TEST-PIPELINE.md`** - Testing framework and CI/CD workflows
19+
- **`ai-generated/architecture/RELEASE-PIPELINE.md`** - Release process and packaging
20+
21+
**Status: NON-VERIFIED**
22+
- **Last AI Update**: 2025-09-11
23+
- **Maintainer**: Rene Cannao
24+
25+
### 📋 Human-Verified Documentation
26+
27+
Critical documentation that has been reviewed and verified by maintainers:
28+
29+
- **`README.md`** - Main project overview and quick start
30+
- **`INSTALL.md`** - Installation instructions
31+
- **`FAQ.md`** - Frequently asked questions
32+
33+
### 🔧 Internal Documentation
34+
35+
Detailed technical documentation for specific components:
36+
37+
- **`doc/internal/`** - In-depth technical guides
38+
- **`doc/release_notes/`** - Release notes and changelogs
39+
40+
## Using AI-Generated Documentation
41+
42+
1. **Start Here**: Use AI-generated docs to understand the codebase structure
43+
2. **Verify Information**: Always cross-reference with actual source code
44+
3. **Report Issues**: Help improve accuracy by reporting discrepancies
45+
46+
## Contributing to Documentation
47+
48+
- **AI Documentation**: Contributions are welcome - please verify against source code
49+
- **Verified Documentation**: Follow the existing review process
50+
- **Framework**: See `AI-DOCUMENTATION-FRAMEWORK.md` for guidelines
51+
52+
---
53+
54+
> This approach provides the benefits of AI-generated assistance while being transparent about limitations and reducing verification overhead.

0 commit comments

Comments
 (0)