mirror of https://github.com/sysown/proxysql
feature/ci-codecov-unit-tests
docs/passthrough-auth-spec
v3.0
v3.0_fix_pgsql-set_statement_test_5788
v3.0_pgsql_options_5801
fix/kill-proxysqlgenai-build-flag-v2
fix/kill-proxysqlgenai-build-flag
v3.0-260523
feat/passthrough-auth
GH-Actions
ci-trigger-tolerate-cleanup-401
fix/5790-mariadb-collation-255
fix/parsersql-1.0.3-pg-set-fixes
issue_5639
pgsql_dns_cache
fix/5755-followup-typecast-digest-fixtures
fix/5708-followup-multiline-for
fix/ci-asan-zombie-checks
v3.0_merge-5776-5784
genai_5534
aws-rds-bg
feature/perf-improvements-test2
v3.0_partition-gate
v3.0_fix-stale-pause-until
feature/perf-improvements-rene
v3.0_latency_consistency_improvement
fix/5796-ci-mysqlx-build-cache
fix/remove-skip-all
test/cluster-simulator
fix/galera-g5-cluster-start
integration/v3.0-batch-2026-05-13
fix/ghcr-pull-retry
fix/issue-5620-fast-routing-qr-leak
fix/issue-5684-tsdb-dashboard-same-origin
fix/5770-gcc16-jemalloc
fix/issue-5766-libconfig-escape-passthrough
v3.0_cap_violation_5767
fix/issue-5755-pgsql-digest-truncation
fix/issue-5580-deb-xz-compression
ci-mariadb10-galera-v3.0
ci-mariadb10-galera-GH-Actions
ci/fix-gr-g1-hostgroups
ci/fix-gr-g5-cluster-start
issue-5686-galera-vars
ci-mysql84-gr-g1-g9-GH-Actions
ci-mysql84-gr-g1-g9-v3.0
perf/pull-ci-base-from-ghcr
fix/rename-set-parser-group-and-bench-complexity
fix/split-test-groups
fix/rename-set-parser-workflow
perf/scram-cached-hmac
feature/parsersql-integration
gh-actions/add-set-parser-algorithm-3-g1
issue-5729-stats-projection-abi
fix/4760-lenenc-auth-v3.0
fix/tsan-unit-tests-build-failure
fix/4530-mysql-server-selection-prng
fix/4760-advertise-lenenc-auth-capability
fix/unit-test-asan-double-link
fix-auth-lock-order
v3.0-genai-plugin
feature/mysqlx-stack-consolidated
feature/mysqlx-asan-coverage-docker-isolation
fix/ci-unit-tests-tsan-project-name
feature/mysqlx-tsan-v3-companion
feature/ci-builds-add-tsan-matrix
ci-reduce-polling-interval
feature/mysqlx-tsan-workflow-only
feature/mysqlx-ci-validation-workflows
feature/mysqlx-test-leak-cleanup
feature/mysqlx-behavioural-tap
feature/mysqlx-parity-cleanup
ci-g5-enable-cluster
ci-g5-debug-clean
feature/mysqlx-tls-passthrough
feature/mysqlx-asymmetric-tls
feature/mysqlx-state-machines
feature/build-tsan-plumbing
feature/mysqlx-observability-p0
plugin-chassis
fix/mysqlx-review-findings
fix/test-mysqlx-plugin-load-phase-b
docs/plugin-chassis-abi3-update
fix/mysqlx-runtime-views-separation
v3.0-ci-asan-libprotobuf-dev
ProtocolX
ProtocolX-rebased
v3.0-fix-macos-release-upload
v3.0-test-ci
v3.0-fix-init-release-race
v3.0-cleanup-stale-plans
v3.0-ci-pkg-workflows
fix/macos-build-deps
feat/arm64-on-demand-package-builds
fix/3.0.8-review-items
fix/pgsql-active-tx-on-broken-conn
feat/pgsql-tx-poisoned-recovery
pull-5659
session-track-system-variable
feat/cla-assistant-setup
v3.0-slim-dbdeployer-images
ci/fix-mysql-apt-key-expired-v2
ci/fix-mysql-apt-key-expired
fix/mysqlx-check-connect-poll
fix/mysqlx-stale-row-sync
feature/mysqlx-route-identity
fix/mysqlx-listener-lifecycle
fix/mysqlx-backend-tls-post-auth
chore/retire-dead-mysqlx-worker
v3.0-issue5621
v3.0_new_zstd
fix/lint-groups-json-format
v3.0-dbdeployer-mysql84-gr
lint-tap-tests-static-analysis
fix/groups-json-orphaned-entries
mariadb-rpl-helper
feature/gtid-range-update
fix-fc-parsing
v3.0-pgsql-monitor-reschedule-on-interval-change
v3.0-remove-sqlite-rembed
v3.0-fix-read-only-actions-hostgroup
v3.0-fix-pgsql-ssl-keylog-path
v3.0-fix-flake-test-flush-logs
v3.0-doc-test-readme
v3.0-doc-gh-actions-vocabulary
ci/fix-upload-artifact-eacces
v3.0_pgsql-copy-matcher-5568
ci/fix-cache-prune-permissions
ci/disable-unittests-caller
ci/shrink-test-cache
ci/proxysql-tester-zero-test-safety-net
ci/fix-tap-build-target
ci/gh-actions-readme-pointer
ci/rewire-group-callers-and-docs
ci/fix-mysql84-infradb-label
ci/add-missing-group-reusables
v3.0-lint
fix/ci-workflow-run-chain-pr-sha
fix/postgresql-cluster-sync_2
v3.0_ci_min_proxysql_version_5561
mysqlx-plugin-impl
infra-mysql57-binlog
v3.0-ci0405
feature/pgbouncer-compat
v3.0_pgsql_sslkeylog_5281
v3.0-issue5556
fix/5554-resolution-family-limitation
v3.0-CodeCov0325
v3.0-ci260323
fix/3p-ci-error-handling
feat/ffto-error-recording
v3.0-5493
v3.0-ci260322
v3.0-ci260322_cluster
v3.0-5516
v3.0-5517
copilot/feature-load-restapi-routes-config
copilot/add-ssl-tls-certificate-stats-table
unit-tests-skip-proxysql
private/multi-group-runner
v3.0-5473
v3.0-5499
copilot/extract-server-selection-algorithm
copilot/extract-health-state-logic
copilot/extract-query-rule-matching-logic
copilot/extract-connection-pool-logic
v3.0-set_parser_v3
feature/arm-builds
release-notes-3.0.6-4.0.6-draft
v3.0.6-add-tap-test_stats_table_check
v2.7.3-test260221
v4.0-mcp-stats
copilot/uninstall-amazon-linux-2023
fix-prometheus-labels-test
tap-mcp-client
agent-skill-tap-test
v4.0-tsdb1
v3.0-fix_5256
gh-pages
feature/modern-docs
v4.0
v4.0-fix-vec-search
v4.0_rag_sys_prompt
v4.0-mcp_rules_test
v4.0_rag_mcp
v4.0-tsdb
feature/v4-docs-init
otel_system_libs
otel_clean
v3.0-5288
otel
otel_2
fix/postgresql-cluster-sync
v3.0-releate_notes_scripts_fixes
test_gh-actions_triggers
postgresql-digest-testing-improvement
v3.0_select_auto_commit
v3.0-5218
fix-5221
fix/5186-proxysql-stop-admin-crash
v3.0-4951
add-claude-github-actions-1763877527835
fix-rpm
v3.0-DS_crash
add-claude-github-actions-1763663272333
add-claude-github-actions-1763663091346
add-claude-github-actions-1763663091411
add-claude-github-actions-1763476725261
add-claude-github-actions-1763476725489
v3.0_optimizations_and_stability
v2.7.3.1
v3.0.3-upgrade_json
v3.0.sonar-cli
v3.0.sonar-config
otel-tracepoint
v3.0.2-merge-upgrade_deps-add_new_distros
v3.0.2-upgrade_deps
v3.0.2-add_new_distros
v3.0-add_more_testing_groups
v3.0-upgrade_prometheus-cpp
v3.0-upgrade_json
v3.0-upgrade_sqlite3
v3.0-upgrade_libmicrohttpd
v3.0-upgrade_curl
v3.0-add_centos10_builds
v3.0-add_fedora42_builds
v3.0_PG_PrepStmt
v3.0-sliced_groups
v3.0_auth_negotiation
v2.7
v2.7-fix_run_name
v3.0_4799_4827
v3.0-3687
v2.7-pmm_runtime_servers_metrics
v2.7-4839
v2.7-4841
v2.7-bump_version_to_2.7.3
2.6.6-4841
v2.x_pg_PrepStmtBase_240714
v3.0-4803-4817
v3.0-4803
v2.7-minorBugs
v3.0-privates
v2.x-logging_mem_2
v2.7_fix
v2.7_amd64_build_fix
v2.7-fix_aux_threads_ssl_leaks
v2.7-fix_ssl_params_leak
v2.7-rm_malloc_conf_on_version
v2.7_compression
v2.7-actions-add-3p-tests-parameter
none
v2.7-fix_hang_on_resume
v2.x-logging_mem
v2.7_servers_defaults
v2.7-mariadb_column_metadata_integrity_check
ssl_optimization
v2.7_reg_test_4716_single_semicolon
v2.7_issue_4707_threshold_resultset_size
v2.7_reg_test_4723_query_cache_stores_empty_result
2.7_randomized_cache_ttl
v3.0_fix_multiple_builds
v3.0_servers_defaults
v2.7-update_actions_triggers_v2
v2.7-update_actions_triggers
v2.6
v2.6.x-update_triggers
v2.6-4646
v2.7.1-update_actions
v2.x
v2.6.x-testing-global-multiplexing-disabled
use-wrlock-in-dns-cache-empty
v2.6.x-fix-darwin
v2.x-admin_list_ciphers
v2.x-sqlite3_pass_exts
v2.x-tap_tests_opt_ssl
v2.6.0-update_to_libhttpserver_v0.19
v2.x_router_2ports
v2.6.0-update_to_openssl_v3.1.5
v2.x-2411025
v2.x-profiling_poc1
v2.x_sha2pass_draft2
v2.x-webui_fixes
v2.6.0-more-makefile-fixes
v2.x-20230914_test
v2.x-20230913_test
v2.5.5-branch
v2.5.5-branch_255_patches
v2.x-aurora_autodiscovery-refactor_cluster_mysql_servers-gr_bootstrap_mode_2
v2.x_mysql_connector_j_fixes
v2.6-deprecate_old_clickhouse
v2.x_refactor_cluster_mysql_servers
v2.x-aurora_autodiscovery
v2.x-zd70545
v2.x-aurora_autodiscovery_shunned_promotion
v2.x-tap20230609
v2.x-test20230530
v2.x_sha2pass_draft2-TEST
v2.x-session_track_system_variables_v2
v2.x-status-variables-for-set-stmts
v2.x-enable_session_state_trackers
v2.x-increase-logging-eof_fast_forward-t
v2.x-3863-special-query
v2.x-session_track_system_variables
v2.x_refactor_read_only_action
v2.x_sha2pass_draft1
v2.2.0-sqliteserver_read_only
v2.x-digest_umap_aux-comparison
v2.4.8
v2.x-4105_4114
v2.x-3583-server_closed_conn
v2.x-group_replication_rework-SHUNNED_promotion
v2.1.0-var-global-multiplex
v2.x-CI-hostname-tap-test-fixes
v2.x-limit-version-check
v2.x-fix_deprecate_eof_warning
v2.x-3698
v2.x_tidb_replica_read
v2.x-HostGroups_attributes
v2.0.18.221009
v2.x-ci_reg_test_3273_ssl_con
TAP_test_restapi
v2.x-tap_tests_groups
v2.x-tap_test_sqlite3_server-t
PRS_3888_3903_2
PRS_3888_3903
v2.x_code_refactor_2206
v2.x-multipacket_poc_1
v2.x-impr_hg_latency_obsv
v2.x-gcc-warnings
v2.x-hg_lock_session_id
v2.x-3768
v2.x-3371
v2.x-ci_verifications
v2.x-thread_local_qps_limit
v2.x-parser_table
v2.1.1-3207
v2.x-qps_limits
v2.x-3711
v2.x-3642
v2.x-3674
v2.x-ssl3_warnings
V2
v2.3.2
v2.3.2_3646_3647
v2.x-client_err_limit_conn_timeout
v2.x-keep_multiplexing_regression_fix
v2.3.2-3628
v2.2.2-to-v2.3.0-7
v2.2.2-to-v2.3.0-7_merge
v2.2.2-to-v2.3.0-6
v2.2.2-to-v2.3.0-6_merge
v2.2.2-to-v2.3.0-5
v2.2.2-to-v2.3.0-4
v2.2.2-to-v2.3.0-3
v2.2.2-to-v2.3.0-2
v2.2.2-to-v2.3.0-1
v2.3.1
v2.0.14-70226
v2.3.0
v2.x-client_err_limit-gr_replication_lag_action
v2.2.2
v2.2.1-3603
v2.2.1-centos7-ASAN
v2.2.1
v2.2.1-3601
v2.2.1-3599
v2.2.1-3597
v2.2.1-3595
v2.2.0-restapi_server_exc_log
v2.x-3574
v2.x-3558
v2.2.0-3546-centos-7-gcc-8
v2.x-3549
v2.x-cluster_large_mysql_users
v2.x-cov_ci_verification
v2.0.14-tb1
v2.0.14-tb1-3494
v2.0.14-tb1-3488
v2.0.14-tb1-3117
v2.0.14-tb1-2762
v2.0.14-2762
v1.4.13-arm
v2.1.1-3296
v2.2.0
v2.0.18
v2.1.1
v2.0.18-3342
v2.0.18-3182
v2.1.1-3184
v2.1.0-revert-da7fdfe14
v2.0.18-revert-da7fdfe14
v1.4.13-70160
v2.0.18-3354
v2.0.18-3350
v2.0.14-3339
1.4.13-70160
v2.0.18-3339
v2.1.1-3317
v2.1.1-3319
v2.0.18-3317
v2.1.2-LBalgo
v2.0.18-1574
v2.1.2-hgman
v2.0.17
v2.1.0
v2.0.17-3288
v2.0.17-3276
v2.0.17-3273
v2.0.16
v2.0.16-3267
v2.0.16-3265
v2.0.16-3262
v2.0.16-3261
v2.1.1-3252
v2.1.1-collation
v2.0.16-3252
v2.0.16-collation
v2.1.0-parser
v2.0.16-3219
v2.0.16-3216
v2.0.16-3201
v2.0.16-2330
revert-3191-v2.0.16-3190
v2.0.16-3204
v2.0.16-3177
v2.0.16-2619
v2.0.16-3190
v2.0.16-3187
v2.1.0-70118
v2.0.16-3133
v2.0.16-3133_ci_verification
v2.0.16-3150
v2.0.16-change_user
v2.0.15
v2.0.15_amd64_fix
v2.0.15_arm64_packages
v1.4.14-ssl
v2.0.15_arm64
v2.1.0-2820
v2.0.15-sslbug
v2.0.15-KillTrx
v2.0.14
v2.0.14-ch_build_fix
v2.0.14-focal
v2.0.14-valgrind20200904
v2.1.0-3042
v2.0.14-3035
v2.0.14-3036
v2.0.14-2955
v2.0.14-vars
v2.0.14-3005
v2.0.14-3003
v2.0.14_2970_2979
v2.0.14-NOTSOCK
v2.1.0'
v2.0.14-2958
v1.4.10-zd
v2.0.13
v2.0.13-autocommit_fix
v2.1.0-2892
v2.0.13-2711
v2.0.13-duplicated_variables
v2.0.13-duplicated_variables_for_2.1.0
v2.0.12-deprecate_eof
v2.1.0-1377
v2.1.0-admin_queries
v2.0.12-var-global-multiplex
v2.1.0-var-foreign-key
v2.0.12
v2.0.12-tab-small-log
v2.0.12-var-foreign-key
v2.0.12-var-long-query-time
v2.0.12-galera-shunned
v2.1.0-admin_queries_2
v2.1.0-tap-rm-config
v2.0.12-tap-rm-config-test
v2.1.0-QP_stmt_3
v2.0.11-fix-multi-2-ci
v2.0.11-fix-multi
v2.0.11-266_0-3
2.1.0
v2.0.11
v2.1.0-track-vars
v2.1.0-track-variables
v2.0.11-track-variables
v2.0.11-2526
v2.0.11-tap-tests
v2.0.13-2698-commit1
v2.0.10-galera-pxc-maint-mode
v2.0.11-track-vars
v2.0.10-2647
v2.0.11-track
v2.0.11-track-session-vars
v2.0.9-var-array-review
v2.0.11-stats
v2.0.10
v2.0.10-centos67
v1.4.14.2
1.4.14.2
v1.4.14-show-warnings
v2.0.9
v2.0.9-var-array_2
v2.0.9-var-array
v1.4.16
v2.0.8
val214-changing_charset
v2.0.6
v1.4.16-1922_2
v1.4.13.2
v2.0.4-charset248
v2.0.5
v1.4.10-67841
v2.0.4
v2.0.4-sqlite327
v2.0.3
v2.0.2
v1.4.15
v2.0.1
v1.4.14
v2.0.0
v1.4.14-ping_shun
v1.4.14-1828
v1.4.14-latency_awareness
v1.4.12
v1.4.13-admin_deadlock
v2.0.0-improve_speed
v1.4.13
v1.4.13-autocommit_revert
v1.4.11.2
v1.4.13-ps
v2.0.0_bionic_deb_fix
v2_962
v1.4.12-1640
v1.4.11-names_tz
v1.4.12-1693
master
v1.4.11
v1.4.10
v1.4.6
v1.3.10
jenkins_test
v2.0.0-cachegrind
v1.4.9
v2.0-lab
v149_1511
v149_1382
v1.4.7-f2
v1.4.7-f1
v149_1491
v1.4.5-kub
v1.4.8
v2.0-web2
v1.4.3
v1.4.7
bsd_install_update
v1.4.2
v1.4.1-ch2
v1.4.1
v1.3.9
v1.4.1-ch
v1.3.8
v1.3.8-dev
v1.3.7
v1.3.7-dev
v1.3.6-dev
v1.4.0-clickhouse
v1.4.0
v1.3.6
v1.3.5
v1.3.5-dev
v1.4.0-955
v1.3.4
v1.3.4-dev
v1.3.3
v1.3.3-dev
v1.3.2
v1.3.2-dev
v1.3.2-766
v1.3.0h
v1.3.1-utf8mb4
1.4.0-840
v1.3.1
v1.2.6
v1.3.0
v1.4.0-797
v1.2.5-715
v1.2.5
v1.2.4-lowmem
v1.3.1-dev-mem
v1.2.0
connleak
lab-1.2.0
v1.1.2
T107_add_proxysql_consul_requirements
T89_write_consul_integration_doc
T98_consul_multi_table_config
mongoose
evhttp
SQLiteServer
1.0
3.0.8
3.0.7
3.0.6
3.0.5
3.0.4
3.0.3
3.0.2
2.7.3
2.6.6.1
3.0.1
2.7.2
3.0.0
2.6.6
2.7.1
2.7.0
2.6.5
2.6.4
2.6.3
2.6.2
2.6.1
2.5.5
2.6.0
2.5.4
2.5.3
2.5.2
2.5.1
2.4.8
2.5.0
2.4.7
2.4.6
2.4.5
2.4.4
2.4.3
2.4.2
2.4.1
2.4.0
2.3.2
2.3.1
2.3.0
2.2.2
2.2.1
2.2.0
2.0.18
2.1.1
2.0.17
2.0.16
2.0.15
2.0.14
2.0.13
2.0.12
2.0.11
2.1.0
2.0.10
2.0.9
2.0.8
2.0.7
2.0.6
2.0.5
2.0.4
2.0.3
2.0.2
1.4.16
1.4.15
2.0.1
1.4.14
1.4.13
1.4.12
1.4.11
1.4.10
1.3.10
1.4.9
2.0.0
1.4.8
1.4.7
1.4.6
1.4.4
1.4.3
1.4.2
1.3.9
1.3.8
1.4.1
1.3.7
1.4.0
1.3.6
1.3.5
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0h
1.3.0g
1.3.0f
1.3.0e
1.3.0d
1.3.0c
v1.3.0b
1.4.5
v1.1.0
v1.1.0-rc
v1.1.1-beta
v1.1.1-beta.1
v1.1.1-beta.2
v1.1.1-beta.3
v1.1.1-beta.4
v1.1.1-beta.5
v1.1.1-beta.6
v1.1.2
v1.2.0a
v1.2.0b
v1.2.0c
v1.2.0d
v1.2.0e
v1.2.0f
v1.2.0g
v1.2.0h
v1.2.0i
v1.2.0j
v1.2.0k
v1.2.1
v1.2.2
v1.2.3
v1.2.4
v1.2.4.0923
v1.2.5
v1.2.6
v1.3.0
v1.3.0a
v1.3.0g
v1.3.0h
v1.3.1
v1.3.10
v1.3.2
v1.3.2-1
v1.3.3
v1.3.4
v1.3.5
v1.3.6
v1.3.7
v1.3.8
v1.3.9
v1.3.9-prev.1
v1.4.0
v1.4.1
v1.4.10
v1.4.11
v1.4.12
v1.4.13
v1.4.14
v1.4.15
v1.4.16
v1.4.2
v1.4.3
v1.4.4
v1.4.5
v1.4.6
v1.4.7
v1.4.8
v1.4.9
v2.0.0-beta.1
v2.0.0-rc1
v2.0.0-rc2
v2.0.1
v2.0.10
v2.0.11
v2.0.12
v2.0.13
v2.0.14
v2.0.15
v2.0.16
v2.0.17
v2.0.18
v2.0.2
v2.0.3
v2.0.4
v2.0.5
v2.0.6
v2.0.7
v2.0.8
v2.0.9
v2.1.0
v2.1.1
v2.2.0
v2.2.1
v2.2.2
v2.3.0
v2.3.1
v2.3.2
v2.4.0
v2.4.1
v2.4.2
v2.4.3
v2.4.4
v2.4.5
v2.4.6
v2.4.7
v2.4.8
v2.5.0
v2.5.1
v2.5.2
v2.5.3
v2.5.4
v2.5.5
v2.6.0
v2.6.1
v2.6.2
v2.6.3
v2.6.4
v2.6.5
v2.6.6
v2.7.0
v2.7.1
v2.7.2
v2.7.3
v3.0.0-alpha
v3.0.1
v3.0.2
v3.0.3
v3.0.4
v3.0.5
v3.0.6
v3.0.7
v3.0.8
v3.1.6
v3.1.7
v3.1.8
v4.0.6
v4.0.7
v4.0.8
${ noResults }
9934 Commits (6d8dff293973edd1be9cc67be03aac400e85cb4c)
| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
6d8dff2939 |
docs(chassis): mark query-hook ABI scaffold-state explicit + add TODO markers
The chassis ABI 2 query-hook surface (ProxySQL_PluginQueryHookPayload /
Result / Action plus register_query_hook / dispatch_configured_plugin_
query_hook) is wired through ProxySQL_PluginManager and exercised end-
to-end by unit tests. But the production data plane never calls
proxysql_dispatch_configured_plugin_query_hook — neither MySQL_Session
nor PgSQL_Session has the integration point.
Net effect today: a plugin can register a query hook successfully and
unit tests can drive dispatch through it, but a real client query
arriving over MySQL or PgSQL will never consult the hook. The DENY
contract from the public ABI ("DENY prevents a query from dispatching")
is currently a promise the production path doesn't keep.
# Why scaffold-state instead of immediate full integration
Wiring the dispatch into MySQL_Session::handler___status_WAITING_
CLIENT_DATA___STATE_SLEEP___MYSQL_COM_QUERY_qpo (and the COM_STMT_
PREPARE / COM_STMT_EXECUTE entries that share the qpo machinery) is
mechanical but touches a 95k-LOC hot-path file. A bug in the
integration would manifest as a query-blocking regression that's hard
to debug and easy to ship.
Same for PgSQL_Session. The integration deserves its own focused PR
with TAP coverage that exercises both ALLOW and DENY paths against a
fake plugin — not a side-quest in this PR which is already large.
# What this commit does
1. Updates the ABI doc block in include/ProxySQL_Plugin.h to call out
the scaffold state explicitly. A plugin author reading the header
today would reasonably assume the hook fires in production; that
assumption is wrong, and the doc block now says so. References the
precise grep target ("TODO(plugin-query-hook)") that points at the
missing injection sites.
2. Adds two TODO(plugin-query-hook) markers to MySQL_Session.cpp:
- line ~3387 (COM_STMT_PREPARE → COM_QUERY shared codepath)
- line ~5403 (the main COM_QUERY execution path)
Each immediately follows the GloMyQPro->process_query call, where
CurrentQuery is populated and the dispatch payload would be ready.
3. Adds one TODO(plugin-query-hook) marker to PgSQL_Session.cpp at
line ~2387, following the GloPgQPro->process_query call.
# What this commit deliberately does NOT do
The actual dispatch wiring. The next person picking this up has:
- A precise injection site (3 in MySQL, 1+ in PgSQL).
- Pre-built ABI surface (proxysql_has_configured_plugin_query_hook
for the lock-free fast-path probe; proxysql_dispatch_configured_
plugin_query_hook for the actual hook invocation under shared lock).
- Existing test_helpers/fake_plugin.cpp with a HOOK_DENY env toggle
that exercises the dispatch path under unit test today — extensible
to TAP integration tests once the production wiring lands.
Caught by an external review pass, finding #5. Filing as a deferred
fix with explicit scaffold acknowledgement rather than rushing the
integration.
|
3 weeks ago |
|
|
e535a66ee1 |
fix(mysqlx): enforce per-user require_tls and allowed_auth_methods
Two MysqlxResolvedIdentity fields were loaded from runtime_mysqlx_users
into the in-memory store but never consulted by the auth path:
identity_->require_tls // per-user "must be over TLS"
identity_->allowed_auth_methods // per-user mechanism whitelist
Net effect:
- require_tls=1 did not reject MYSQL41-over-plaintext. Operators
setting this column expected a hardening guarantee they did not
actually get; an attacker bypassing TLS could still authenticate
via MYSQL41 (which is challenge-response over plaintext, but
leaks the user's full SHA1(SHA1(pw)) on a passive eavesdrop and
is replayable for the duration of the auth_challenge_).
- allowed_auth_methods='MYSQL41' did not reject PLAIN attempts
(and vice versa). Operators expected to be able to lock down a
user to a specific mechanism; the column was decorative.
# Fix
New helper MysqlxSession::enforce_identity_policy() called from both
auth resolution sites (handle_auth_plain at line ~539, handler_auth_
challenge_sent at line ~664) immediately after identity_ resolves
and before credential verification. It:
- rejects with 1045 "User requires a TLS connection" when
identity_->require_tls && !client_ds_.is_encrypted().
- rejects with 1045 "Authentication mechanism not allowed for
user" when identity_->allowed_auth_methods is non-empty and
auth_method_ is not in the comma-separated list (case-
insensitive, whitespace-trimmed).
Empty allowed_auth_methods preserves the historical "any wired
method" default so existing rows don't require a backfill — the
column already defaulted to '' in the table DDL.
# What this commit does NOT cover
backend_auth_mode is the third field in the same review finding
(reviewer's #2). It's partially implemented today by side-effect:
the backend_username being non-empty selects the service_account
codepath, empty selects mapped. The pass_through mode would require
forwarding the frontend AuthStart frame unmodified to the backend
and is not implemented; it remains TBD pending issue #5693
(asymmetric TLS / AsClient) which has overlapping protocol-shape
concerns. This commit deliberately scopes to the two policy checks
that are unambiguously broken; backend_auth_mode pass_through gets
its own commit when #5693 lands.
# Verified
21 / 21 mysqlx unit tests still green. Caught by an external review
pass, finding #2.
|
3 weeks ago |
|
|
4e32f44196 |
fix(mysqlx): backend TLS honors endpoint use_ssl flag
mysqlx_backend_endpoints.use_ssl is documented as forcing TLS on the
proxy↔backend connection regardless of frontend TLS state. The flag
was loaded into MysqlxBackendEndpoint at install_endpoints_from_admin
time (mysqlx_config_store.cpp::load_endpoint_overrides applies the
override on top of runtime_mysql_servers), but resolve_backend_target
then copied only hostname and mysqlx_port into the session's per-
target fields. The use_ssl flag was silently dropped.
Backend TLS at line 1186 was gated only on client_ds_.is_encrypted()
— frontend state. So:
- plaintext client + endpoint use_ssl=1 → backend was plaintext (BUG)
- TLS client + endpoint use_ssl=0 → backend was TLS (BUG, less
severe — the
client opted
into TLS but
the operator
chose not to)
The operator's intent (`mysqlx_backend_endpoints.use_ssl`) was simply
not honored.
# Fix
Capture ep.use_ssl into a new target_use_ssl_ session field at
resolve_backend_target. Reset it to false alongside target_address_/
target_port_ in the existing two reset paths.
At the backend-auth setup site, gate the SSL_CTX install on
`target_use_ssl_ || client_ds_.is_encrypted()`. Both signals
independently force backend TLS:
- target_use_ssl_ is the operator-mandated posture (network-zone /
compliance / cert-pinning concerns).
- client_ds_.is_encrypted() is the existing "match what the client
did" heuristic.
The two are AND-required together would have been wrong (operators
mandating backend TLS shouldn't have plaintext clients defeat it);
the OR is the right combination.
# Out of scope
- Asymmetric TLS / AsClient mode where the proxy mirrors the client's
choice on the backend with no operator override is tracked separately
in #5693.
- TLS passthrough (forward raw TLS records without decryption) is
#5692.
- The full multi-mode mysqlx_tls_backend_mode (DISABLED, PREFERRED,
REQUIRED, AS_CLIENT) is also #5693 — this commit just stops the
silent drop of the per-endpoint flag, restoring the documented
behaviour. Other modes remain TBD.
# Verified
21 / 21 mysqlx unit tests still green. Caught by an external review
pass, finding #3.
|
3 weeks ago |
|
|
bd49725a6e |
fix(mysqlx): pool reuse decision must precede reset()
Mysqlx_Thread::return_connection_to_cache called conn->reset() *before*
deciding whether to keep the connection. MysqlxConnection::reset()
unconditionally sets in_transaction_=false, has_prepared_stmt_=false,
reusable_=true, then returns. Net effect:
- A session that called set_has_prepared_statement(true) on its
backend (mysqlx_session.cpp:762, the PREPARE_PREPARE handler) had
that signal wiped seconds later when return_backend_to_pool ran.
The pool then handed the same backend — still holding the prepared
statement — to the next session that asked for a backend with
matching {hostgroup, user, schema}. The next session would see
"ER_UNKNOWN_STMT_HANDLER" or worse, a misrouted execute.
- The dead-socket paths (handler_waiting_server_msg lines 884-895
after EOF or read error, handler_session_reset_waiting lines
945-951) all called return_backend_to_pool() unconditionally.
reset() didn't mark the connection dead, so a closed fd ended up
in the cache. The next checkout would hit ECONNRESET / EBADF on
its first read.
# Fix
1. Reorder: return_connection_to_cache now consults is_reusable()
FIRST. If false, delete; only if true do we reset() and cache.
2. Tighten is_reusable() with state-machine disqualifiers that catch
failure paths callers might have forgotten to translate into
set_reusable(false): state_ == ERROR_STATE / CLOSED and
auth_state_ == BACKEND_AUTH_ERROR. The previous version checked
only in_transaction_ and has_prepared_stmt_ as soft disqualifiers
plus the reusable_ flag.
3. Mark backend_conn_->set_reusable(false) explicitly at every
dead-socket call site in MysqlxSession (lines that previously just
called return_backend_to_pool when the backend fd was -1 or
read_from_net returned 0 / -1). Belt-and-suspenders: even if a
future is_reusable() refactor narrows the state-based check, the
explicit caller signal still correctly disqualifies dead sockets.
# Why is_reusable doesn't check fd_<0
Several unit-test fixtures construct MysqlxConnection objects with
fd_=-1 placeholders (e.g. test_backend_reset_clears_auth, test_
connection_multiplexing). Adding fd_<0 to is_reusable would have
broken those tests without catching any production path that the
state checks don't already cover — production set_reusable(false)
calls + state_ updates on the failure paths are the right source of
truth for "this connection cannot be reused."
# Verified
21 / 21 mysqlx unit tests still green, including the connection-
multiplexing and pool-reuse fixtures that would surface a regression
in is_reusable() shape. Caught by an external review pass, finding
#1.
|
3 weeks ago |
|
|
9c84ae4550 |
fix(mysqlx): clear data-stream revents after handler runs
process_all_sessions() in plugins/mysqlx/src/mysqlx_thread.cpp:252 gates
handler() invocation on whether a poll event has landed:
short c_rev = sess->client_ds().get_revents();
short s_rev = sess->server_ds().get_revents();
bool fd_ready = (c_rev != 0) || (s_rev != 0);
if (fd_ready || buffered || sess->to_process) {
sess->to_process = true;
rc = sess->handler();
}
The intent of this gate (per the inline comment immediately above) is
"only invoke handler() when there is real work — forcing to_process on
every tick burned the CPU at large session counts." But there was no
code path that cleared the per-stream revents_ field after handler()
consumed the event.
The only existing reset is MysqlxDataStream::reset() (full stream tear-
down). So once a session received one POLLIN, the same revents bitmask
stayed set for the rest of its life: every poll cycle would re-enter
handler() and hit EAGAIN, defeating the entire CPU-saving change. The
hot loop scaled with session count.
Fix: set_revents(0) on both streams immediately after handler returns.
The next iteration only fires on a fresh poll event (or buffered work /
explicit to_process), which is what the inline comment promised.
Caught by an external review pass, finding #4. Verified locally: 21/21
mysqlx unit tests still green, including mysqlx_concurrent_unit-t (the
20-client burst that originally caught the listener O_NONBLOCK
regression — would also surface here if the readiness clear introduced
a stall).
|
3 weeks ago |
|
|
f08206a2f9 |
build(plugins/mysqlx): mirror top-level feature-tier cascade
A standalone `make -C plugins/mysqlx PROXYSQLGENAI=1` previously set only -DPROXYSQLGENAI; PROXYSQL40, PROXYSQL31, PROXYSQLFFTO, PROXYSQLTSDB all stayed unset because the four `ifeq ($(PROXYSQL_X),1)` blocks were independent. The resulting .so saw a different ProxySQL_PluginServices / ProxySQL_PluginDescriptor layout than libproxysql.a (which set every flag via the top-level cascade), and the chassis loader then read past the end of the plugin's static descriptor. The Makefile comment already warned about this and asked the caller to export every flag. CI works because workflow YAMLs list all five explicitly. The footgun was the standalone path. Mirror the top-level Makefile's cascade ladder before the per-flag -DPROXYSQL_X assignments: PROXYSQLGENAI=1 ⇒ PROXYSQL40=1 ⇒ PROXYSQL31=1 ⇒ PROXYSQLFFTO=1 + PROXYSQLTSDB=1 Now `make -C plugins/mysqlx PROXYSQLGENAI=1` produces the right five-flag set, matching the top-level build. Caught by an external review pass, finding #6. |
3 weeks ago |
|
|
aa4a078988
|
Merge pull request #5700 from sysown/fix/test-mysqlx-plugin-load-phase-b
fix(test): test_mysqlx_plugin_load-t needs Phase B between load and init |
3 weeks ago |
|
|
7de1ae3dcd |
test(mysqlx): address PR-#5700 review feedback
Two reviewers flagged the same area in the previous commit (ec0c5...
oh wait wrong sha —
|
3 weeks ago |
|
|
eebfbde2b3 |
fix(test): test_mysqlx_plugin_load-t needs Phase B between load and init
Pre-existing test bug surfaced by CI-unit-tests-asan-coverage on
plugin-chassis (run 25202654334, head
|
3 weeks ago |
|
|
bb199c6cdd
|
Merge pull request #5690 from sysown/docs/plugin-chassis-abi3-update
docs(plugin-chassis): align FILE_CHANGES/ABI/REVIEW_GUIDE/PLUGIN_API with PR #5688 |
3 weeks ago |
|
|
29ee30daf9 |
docs(plugin-chassis): address PR-#5690 review feedback
CodeRabbit + Gemini review pass surfaced four small doc-precision
items, all legitimate. None were code bugs.
# CodeRabbit (markdownlint nit)
- doc/PLUGIN_API.md:455: fenced code block at "DISK ↔ MEMORY ↔
RUNTIME" lacked a language specifier. Added `text` to satisfy
MD040 / fenced-code-language.
# Gemini (3x same root: clarify the matching algorithm)
The chassis dispatch matcher is case-insensitive whole-identifier
substring match, but three docs described it loosely. Plugin
authors deciding what table name to register need to know that
runtime_X does not match runtime_X_extra or stats_runtime_X.
- doc/PLUGIN_API.md:289 ("any admin SELECT against it") -> spell
out the whole-identifier rule with the longer-prefix /
longer-suffix rejection examples.
- doc/plugin-chassis/ABI.md:156 ("appears in the SQL") -> "is
referenced as a whole identifier in the SQL query
(case-insensitive; identifier-aware, so runtime_X_extra or
stats_runtime_X do not match runtime_X)".
- doc/plugin-chassis/FILE_CHANGES.md:102 ("substring match") ->
"case-insensitive whole-identifier substring match", matching
the precise wording already used in section B for the
sql_references_table_ci helper. Cross-section consistency.
No source code touched. No new content sections, only existing
prose tightened.
|
3 weeks ago |
|
|
ef32d9df87 |
ci: register plugin_runtime_views_unit-t in groups.json
Lint failure surfaced on PR #5690's CI run (job 73893199128) — the chassis runtime-view test added in PR #5688 was never registered in test/tap/groups/groups.json, and check_groups.py treats any unlisted TAP source as a lint error. Same group entry as the sibling plugin-chassis tests (plugin_dispatch _unit-t, plugin_manager_unit-t, etc.): "plugin_runtime_views_unit-t" : [ "unit-tests-g1","@proxysql_min_version:4.0" ] unit-tests-g1 is the standard host-only TAP group (no docker backend required); the @proxysql_min_version:4.0 attribute keeps it from running against pre-chassis builds. Trivial fix that belongs on the same PR as the doc updates because the lint failure is what surfaces on every PR opened against plugin-chassis until this lands. |
3 weeks ago |
|
|
64e7334297 |
docs(plugin-chassis): align FILE_CHANGES/ABI/REVIEW_GUIDE/PLUGIN_API with PR #5688
The four chassis docs still described the pre-fix architecture:
- ABI version 2 (now 3 — register_runtime_view appended at services tail)
- MysqlxConfigStore::load_from_runtime (removed; replaced by per-entity
install/save/project triplets)
- copy_table / copy_to_runtime as the LOAD/SAVE shovels (deleted)
- Listener reconciler reading runtime_mysqlx_routes (now reads
MysqlxConfigStore::snapshot_active_routes)
- "Three-tier" disk/memory/runtime model with the empty-source-sync
invariant applied uniformly (the runtime tier was wrong; runtime_<X>
is now an admin-side projection of module state, not a tier; the
invariant only applies to disk-tier copies)
- Plugin-context layout listing a non-existent MysqlxStatsStore
Updates per file (no source code touched):
- FILE_CHANGES.md
§A: PROXYSQL_PLUGIN_ABI_VERSION 2 → 3, services list gains
register_runtime_view, ProxySQL_PluginRuntimeView struct
documented, separation-of-duties contract spelled out.
§B: PluginManager methods list gains register_runtime_view,
refresh_runtime_views_for_query; service trampolines list
gains register_runtime_view_service; sql_references_table_ci
whole-identifier match described; services_phase_b_ wiring
of register_runtime_view explained.
§C: new pre-SELECT runtime-view dispatch site in
GenericRefreshStatistics described — gated on if (admin),
OUTSIDE the if (refresh==true) block, so any admin-port
query gets the chassis dispatcher fired.
§H: mysqlx_start() no longer does runtime sync; describes the
four install_<X>_from_admin calls in their place.
§I: copy_table removed from the description; new LOAD/SAVE
callbacks calling MysqlxConfigStore install/save APIs;
four refresh_<X>_runtime_view callbacks registered via
services.register_runtime_view().
§J: MysqlxConfigStore reframed as the canonical source of
truth (runtime_mysqlx_<X> are projections of it). API list
replaced load_from_runtime with the four install/save/
project triplets, install_all_from_admin (test convenience),
snapshot_active_routes, and MysqlxBackendEndpointOverride.
§K: listener reconciler reads MysqlxConfigStore directly via
snapshot_active_routes(); inline rationale notes why we
must NOT read runtime_mysqlx_routes (empty between LOAD
calls under the new architecture).
- ABI.md: services availability matrix gains register_runtime_view
(live in Phase B and D); current-ABI block 3/3; §5 retitled
"Separation of duties" with the new contract; disk-tier exception
keeps the empty-source-sync invariant.
- REVIEW_GUIDE.md: ABI-surface bullets updated; mysqlx phase
descriptions updated to point at install_*_from_admin /
runtime-view projections / snapshot_active_routes-driven reconciler.
- PLUGIN_API.md: descriptor table updated for ABI 3; services struct
snippet shows the ABI-2 and ABI-3 tail extensions; new
register_runtime_view callback section with the contract;
"Three-Tier" section retitled "Separation of duties", clarifies
that runtime_<X> is an admin-side projection (not a persistent
tier) and the empty-source-sync invariant applies only to disk-
tier copies; alias-handling note corrected.
The only surviving "ABI version 2" mention is in PLUGIN_API.md
line 46 ("plugins that declare ABI version 2 or higher") — that is
a correct version-or-higher predicate, not a stale reference.
|
3 weeks ago |
|
|
f1587cf5c2
|
Merge pull request #5688: Admin/module separation for mysqlx runtime tables (issue #5687)
fix(mysqlx): Admin/module separation for runtime config tables |
4 weeks ago |
|
|
af270316b9 |
docs(mysqlx): correct ABI version, mysqlx_variables list, start() flow
Doc-accuracy review pass found three substantive lies in README.md / ARCHITECTURE.md the previous doc rewrite missed. # ABI version Both README §13 and ARCHITECTURE §1 stated "ProxySQL Plugin ABI version 1". The plugin descriptor in mysqlx_plugin.cpp has used PROXYSQL_PLUGIN_ABI_VERSION since chassis introduction; that macro is now 3 (descriptor ABI 2 four-phase lifecycle + ABI-3 register_runtime_view services field). Updated both files to call the right number with a one-liner on what each ABI bump added. # mysqlx_variables list README §3.1 listed eight variables: mysqlx_thread_pool_size, mysqlx_connect_timeout, mysqlx_tls_mode, mysqlx_tls_cert, mysqlx_tls_key, mysqlx_tls_ca, mysqlx_tls_backend_mode, and mysqlx_max_cached_connections_per_thread. Only the four canonical scalars are wired through MysqlxConfigStore — load_variables() in mysqlx_config_store.cpp matches against four exact names and silently ignores everything else; save_variables_to_admin_table DELETEs the entire table and re-inserts only the four. So the TLS-related entries the README told operators to set are accepted into the table by the CHECK constraints, never read by LOAD, and deleted by the next SAVE. §8.2 example was equally misleading: it instructed operators to UPDATE mysqlx_tls_cert / mysqlx_tls_key paths and run LOAD MYSQLX VARIABLES TO RUNTIME, which is a silent no-op. Trim the §3.1 table to the four wired variables, add a paragraph explaining that other variable_name values are silently ignored by LOAD and deleted by SAVE, and trim §8.2 to the one TLS-related variable that actually round-trips (mysqlx_tls_mode). # start() flow README §2.3 step 6 said "The plugin's start() function loads configuration from runtime tables, ...". After the architectural fix mysqlx_start() syncs disk → memory for the editable mysqlx_* tables, then drives the four install_*_from_admin calls (each SELECTing the editable table plus the relevant cross-module runtime_mysql_* projection). Updated to spell out the actual flow. # Smaller corrections ARCHITECTURE §3.5 listed a "MysqlxStatsStore" in the plugin context — there is no such struct. Replaced with the actual context members. ARCHITECTURE §3.6 listed runtime_mysql_users as the only cross-module dependency for installs; install_endpoints also reads runtime_mysql_servers — added that. |
4 weeks ago |
|
|
becbf09ffa |
fix(mysqlx): plugin_descriptor visibility + admin_tables test + dead decl
Three issues code-review caught.
# Plugin-descriptor visibility
plugins/mysqlx/Makefile builds the .so with -fvisibility=hidden. The
loader resolves proxysql_plugin_descriptor_v1 via dlsym(); without an
explicit visibility-default override on this single exported function,
the symbol stays hidden and ProxySQL_PluginManager::load() fails with
"undefined symbol: proxysql_plugin_descriptor_v1". Add the
__attribute__((visibility("default"))) override so the .so exports
exactly one symbol — the descriptor entry point — and no others.
Latent regression unblocked here (test_mysqlx_plugin_load-t was also
affected).
# test_mysqlx_admin_tables-t.cpp rewrite
This integration-style TAP test (registered as unit-tests-g1,
@proxysql_min_version:4.0) used to assert on runtime_mysqlx_<X>
contents after each LOAD/SAVE call:
mgr.dispatch_admin_command(ctx, "LOAD MYSQLX USERS TO RUNTIME", result);
ok(admin_db.return_one_int("SELECT COUNT(*) FROM runtime_mysqlx_users") == 1, ...);
Under the new architecture, LOAD updates MysqlxConfigStore and never
writes runtime_mysqlx_users. The runtime view is repopulated only via
the chassis pre-SELECT hook in ProxySQL_Admin::GenericRefreshStatistics
— a path the test bypasses by reaching admin_db directly. The test
also seeded only mysqlx_users without seeding runtime_mysql_users,
so the cross-module-join in install_users_from_admin would silently
drop every user. And the SAVE-after-modifying-runtime tests were
asserting on a no-op (SAVE no longer reads runtime_mysqlx_users).
Rewrite:
- LOAD assertions now go via rows_affected from the callback and
DELETE editable + SAVE roundtrip to confirm the in-memory store
really held the rows. If SAVE re-materialises the rows the
operator deleted from the editable table, they came from the
store — exactly the contract LOAD is meant to install.
- Cross-module canonical tables seeded explicitly: helper
seed_canonical_tables creates runtime_mysql_users +
runtime_mysql_servers via the canonical
ADMIN_SQLITE_RUNTIME_MYSQL_USERS / ADMIN_SQLITE_TABLE_RUNTIME
_MYSQL_SERVERS DDL.
- SAVE-after-runtime-mutation tests (lines 263+) rewritten:
instead of "modify runtime_mysqlx_users, then SAVE, expect change
in mysqlx_users", they affirmatively assert the new contract —
runtime-view edits do NOT propagate to mysqlx_users on SAVE.
- backend_auth_mode values normalised to canonical enum values
(service_account, pass_through, mapped) since
mysqlx_backend_auth_mode_from_string collapses unknowns to
`mapped` and would have hidden any round-trip bug otherwise.
45 / 0 asserts after rewrite.
# Dead declaration
MysqlxConfigStore::rebuild_hostgroup_endpoints_locked() declared in
the header but never defined or called. Drop it. Code review found
this in the same pass.
|
4 weeks ago |
|
|
90e888e1d0 |
fix(chassis): runtime-view dispatch fires unconditionally on admin
Doc-accuracy review found that proxysql_refresh_configured_plugin_
runtime_views was unreachable for plugin-registered tables. The call
was placed inside
if (refresh==true) { // ProxySQL_Admin.cpp:1637
...
if (admin) {
// existing core runtime_* refreshes
proxysql_refresh_configured_plugin_runtime_views(...)
}
}
`refresh` only gets set to true by hardcoded substring matches
against core's own table names (lines 1358-1634: runtime_mysql_users,
runtime_mysql_servers, runtime_mysql_query_rules, etc.). None of
those substrings match runtime_mysqlx_* (or any other plugin-
registered view), so on a bare
SELECT * FROM runtime_mysqlx_users
the gate was false, my dispatch was skipped, the table was empty
(or stale from a previous query that DID match a core substring),
and the SELECT returned wrong data. The whole "on-demand projection"
mechanism the previous commits documented was broken for the entry
case. Issue #5687 / PR #5688.
The fix is one-line structurally: hoist the dispatch out of the
`if (refresh==true)` block and place it right after the substring-
detection section, gated only on `if (admin)`. The chassis
dispatcher itself (refresh_runtime_views_for_query in
ProxySQL_PluginManager.cpp) already does its own per-view substring
match against query_no_space, so a query that touches no registered
view is a cheap no-op (one shared lock + N substring scans, N ==
registered-view count). Calling unconditionally on every admin
query is therefore both correct and cheap.
Test: new plugin_runtime_views_unit-t (20 ok asserts) drives
ProxySQL_PluginManager::register_runtime_view +
refresh_runtime_views_for_query directly. Covers:
- register_runtime_view rejects null callback / empty name /
case-insensitive duplicate.
- Per-query dispatch fan-out: only matching callbacks fire,
join queries fire all referenced views, unrelated queries
fire nothing, case-insensitive match works, backtick-quoted
identifiers match.
- Whole-identifier boundary: longer-suffix overlap (runtime_
mysqlx_users_extra), left-prefix overlap (stats_runtime_
mysqlx_users), embedded-in-string-literal — none falsely
match. Boundary cases (start of string, end of string) do
match.
This is the test the PR-#5688 review pass identified as the chassis-
hook coverage gap. Builds standalone (no fake-plugin loader needed)
since it drives the manager directly.
|
4 weeks ago |
|
|
b4127156ed |
fix(mysqlx): listener reconciler reads MysqlxConfigStore, not runtime view
Code-review finding on PR #5688. mysqlx_reconcile_listeners_impl in plugins/mysqlx/src/mysqlx_listener_reconcile.cpp was still issuing a SELECT against runtime_mysqlx_routes to build its desired route set: SELECT name, bind FROM runtime_mysqlx_routes WHERE active=1 After the previous commit decoupled module state from the runtime_mysqlx_<X> projection, that table is empty until an admin SELECT triggers the projection callback. The reconciler runs from two non-admin paths: - mysqlx_plugin.cpp::mysqlx_start() at process startup, after install_routes_from_admin populates the store - load_routes_to_runtime() admin command, after install_routes_from_admin populates the store Both paths fire BEFORE any admin SELECT has projected the runtime view, so the reconciler would see ZERO desired routes. Net effect in production: no mysqlx listeners bind on startup, and LOAD MYSQLX ROUTES TO RUNTIME silently removes any listeners that were already mapped (the reconciler treats every mapped route as "no longer desired"). The unit tests didn't catch this because the weak symbol mysqlx_reconcile_listeners is null in unit-test binaries (the listener-reconcile pure variant is the one tested, and previously it was reading a pre-populated SQLite table). # Fix Read the desired route set from MysqlxConfigStore directly via a new public method: std::vector<std::pair<std::string,std::string>> MysqlxConfigStore::snapshot_active_routes() const It returns a (name, bind) pair for every active route under a shared lock. The reconciler consumes the snapshot the same way the previous SQL-driven version consumed result rows. The pure variant signature changes from void mysqlx_reconcile_listeners_impl(SQLite3DB& admindb, ...) to void mysqlx_reconcile_listeners_impl(const MysqlxConfigStore&, ...) which both restores the function's "no global state" purity (it no longer needs to reach into mysqlx_context() and never has) and makes the data-flow obvious: the store is the input. The strong weak-symbol entry mysqlx_reconcile_listeners(SQLite3DB&) is unchanged externally — it still takes admindb (now ignored, kept for ABI stability) and grabs the store from mysqlx_context() internally. Doc comment on the weak hook in include/mysqlx_plugin.h updated to describe the new data flow and to spell out explicitly why we do NOT read runtime_mysqlx_routes. # Test updates The two robustness tests that exercise the reconciler (test_listener_reconciliation, test_listener_reconciliation_bind_ change) used to set up a SQLite admindb with runtime_mysqlx_routes rows. They now construct a MysqlxConfigStore directly and populate it via install_for_test() — a smaller, more honest fixture that matches what the reconciler actually consumes. Note: MysqlxConfigStore is non-copyable/non-movable, so the bind-change test installs into two stack-local stores back-to- back via a helper lambda rather than rebuilding by value. # Status - All 21 mysqlx unit tests still green (646 ok, 0 not_ok). - Listener reconciler now sees the right state in both startup and LOAD MYSQLX ROUTES TO RUNTIME paths. Closes the BLOCKER from the PR #5688 review. Other concerns the review surfaced were all dismissed as not-bugs (ABI 1/2/3 loader compat, sql_references_table_ci whole-identifier match, lock ordering, sqlite_quote correctness, save semantics matching the canonical pattern). |
4 weeks ago |
|
|
e678d101a0 |
docs(mysqlx): rewrite architecture/README for module-owned runtime state
Both files described the OLD model — runtime_mysqlx_<X> tables as
persistent admin-side mirrors, MysqlxConfigStore::load_from_runtime
as the canonical reload, copy_table as the LOAD/SAVE mechanism. None
of that is true after the architectural fix on this branch.
# ARCHITECTURE.md changes
- §3.6 mysqlx_config_store row: Responsibility cell now identifies
the store as the canonical source of truth and runtime_mysqlx_*
as projections. Key methods cell lists the four
install_*_from_admin / save_*_to_admin_table / project_*_to_
runtime_view triplets in place of the removed load_from_runtime.
Thread-safety cell updated to match.
- §3.8 mysqlx_admin_schema row: describes direct interaction with
MysqlxConfigStore (no SQLite-to-SQLite copies) and the four
refresh_<X>_runtime_view callbacks registered via the chassis
services.register_runtime_view().
- §10.2 Admin Command Flow: replaced the single copy_table flow
diagram with three flows (LOAD, runtime-view refresh on SELECT,
SAVE). Added §10.2.5 explicitly contrasting the new model with
the old "authoritative SQLite mirror" model so a reader who
skimmed the old docs knows which mental model to discard.
- §11 Thread Model: the call graph shows sync_disk_to_memory plus
the four install_<X>_from_admin calls instead of the removed
single load_from_runtime(). Startup prose updated.
# README.md changes
- §4.2 / §4.4 / §4.6: section titles changed from "Runtime Table"
to "Runtime View"; bodies rewritten to describe the on-demand
projection mechanism, with explicit "LOAD never writes / SAVE
never reads" notes.
- §4.7 (NEW): dedicated runtime_mysqlx_variables section so the
documentation surface is symmetric across all four entities.
Old §4.7/§4.8 stats sections renumbered to §4.8/§4.9.
- §6.3 Dual-Mode Identity Resolution: corrected a stale claim that
a user existing only in mysql_users (no mysqlx_users row) could
still authenticate with default X Protocol settings.
install_users_from_admin explicitly drops canonical-only users
from the store; the doc now reflects that.
# Intentional historical reference
ARCHITECTURE.md §10.2.5 still names the obsolete identifiers
(load_from_runtime, copy_table, "INSERT INTO runtime_mysqlx_users
SELECT * FROM mysqlx_users") — that paragraph is exactly the
"what to unlearn" anchor for readers who internalized the old
docs. README.md §4.2 still shows the literal SQL the projection
callback emits (DELETE FROM ... INSERT INTO ...), which is the
concrete mechanism description rather than a description of the
old wrong path.
|
4 weeks ago |
|
|
e5353ac922 |
test(mysqlx): update unit fixtures for module-owned runtime state
The four config-store / route-store unit tests, plus
mysqlx_admin_commands_unit-t, used to set up SQLite fixtures by
inserting directly into runtime_mysqlx_<X> tables and calling
MysqlxConfigStore::load_from_runtime(db, err). With the canonical
separation in the previous commit, install_*_from_admin reads the
editable mysqlx_<X> tables, so the fixtures had to move accordingly.
Mechanical changes:
CREATE TABLE runtime_mysqlx_<X> -> CREATE TABLE mysqlx_<X>
INSERT INTO runtime_mysqlx_<X> -> INSERT INTO mysqlx_<X>
store.load_from_runtime(db, err) -> store.install_all_from_admin(db, err)
+ add `comment` column to the editable DDLs (install_*_from_admin
SELECTs comment).
The cross-module dependencies (runtime_mysql_users,
runtime_mysql_servers) stay unchanged in the fixtures: those are
admin's projection of OTHER modules' runtime state, exactly what the
mysqlx install path SELECTs from.
Three semantic adjustments (not just renames):
- mysqlx_config_store_pure: a few tests previously asserted that a
canonical-only user (present in runtime_mysql_users, no row in
mysqlx_users) showed up in identities_. The new
install_users_from_admin drops those — a user with no x_enabled
flag has no path to authenticate via X anyway. Assertions adjusted
to reflect the dropped row.
- mysqlx_admin_commands: the LOAD callback rows_affected now reports
the active editable-table row count (was the runtime-table row
count); the SAVE VARIABLES callback always writes the four
canonical variables (was whatever happened to be in
runtime_mysqlx_variables). Assertions updated.
- mysqlx_admin_commands also adds explicit project_users_to_
runtime_view() calls before assertions that read runtime_mysqlx_
users contents — those assertions are exercising the projection,
so they need the projection to actually run, since outside admin
the chassis isn't there to fire it.
Result: 21 / 21 mysqlx unit tests green (646 ok asserts, 0 not_ok),
including 5/5 stable runs of mysqlx_concurrent_unit-t (the listener
O_NONBLOCK regression guard from earlier in this PR series).
|
4 weeks ago |
|
|
9da7300afe |
fix(mysqlx): Admin/module separation for runtime config tables
Previously, plugin-chassis stored authoritative mysqlx runtime state inside admin-db tables (runtime_mysqlx_users / _routes / _backend_ endpoints / _variables). LOAD/SAVE commands shuffled rows between mysqlx_<X> and runtime_mysqlx_<X> via plain INSERT ... SELECT, and MysqlxConfigStore::load_from_runtime read the runtime_<X> tables back out into its in-memory map. The data lived in three places (editable mysqlx_<X>, persistent runtime_mysqlx_<X>, in-memory store) with no detection of skew between them. Issue #5687. The canonical pattern (mysql_users / GloMyAuth / runtime_mysql_users in lib/ProxySQL_Admin.cpp::__refresh_users / save_mysql_users_runtime _to_database) keeps Admin and the module strictly separated: Admin owns the editable configuration table and provides a runtime_<X> view of module state Module owns runtime state in its own data structures runtime_<X> is rebuilt on demand from module state, not persistent storage This commit restructures the mysqlx plugin to match. # MysqlxConfigStore: per-entity install / save / project triplets Replaces the monolithic load_from_runtime() with three independent operations per entity (users / routes / endpoints / variables): install_<X>_from_admin(db, err) LOAD <X> TO RUNTIME path. SELECT the editable mysqlx_<X> table (and the cross-module runtime_mysql_users / runtime_mysql_servers projections where applicable), build a new local representation, atomically swap into the in-memory store under the store's mutex. save_<X>_to_admin_table(db) SAVE <X> [FROM RUNTIME] TO MEMORY path. Mirror save_mysql_ users_runtime_to_database(false): mark all rows in mysqlx_<X> inactive, then upsert the live store contents with active=1. Inactive rows the operator deactivated but didn't delete are preserved. project_<X>_to_runtime_view(db) Runtime-view refresh path invoked by the chassis before any admin SELECT touches runtime_mysqlx_<X>. Mirror save_mysql_ users_runtime_to_database(true): DELETE the projected table, then INSERT live store contents. install_all_from_admin() is a convenience wrapper that runs all four in sequence; production code calls the per-entity methods so each LOAD command only touches its own slice of state, and unit tests have a single entry point that exercises the whole pipeline. # MysqlxConfigStore data-model additions - MysqlxResolvedIdentity gains `comment` (preserved through round- trip; the canonical mysql_users path also preserves comments). - MysqlxRoute gains `comment` for the same reason. - New public MysqlxBackendEndpointOverride struct (replaces the file-local MysqlxEndpointOverride that used to be in the .cpp). - New endpoint_overrides_ map: per-(hostname,mysql_port) overrides preserved verbatim across LOAD calls so SAVE can round-trip and so the runtime-view projection can faithfully reflect what was loaded. Previously these overrides were dropped after being folded into hostgroup_endpoints_. # Plugin: register_runtime_view + rewritten LOAD/SAVE callbacks In mysqlx_admin_schema.cpp: - Removes copy_table() and reload_config_store(); they were the INSERT...SELECT shovel between editable and runtime tables that encoded the architectural mistake. - Each load_<X>_to_runtime callback now calls install_<X>_from_ admin(*ctx.admindb, err) and never touches runtime_mysqlx_<X>. - Each save_<X>_from_runtime callback now calls save_<X>_to_admin_ table(*ctx.admindb) and never reads runtime_mysqlx_<X>. - rows_affected on LOAD now reports the active row count in the editable table (the source); on SAVE it reports the row count in the editable table after the dump (the destination). - Adds four refresh_<X>_runtime_view free functions and registers them via services.register_runtime_view() during schema registration. The chassis invokes these before any admin SELECT against the projected table. In mysqlx_plugin.cpp::mysqlx_start(): - Drops copy_to_runtime() entirely (the old "copy editable mysqlx_<X> to runtime_mysqlx_<X> at startup" step that no longer has a purpose). - Replaces the single load_from_runtime call with the four install_<X>_from_admin calls so a failure in one entity is surfaced individually in the log. - Keeps sync_disk_to_memory() unchanged. Disk-tier persistence is legitimate admin behaviour; only the runtime-tier copy was wrong. # Net effect at the SQL level - INSERT INTO runtime_mysqlx_<X> ... no longer happens on any LOAD or SAVE. The only writes to runtime_mysqlx_<X> are the on-demand projections, triggered by the chassis pre-SELECT refresh path. - SELECT FROM runtime_mysqlx_<X> always reflects current MysqlxConfigStore state, even if the operator never ran LOAD since the last edit to mysqlx_<X>. - mysqlx_<X> remains the editable table the operator writes to. The bug-stay-out-of-runtime contract documented in include/ProxySQL_Plugin.h (the rewritten doc block) now matches what this plugin actually does. |
4 weeks ago |
|
|
f42c3ee1ab |
feat(chassis): add register_runtime_view ABI for module-owned state
Plugins that declare admin-side runtime views of their own in-memory state need a way to register a projection callback the chassis can invoke when admin SELECTs against the registered table. Without this hook, the only way for a plugin to surface its runtime state to admin operators was to *persist* a duplicate copy of the data into admin_db, which violates the separation of duties between Admin (owns configuration tables and views) and the module (owns runtime state). Refs #5687. ABI surface (in include/ProxySQL_Plugin.h): - struct ProxySQL_PluginRuntimeView { table_name, refresh, opaque } - new services.register_runtime_view callback - bumps PROXYSQL_PLUGIN_ABI_VERSION to 3 The new field is appended at the end of ProxySQL_PluginServices, so ABI-2 plugins keep working — they neither set nor read past the previous layout. ABI 3 plugins set abi_version=3 and use the new field. Loader accepts ABI 1, 2, and 3. Plumbing (in lib/ProxySQL_PluginManager.cpp): - register_runtime_view_service() free fn wires through to the manager's runtime_views_ vector - ProxySQL_PluginManager::register_runtime_view() rejects empty table names, null callbacks, and duplicate registrations - sql_references_table_ci() does whole-identifier substring match, so a SELECT on `runtime_mysqlx_users` doesn't fire the refresh for `runtime_mysqlx_users_extra` if both ever coexist - refresh_runtime_views_for_query() iterates registered views and invokes the matching refresh callbacks - proxysql_refresh_configured_plugin_runtime_views() is the Admin-callable wrapper that takes the manager shared lock Admin-handler integration (in lib/ProxySQL_Admin.cpp): - the existing pre-SELECT refresh block (where runtime_mysql_users triggers save_mysql_users_runtime_to_database(true), etc.) now also calls proxysql_refresh_configured_plugin_runtime_views(). This is the SAME refresh point the canonical core tables use, so plugin views are guaranteed to refresh before the admin query actually executes against admindb. Doc block at the bottom of ProxySQL_Plugin.h rewritten to spell out the separation-of-duties contract explicitly, replacing the previous "copy_table guidance" that incorrectly endorsed plugins persisting their runtime state to admin_db tables. This commit is the foundation only — no plugin uses the new API yet. The follow-up commits convert the mysqlx plugin's four entity pairs (users / routes / endpoints / variables) to the canonical pattern. |
4 weeks ago |
|
|
e68f72cf99 |
test(mysqlx): add diag logging + fix broken plan/schema in unit tests
Two related changes to all mysqlx_*_unit-t.cpp files.
# 1. Diagnostic logging across all 21 mysqlx unit tests
Before this commit none of the mysqlx unit tests emitted any output
beyond raw TAP `ok N`/`not ok N` lines. When CI-unit-tests-asan-
coverage hung mid-run on plugin-chassis (run 25021206900), the per-
test log file showed `ok 1 ... ok 6` and then nothing for ~110 minutes
until the workflow's 120-minute timeout killed the job. We could not
even tell *which* test was hung — the bash loop in the workflow only
logs `PASS:`/`FAIL:` after a binary exits.
Each binary now does:
- `setvbuf(stdout, nullptr, _IOLBF, 0)` as the first statement of
main(). Without this, when CI redirects stdout to a file the
default block-buffered mode swallows any output that hasn't filled
a 4KB-ish buffer — including diag lines emitted just before a
blocking syscall. Line-buffering means each `\n`-terminated diag
is flushed before the syscall, so a hang has 1-line-resolution
attribution in the log.
- `diag("=== <filename> starting ===")` right after `plan(...)`,
so the log always has at least one line proving the binary loaded
and reached main() (rules out crashes during static init).
- `diag(">>> %s", __func__)` at the top of every `static void
test_*()` subtest function called from main(), so a hang or
assertion failure points at the responsible subtest.
- In `mysqlx_concurrent_unit-t`, additional checkpoint diags inside
`test_concurrent_handshakes` ("starting Mysqlx_Thread", "spawning
N clients", "all clients spawned, joining", ..., "thr.stop()
returned") since the surrounding test was the one that actually
hung in CI; this gives a 7-checkpoint resolution within the body.
This change is the reason we were able to bisect the listener
O_NONBLOCK bug fixed in the previous commit: with these diags the
hang point ("all clients spawned, joining" → never reached "all
clients joined, sleeping 500ms") was visible in the per-test log
within seconds of running it.
# 2. Plan/fixture corrections in 4 tests that never actually passed
These tests were green in CI by virtue of nothing in the workflow
checking their exit codes (CI-mysqlx exercised a different path); the
moment CI-unit-tests-asan-coverage started actually running them they
came back red. Each was a real bug in the test harness, not in the
production code:
- mysqlx_backend_auth_unit-t.cpp: plan(42) but only 34 ok() can fire
on the success path. State_transitions emits 23, the remaining
six functions emit 11 — total 34. plan(42) was never reachable;
fixed to plan(34).
- mysqlx_session_unit-t.cpp: plan(62) but only 60 fire. Four `ok(
false, ...)` lines live in protobuf-parse failure branches that
the success path skips; fixed to plan(60).
- mysqlx_config_store_unit-t.cpp: load_from_runtime() SELECTs from
runtime_mysqlx_variables (the variables table the production code
uses to pick up thread_pool_size / connect_timeout / tls_mode /
max_cached_connections at runtime), but the test's fixture only
created 3 of the 4 mysqlx tables. Added kRuntimeMysqlxVariablesDdl
and the matching execute() — same shape the sibling
mysqlx_config_store_concurrent_unit-t already uses.
- mysqlx_route_store_unit-t.cpp: ad-hoc minimal DDL for
runtime_mysql_users / runtime_mysql_servers omitted columns the
production query SELECTs (password, weight). Switched to the
canonical ADMIN_SQLITE_RUNTIME_MYSQL_USERS and
ADMIN_SQLITE_TABLE_RUNTIME_MYSQL_SERVERS macros and added the
runtime_mysqlx_variables table.
After this commit `for t in mysqlx_*_unit-t; do ./$t; done` is 21/21
green (754 ok asserts total, 0 not_ok, 0 timeouts), 10/10 stable across
repeated runs of the previously-flaky mysqlx_concurrent_unit-t.
|
4 weeks ago |
|
|
6844a1cf4c |
fix(mysqlx): set listener fd to non-blocking
Mysqlx_Thread::add_listener() called socket() / bind() / listen() but
never set O_NONBLOCK on the resulting fd. The accept-drain loop in
accept_new_connection() (line 213) is structured as
while (true) {
int client_fd = accept(listener_fd, ...);
if (client_fd < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK) break;
...
}
// ... create session ...
}
i.e. it relies on accept() returning EAGAIN once the kernel's accept
queue is empty. With a blocking listener fd the syscall instead blocks
inside the kernel waiting for the next connection, freezing the
poll-driven thread:
- already-accepted sessions never get their POLLIN serviced, so
CapabilitiesGet/handshake bytes the client wrote sit unread in
the kernel receive buffer (Recv-Q=5 in `ss -tnp`)
- the signal_pipe wakeup written by stop() is never observed,
so the listener never shuts down cleanly under load.
Reproducer: mysqlx_concurrent_unit-t (20 simultaneous CapabilitiesGet
clients). Without this fix, hangs deterministically — accept() drains
~6 of the 20 queued connections then blocks; the test eventually times
out at the join() loop. With it, the test completes 20 handshakes in
~600 ms.
Stress-tested locally: 16,000 handshakes across 10 runs of a custom
harness (3x200 back-to-back bursts + a 1000-client mega-burst + a
mid-burst stop()), zero failures, zero deadlocks. signal_pipe_[0]
already gets the same O_NONBLOCK treatment in init() — this just
extends the same protocol to the listener fd.
Production impact: not just a test bug. Any burst of clients arriving
faster than one round of poll() -> accept_new_connection() ->
process_all_sessions() can drain would freeze the thread until the
*next* incoming connection unblocks accept(); under steady-state load
the freeze persists arbitrarily long, starving every accepted-but-not-
yet-handshaken session, and stop() from the admin path cannot make
the thread exit.
|
4 weeks ago |
|
|
d4427731b7 |
Merge remote-tracking branch 'origin/v3.0' into plugin-chassis
Picks up the v3.0 fixes that unblock plugin-chassis CI: - |
4 weeks ago |
|
|
47ab14148f |
ci: add libprotobuf-dev to unit-tests-asan-coverage workflow
This workflow runs directly on the GitHub runner host (not inside one of the deb/rhel/suse-compliant docker containers whose entrypoints already install libprotobuf-dev on demand), so the dependency must be installed in the workflow itself. Without it, building with PROXYSQLGENAI=1 fails at Makefile parse time: the top-level Makefile recurses into plugins/mysqlx (PROXYSQL40 is implied by PROXYSQLGENAI), and plugins/mysqlx/Makefile's protobuf 3.x ABI guard aborts when it cannot find pkg-config metadata for protobuf. The rest of the dependency list mirrors INSTALL.md's Ubuntu section, to which libprotobuf-dev was added separately for general builds; this brings the workflow's package set in line with that. |
4 weeks ago |
|
|
85ad4fe3b4 |
test(mysqlx): rewrite dispatch tests with real backend fixture (#5679)
Closes the last 5 cluster-3 failures from issue #5679. The 17 previously-skipped dispatch sub-asserts now run with proper coverage, plus 3 other pre-existing failures (#21 compression code, #29 TLS init, #43 forward-no-connection) are addressed. ## Background The dispatch tests asserted that one handler() call after writing a SQL/CRUD/PREPARE/CURSOR/EXPECT message left status_ exactly at CONNECTING_SERVER. That premise was wrong: forward_to_backend() sets to_process=true, and handler()'s `goto handler_again` loop immediately re-enters the switch, running handler_connecting_server() in the same call. After commit |
4 weeks ago |
|
|
2b0c2fdcc4 |
fix(mysqlx): four minor security findings from issue #5676
Addresses the four Minor / Nit findings deferred when the Important
re-auth bug was fixed in commit
|
4 weeks ago |
|
|
99a745f6ed |
ci(mysqlx): wire mysqlx-soak group into TAP harness end-to-end
Completes the four follow-up items documented in the mysqlx-soak
group's README. After this commit, the harness scripts run inside
the proper docker-isolated TAP framework — no more ad-hoc invocations.
## (1) Add mysql-connector-python to proxysql-ci-base
test/infra/docker-base/Dockerfile installs python3 + a few pip
packages but lacked the X DevAPI bindings. Add
`mysql-connector-python` to the existing `pip3 install` line. Image
must be rebuilt (`docker build -t proxysql-ci-base:latest
test/infra/docker-base`); the new soak-tests CI job rebuilds
unconditionally per run, so CI gets the new package automatically.
## (2) TAP wrappers for the harness scripts
Two new Bash TAP entries under test/tap/tests/:
* test_mysqlx_soak_behavioral-t.sh — emits two TAP assertions:
scenario 1 = SIGTERM-mid-traffic (the harness signals the proxysql
container with `docker kill -s TERM proxysql.${INFRA_ID}` mid-run
and verifies clients receive Mysqlx::Error 1053 instead of TCP
RST); scenario 2 = LOAD MYSQLX ROUTES TO RUNTIME mid-traffic.
Both fall back to "skip" if mysql-connector-python is missing,
or if the proxysql container is unreachable after scenario 1.
* test_mysqlx_soak_stress-t.sh — single TAP assertion that wraps
stress.py. Defaults to 60s/20-clients to fit a CI timeout; long
soaks invoke stress.py directly with --duration 24h per issue
#5677.
Both wrappers default the connection params to the docker-internal
hostname `proxysql` (via network alias) so they work from inside the
test-runner container; environment overrides let local invocations
point elsewhere.
## (3) Register in groups.json
Two new entries:
"test_mysqlx_soak_behavioral-t" : [ "mysqlx-soak-g1", "@proxysql_min_version:4.0" ],
"test_mysqlx_soak_stress-t" : [ "mysqlx-soak-g1", "@proxysql_min_version:4.0" ],
Both use the @proxysql_min_version:4.0 tag (the harness only makes
sense in chassis-aware builds). Lint passes (421 entries, sorted).
## (4) CI job
Add `soak-tests` job to .github/workflows/CI-mysqlx.yml. Pattern
mirrors CI-taptests-pgsql-cluster.yml: restore build cache, build
plugin, build proxysql-ci-base, ensure-infras (TAP_GROUP=mysqlx-soak),
run-tests-isolated (TAP_GROUP=mysqlx-soak-g1), cleanup, archive logs
on failure.
The job runs after unit-tests passes (same dependency as e2e-tests)
and is independent of e2e-tests (parallel execution OK).
## What this covers
* Builds the plugin and rebuilds the test image with the X DevAPI.
* Stands up a real MySQL 8.4 backend (3-node replication via the
existing infra-dbdeployer-mysql84 image, X protocol on port
23306-23308 inside the docker network).
* Stands up ProxySQL in a container with the plugin .so bind-mounted
and a per-group config that declares plugins=("...").
* The mysqlx-soak setup-infras hook provisions one route, one user,
one endpoint, reloads, and verifies the listener bound on 6603.
* Two TAP tests run inside the test-runner container against the
freshly-stood-up ProxySQL, exercising the plugin end-to-end.
## What this does NOT cover
* Long-running soaks (24-72h). The CI job runs a 60s stress for
signal; the full soak per issue #5677 needs staging.
* All compression/TLS combinations. The harness's defaults are
uncompressed + clear-text; matrix expansion is future work.
* Listener-port collisions across parallel CI runs. INFRA_ID
isolates docker-network names but the TAP_GROUP-scoped MYSQLX_
PROXYSQL_PORT (default 6603) is a single value. CI runs are
serial per workflow concurrency group; not a problem today but
worth flagging if matrix-fanout is added.
|
4 weeks ago |
|
|
7e70c347f3 |
test(mysqlx): wire harness into the docker-isolated TAP framework
Per user direction: never run proxysql directly outside the testing
environment. The harness scripts at test/scripts/mysqlx/ are correct
as Python clients, but their assumed invocation ('run them against a
hand-started proxysql') was wrong. The proper integration is the
existing docker-isolated TAP harness, which already brings up
ProxySQL + backends in containers on a private docker network.
This commit lays the framework groundwork for that integration. It is
NOT yet a complete invocation of the harness — that requires a docker
image rebuild (mysql-connector-python is not in proxysql-ci-base) and
a TAP-test wrapper, both documented in the new
test/tap/groups/mysqlx-soak/README.md TODO list.
## What landed
* test/infra/control/start-proxysql-isolated.bash:
- Optional plugin .so bind-mount when PROXYSQL_LOAD_MYSQLX_PLUGIN=1.
Mounts ${WORKSPACE}/plugins/mysqlx/ProxySQL_MySQLX_Plugin.so at
/usr/lib/proxysql/ProxySQL_MySQLX_Plugin.so inside the container.
Fails fast with a clear message if the .so is missing.
- Optional per-group config override via PROXYSQL_CONFIG_OVERRIDE.
Lets a group ship a proxysql-ci.cnf that declares plugins=("...")
so the chassis loads the plugin at Phase A — the generic config
has no plugins= line, by design.
* test/tap/groups/mysqlx-soak/ (new group):
- env.sh: sets PROXYSQL_LOAD_MYSQLX_PLUGIN=1, PROXYSQL_CONFIG_OVERRIDE
pointing at the per-group .cnf, SKIP_CLUSTER_START=1 (single-node
proxysql is enough), and the X-protocol port constants the
setup-infras.bash hook + harness scripts share.
- infras.lst: just infra-dbdeployer-mysql84 (existing 3-node MySQL
8.4 with X-protocol on classic+20000 by dbdeployer convention).
- proxysql-ci.cnf: copy of the generic config with one extra block:
plugins=("/usr/lib/proxysql/ProxySQL_MySQLX_Plugin.so")
- setup-infras.bash: standard group-setup hook. Waits for
mysqlx_users admin table to appear (sanity-check that the
plugin loaded at all), then provisions one route, one user, one
endpoint via admin SQL, reloads to runtime, and verifies the
mysqlx listener bound on port 6603.
- README.md: documents the four remaining work items needed to
actually invoke the harness as a TAP test (add mysql-connector-
python to docker-base, wrap harness as a TAP entry, register in
groups.json, wire into CI).
This commit is intentionally narrow: it adds the framework wiring
that lets a future commit invoke the harness from inside the
test-runner container. Anyone with the four TODO items completed can
run the harness against a real chassis-loaded ProxySQL via:
WORKSPACE=$(pwd) INFRA_ID=dev-$USER TAP_GROUP=mysqlx-soak \
test/infra/control/ensure-infras.bash
— which is the canonical TAP-harness entry point per CLAUDE.md.
The standalone Python harnesses at test/scripts/mysqlx/ remain
runnable for ad-hoc dev validation, but they are no longer the
primary path; the docker-isolated TAP group is.
|
4 weeks ago |
|
|
fe91e290d8 |
test(mysqlx): add behavioural-validation and stress harnesses
Three companion harnesses for the post-merge confidence work tracked
in issues #5677 (smoke + soak), #5678 (behavioural validation), and
#5681 (stress test). These are NOT TAP unit tests — they require live
infrastructure (a real MySQL 8.x and a running ProxySQL with the
mysqlx plugin loaded). They post-date the merge window and exist to
let an operator with a staging environment reproduce the validation.
* test/scripts/mysqlx/README.md — setup recipe (ProxySQL admin
config, MySQL backend bring-up via docker or dbdeployer, the
invocation lines for both harnesses).
* test/scripts/mysqlx/behavioral_validation.py — exercises two
scenarios from issue #5678. Scenario 1 ("SIGTERM mid-traffic")
opens N X-Protocol clients running steady SELECT loops, sends
SIGTERM to proxysql, then verifies each client received a clean
Mysqlx::Error frame with code 1053 ("Server is shutting down")
rather than an unannounced TCP RST. Exercises
MysqlxSession::shutdown_notify_client (commit
|
4 weeks ago |
|
|
83725ea4e5 |
feat: add --no-plugins kill switch; fix 4 pre-existing test failures
## (1) --no-plugins kill switch (issue #5680) When the plugin chassis is enabled (PROXYSQL40 builds), an operator upgrading to v4.0.0 gets the chassis active by default. If a critical chassis bug is found post-release, the recovery options today are: - Roll back the entire ProxySQL package to v3.x. - Edit the config file to comment out plugins=() and restart. Add a runtime kill switch — a CLI flag (and equivalent env var) that bypasses plugin loading entirely, regardless of config. Cuts the time-to-recover dramatically and reduces deployment anxiety. CLI: --no-plugins (gated by PROXYSQL40) Env: PROXYSQL_NO_PLUGINS=1 (CLI takes priority) Field: GloVars.no_plugins Wired through: when set, LoadConfiguredPlugins / InitConfiguredPlugins / StartConfiguredPlugins / StopConfiguredPlugins all become no-ops. LoadConfiguredPlugins emits a single startup log line so the operator knows the bypass took effect: Plugin chassis disabled by --no-plugins / PROXYSQL_NO_PLUGINS=1; skipping load of N configured plugin(s) Verified: --no-plugins appears in proxysql --help. The bypass message string is in the binary. Full end-to-end smoke against a Docker MySQL deferred to issue #5677. ## (2) plugin_manager_unit-t #62 + #88 (issue #5679) Test bug. The two assertions encoded the pre-ab9d5a103 contract that "destructor skips stop on plugins that were never started". Commit |
4 weeks ago |
|
|
09c15d6d54 |
fix(mysqlx): reject re-auth on active session; fix two pre-existing test issues
## (A) Re-authentication on an active session is now rejected Addresses the Important finding from the security re-review of PR #5651 (see https://github.com/sysown/proxysql/issues/5676). After a successful login the session is in WAITING_CLIENT_XMSG. Before this commit, dispatch_client_message routed `SESS_AUTHENTICATE_START` and `SESS_AUTHENTICATE_CONTINUE` into the auth handlers unconditionally. The handlers overwrote `username_`, `identity_`, `target_hostgroup_`, `target_address_`, `target_port_` — but they did NOT tear down `backend_conn_`. The next StmtExecute was forwarded over the previous user's pooled backend connection. The proxy then audited the query as user B while the backend executed it as user A's role — a real identity-coherence / audit hazard. The X Protocol uses `Mysqlx::Session::Reset` for re-auth on the same connection, not direct re-auth. Reject `SESS_AUTHENTICATE_START` / `SESS_AUTHENTICATE_CONTINUE` when `status_ == WAITING_CLIENT_XMSG` with code 1845 (FATAL) and drop the session. Conformant with the spec. Also clears `auth_challenge_` on successful auth (defense in depth): the verified challenge is no longer reachable by a stale AuthenticateContinue replay even before the dispatch-level guard fires. The unit test `test_error_severity_non_fatal` previously took a shortcut: it manually set `status_=WAITING_CLIENT_XMSG` then sent AUTHENTICATE_START to drive the auth flow. With the re-auth rejection now in place, that shortcut hits the new guard and the test hangs waiting for an auth challenge that never comes. Updated the test to drive the auth flow naturally from CONNECTING_CLIENT (the state init() leaves the session in), which exercises the same code paths without the now-invalid pre-auth status_ override. ## (B) mysqlx_config_store_concurrent_unit-t: missing variables DDL This was the source of 6 pre-existing test failures surfaced during the ASAN run on PR #5651 (4, 11, 12, 13, 14, 15). All asserted that load_from_runtime atomically replaces previously-loaded data. They failed because the test fixture's create_runtime_db() did not create a `runtime_mysqlx_variables` table, but `load_from_runtime` queries that table near the end: SELECT variable_name, variable_value FROM runtime_mysqlx_variables When the table doesn't exist, fetch_result returns false and load_from_runtime short-circuits BEFORE swapping the new identities/ routes/endpoints into place. Every "second load replaces first" assertion silently failed because the second load never actually replaced anything — the swap never happened. This is the same bug that was fixed in `mysqlx_config_store_pure_unit-t.cpp` in commit |
4 weeks ago |
|
|
4bc7044710 |
ci(docker): install libprotobuf-dev on demand when PROXYSQLGENAI=1
CI-builds (ubuntu24,-tap-genai-gcov) was failing on PR #5651 because the proxysql/packaging:build-ubuntu24-v4.0.0 image lacks libprotobuf-dev. The plugin Makefile's pkg-config check at plugins/mysqlx/Makefile:47 fires correctly: protobuf 3.x is required for the vendored .pb.cc/.pb.h that were generated with protoc 3.21.12. The v4.0.0 packaging images were built in anticipation of this PR but never updated to include the new dependency. Two paths to resolve. (a) Update the image and republish proxysql/packaging:build-ubuntu24-v4.0.0 + cousins. (b) Patch the docker-compose entrypoint to install on demand. (a) is the cleaner long-term fix but has a longer feedback loop (separate pipeline, separate review). (b) unblocks CI immediately and keeps working even if a future image rebuild forgets the package again. This commit takes path (b) for all three image families: - docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash → apt-get install -y libprotobuf-dev (Debian, Ubuntu) - docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash → dnf|yum install -y protobuf-devel (CentOS, RHEL) - docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash → zypper install -y libprotobuf-c-devel || protobuf-devel (SUSE) The install is gated on PROXYSQLGENAI=1 (otherwise the plugin path is not exercised) AND on pkg-config --exists protobuf returning false (image already has it → install is a no-op). Idempotent across container restarts. Once the v4.0.0 packaging images are republished with libprotobuf-dev included, this on-demand install becomes a no-op pkg-config check on every build and can be removed. Tracked in issue #5673. Verified locally: the deb-compliant patch follows the existing entrypoint control-flow exactly (set -eu safe, no early exit, runs before the ${MAKE} ${deps_target} call where the protobuf check would fire). |
4 weeks ago |
|
|
baeca0e3dc |
test: silence SonarCloud BUG: name truncate-via-temporary in clear_log()
Three identical SonarCloud BUG-severity findings (one per file) on the
truncate-via-temporary idiom:
std::ofstream(g_log_path, std::ios::trunc);
This creates a temporary std::ofstream whose destructor closes the file
— the truncate is the intended side effect. SonarCloud's rule "Name
this unused temporary object or remove it" does not understand the
side-effect pattern and flags it as a BUG.
Issue #5674 triaged all 3 BUG findings as false positives. This commit
silences them with the cosmetic fix recommended in that issue: give
the temporary a name and (void)-cast it. Same generated code, no
behaviour change, but Sonar stops flagging it.
Files: test/tap/tests/unit/plugin_{config,lifecycle,manager}_unit-t.cpp
|
4 weeks ago |
|
|
ccc6648e06 |
docs(plugin-chassis): update stale comment referencing materialize_plugin_tables
Caught while running the 17 consistency-seam checks from the new
REVIEW_GUIDE.md §7. The comment block above proxysql_load_configured_
plugins() still pointed at ProxySQL_Admin::materialize_plugin_tables —
which was removed in commit
|
4 weeks ago |
|
|
42afebcb64 |
docs(plugin-chassis): add reviewer's guide, ABI contract, and file inventory
PR #5651 is large enough that reading commit-by-commit or file-by-file without context is unproductive. Add three companion docs under doc/plugin-chassis/ so a senior reviewer can validate the PR layer by layer. * REVIEW_GUIDE.md (~345 lines) — entry point. One-paragraph project description, scope diagram, three reading orders (30 minutes / 2 hours / full day), the 4-phase plugin lifecycle with a sequence-style ASCII diagram, the worked-example walk-through of a mysqlx client request end to end, the build-system tier-flag propagation map (5 Makefile layers), 17 explicit "consistency seams" each with a one-line shell verification, the 5 commit-intent bands so the ~150 commits map to a small number of logical changes, and a final verification checklist. * ABI.md (~270 lines) — the canonical reference for the plugin ABI: the descriptor surface, the services surface and its phase-availability matrix, the C++-ABI coupling (std::string and prometheus-cpp must match between core and plugin), the empty-source-sync invariant, the concurrency model and lifecycle pairing rules ("stop pairs with init, not start"), the ABI versioning rules (tail-append, version-gate every new-field read, reject anything > MAX), and a minimal plugin skeleton for reference. * FILE_CHANGES.md (~503 lines) — the per-file inventory. Sections A–G cover the chassis core (15 files), H–S cover the mysqlx plugin (12 source files + 1 build file + 16 generated protobuf files described collectively), T covers tests/CI/infra (28 unit tests with their individual plan() counts, 4 integration tests, the build glue, the groups.json delta, and the new CI workflow). Each entry: path, status, line-count, purpose, key contents, what to spot-check. Total: 1117 lines of reviewer documentation. The expectation is that a reviewer with 30 minutes can ship-no-ship from REVIEW_GUIDE alone; a reviewer with 2 hours can validate the architecture; a reviewer with a full day can run every test and walk every file via FILE_CHANGES. These docs are written for THIS PR. They are not a replacement for doc/PLUGIN_API.md (which is the public-facing API doc for plugin authors) — REVIEW_GUIDE explicitly points at PLUGIN_API for plugin authors and at ABI.md for the canonical contract. Verified: - All 17 §7 verification rows actually pass on the current HEAD (spot-checked: register_schemas gating at abi_version >= 2, TLS_PASSTHROUGH absence, shared_mutex change, ABI version macros, groups.json tag counts). - Cross-doc references (REVIEW_GUIDE → ABI → FILE_CHANGES) are consistent. |
4 weeks ago |
|
|
55e90d1a76 |
fix(plugin-chassis,mysqlx): chassis read-path scaling, graceful shutdown, hardening
Six independent items from the independent review of PR #5651, batched together because each one alone is small. 1) lib/ProxySQL_PluginManager.cpp: replace g_active_plugin_manager_mutex with a std::shared_mutex. Readers (dispatch_admin_command, dispatch_query_hook, resolve_alias_to_canonical) take a shared lock so multiple worker threads can be inside plugin callbacks concurrently; writers (publish/unpublish in load/stop) take the unique lock. The previous std::mutex serialized every plugin-callback dispatch on one mutex. Once a plugin actually wires a query hook into MySQL_Thread / PgSQL_Thread, every concurrent client query on every worker would have queued behind that mutex — silently negating ProxySQL's per-worker parallelism. The lock-free proxysql_has_configured_plugin_query_hook() didn't help, since the actual dispatch still took the lock. Switching to shared_mutex on the read path lets dispatch scale linearly. 2) plugins/mysqlx/include/mysqlx_session.h + plugins/mysqlx/src/mysqlx_session.cpp + plugins/mysqlx/src/mysqlx_thread.cpp: add MysqlxSession::shutdown_notify_client() and call it from Mysqlx_Thread::run() on the way out of the worker loop. Previously Mysqlx_Thread::stop() flipped running_=false and joined. The destructor then deleted sessions, closing their fds. Connected clients saw an unannounced TCP RST mid-response and a torn TLS record. Now the worker, on its way out, walks sessions_ and for each live session: enqueues a Mysqlx::Error frame (code 1053, "Server is shutting down", FATAL severity); flushes one write_to_net pass; if TLS is up, calls SSL_set_quiet_shutdown(1) + SSL_shutdown so the peer's TLS stack sees a proper close_notify rather than a torn record. Best-effort throughout — never blocks on unresponsive peers because the process is exiting. 3) plugins/mysqlx/include/mysqlx_session.h + plugins/mysqlx/src/mysqlx_session.cpp: remove the dead TLS_PASSTHROUGH enum value and the two corresponding branches. handler_tls_accept_init's first three lines and the `tls_mode_ != TLS_PASSTHROUGH` predicate in handler_connecting_server only ran when set_tls_mode(TLS_PASSTHROUGH) had been called, which never happened in production — the `mysqlx_tls_mode` config column is never plumbed into a session. Worse, the PASSTHROUGH branch did not actually implement an opaque pipe (it just skipped TLS termination and resumed clear-text X-Protocol parsing, which would desync any real client). Drop the value rather than carry a misleading enum that suggests a feature exists. Future passthrough work should reintroduce a properly-wired implementation. 4) plugins/mysqlx/src/mysqlx_connection.cpp: check the return value of inet_pton in start_connect; fail fast on anything that isn't a valid IPv4 dotted-quad. Previously the return was discarded. inet_pton on a hostname (or IPv6 literal, or empty string) silently left sin_addr at 0.0.0.0 — producing a connect to 0.0.0.0/INADDR_ANY rather than the intended target. Real footgun because mysqlx_backend_endpoints.hostname accepts arbitrary strings. Now: fail with ERROR_STATE so the misconfig surfaces instead of routing traffic to the wrong target. Hostname resolution is still the upstream pipeline's job; start_connect deliberately stays narrow. 5) plugins/mysqlx/src/mysqlx_data_stream.cpp: move do_ssl_handshake's 64 KiB scratch buffer from the stack to a thread_local static. ASan-instrumented builds and large-thread-pool configs can run with thread stacks tight enough that a stack-allocated 64 KiB local straddles the limit. Each Mysqlx_Thread owns its own thread_local instance so the buffer is not shared between threads. 6) plugins/mysqlx/src/mysqlx_thread.cpp: document the listener-removal semantics on remove_listener_for_route. Document that already-accepted sessions on a listener that's being removed continue running against their existing target_hostgroup_ / target_address_ / target_port_ until they finish or hit idle timeout. That matches surrounding MySQL behaviour (DROP TABLE doesn't cancel in-flight queries; ALTER doesn't kick off open prepared statements). Future change can call shutdown_notify_client on matching sessions if active disconnection becomes desirable. NOT changed: the agent-flagged "compression overshoot" issue at plugins/mysqlx/src/mysqlx_session.cpp:1283. The zstd-stream loop already caps the resize at `cap` on line 1369 (`if (new_sz > cap) new_sz = cap;`) before the resize, so decompressed never grows past the cap; there is no overshoot. Verified by tracing the loop. Skipped. Verified locally: - plugin .so builds clean with PROXYSQL40=1 and the implied tier flags. - libproxysql.a and src/proxysql build clean. - plugin chassis tests (plugin_lifecycle_unit-t, plugin_dispatch_unit-t, plugin_manager_unit-t, plugin_query_hook_unit-t) build and pass with the new shared_mutex read path. plugin_manager_unit-t shows the same 2 pre-existing destructor-related failures it had before this commit (verified by stash + rebuild). - mysqlx_robustness_unit-t passes 74/74. - mysqlx_session_unit-t has the same pre-existing failures at 33-34. |
4 weeks ago |
|
|
df7e335e23 |
fix(ci,infra): pass PROXYSQL40 to plugin build, remove orphaned infra files
Three CI/infra clean-ups that fall out of the independent review. 1) .github/workflows/CI-mysqlx.yml: pass PROXYSQL40=1 (and the implied tier flags) to `make` when building the mysqlx plugin. plugins/mysqlx/Makefile picks up tier flags from the environment and propagates them as -DPROXYSQL40 / -DPROXYSQL31 / -DPROXYSQLFFTO / -DPROXYSQLTSDB / -DPROXYSQLGENAI on every compile line. If the workflow runs `make` with no flags, the plugin is built without -DPROXYSQL40 — meaning the ProxySQL_PluginDescriptor and ProxySQL_PluginServices struct layouts compiled into the plugin .so differ from the layouts that the cached src/proxysql binary (built upstream by CI-trigger with the full tier flags) sees. The link succeeds and the first virtual dispatch into a plugin callback crashes or, worse, corrupts memory silently. The Makefile already warns about exactly this in lines 56-61. Pass the flags explicitly. 2) test/tap/groups/mysqlx-e2e/infras.lst + test/infra/docker-compose-mysqlx.yml: delete both — they are orphaned. `infras.lst` referenced `infra-mysqlx`, which has never existed under `test/infra/`. ensure-infras.bash would have errored on it — except `mysqlx-e2e/env.sh` exports SKIP_PROXYSQL=1, which makes ensure-infras.bash short-circuit at line 38 before it reaches the docker-compose loop. So infras.lst was both wrong AND unreachable — the worst combination for the next reader trying to figure out how the e2e group is wired. Similarly, `test/infra/docker-compose-mysqlx.yml` was a docker-compose file that no `infra-*/` directory points at, left over from an early plan to use Docker for the mysqlx backend that was abandoned in favour of dbdeployer. Both files are dead weight; delete them. 3) test/tap/groups/mysqlx-e2e/env.sh: comment the unconventional wiring so the next reader doesn't have to reverse-engineer it. Document why this group has no `infras.lst` / no `infra-mysqlx/` dir, why CI uses inline dbdeployer instead of ensure-infras.bash, and that setup-infras.bash + pre-cleanup.bash exist for local-only ad-hoc use today. 4) test/tap/tests/Makefile: drop the dangling `test_mysqlx_listener_smoke-t` target. That test was retired together with the dormant MysqlxWorker path in commit 98aee7db2; the unit/Makefile no longer builds it. The wrapper target in test/tap/tests/Makefile remained and would fail `make test_mysqlx_listener_smoke-t` with "no rule to make target". Replace with a NOTE pointing at where the listener-lifecycle coverage actually lives now (mysqlx_thread_unit-t, mysqlx_robustness_unit-t). Verified: the plugin still builds clean with the tier flags exported to the sub-make. No behavioural change for the docker-using groups. |
4 weeks ago |
|
|
04bccec51e |
chore(plugin-chassis): tighten gating, drop dead paths, gate forgery setters
Five clean-up items from the independent review of PR #5651. None of these change behaviour on a normal run; they each fix a concrete way the current code is misleading or unnecessarily exposed. 1) lib/ProxySQL_Admin.cpp: gate the three plugin-DB-handle getters (proxysql_plugin_get_admindb / _configdb / _statsdb) under #ifdef PROXYSQL40. Previously these were defined unconditionally and emitted symbols into v3.0/v3.1 binaries. The chassis is a v4.0 feature; the user explicitly required that v3.x builds carry no plugin-aware code. Wrap in PROXYSQL40 so they are entirely absent from v3.x linkage. ProxySQL_PluginManager.cpp's extern declarations (lines 23-25) are already inside the file-wide PROXYSQL40 gate and so resolve only when the gate is active. 2) lib/ProxySQL_PluginManager.cpp + include/ProxySQL_PluginManager.h: delete the dead `#else /* !PROXYSQL40 */` branches. Both files are wrapped in a top-level `#ifdef PROXYSQL40` covering the entire body. Inner `#ifdef PROXYSQL40 ... #else ... #endif` blocks therefore had unreachable `#else` arms — 30+ lines of "pre-chassis two-phase loader" in the .cpp, plus a redundant declaration of proxysql_load_configured_plugins in the .h. The dead arms read as load-bearing alternative implementations on review and that is exactly the wrong signal. Drop them; the single PROXYSQL40 path is the only one. 3) lib/Admin_Bootstrap.cpp + include/proxysql_admin.h + src/main.cpp: remove ProxySQL_Admin::materialize_plugin_tables(). `Admin::init()` already merges plugin-declared schemas into tables_defs_{admin,config,stats} (~line 944) and runs the DDL via check_and_build_standard_tables() (~line 994), all on the same first-boot/reload code path the core tables use. The follow-up call to GloAdmin->materialize_plugin_tables() in main.cpp ran a second name-dedup pass that found everything already present and produced an empty new-rows set — i.e. the post-init helper was a no-op disguised as load-bearing infrastructure. Delete the helper, the header declaration, and the main.cpp call site, and update the comments in main.cpp + ProxySQL_PluginManager.cpp to point at Admin::init() as the single canonical materialization site. Leave a NOTE in Admin_Bootstrap.cpp at the old call site so anyone re-adding a similar helper sees why the prior one was removed. 4) plugins/mysqlx/include/mysqlx_session.h + plugins/mysqlx/src/mysqlx_session.cpp: gate the two genuine forgery vectors behind MYSQLX_TEST_BUILD. inject_identity_for_test() bypasses the full auth flow — no credential check, no capability negotiation, just sets identity_ to a caller-supplied MysqlxResolvedIdentity. resolve_backend_target_ for_test() drives a private routing helper without an authenticated identity. Both are necessary for unit tests but should not be reachable at all in shipped binaries; an in-process exploit reaching the session can call inject_identity_for_test() to forge an authenticated identity. Wrap them in #ifdef MYSQLX_TEST_BUILD; define -DMYSQLX_TEST_BUILD in the test Makefile only. The remaining target_*_for_test() getters are read-only state observers and are left unconditional — they cannot mutate the session and a debugger could observe the same state regardless. 5) test/tap/tests/unit/Makefile: define -DMYSQLX_TEST_BUILD on every unit test compile line via OPT. This is the test-only knob that re-enables the gated forgery methods so unit tests still compile. plugins/mysqlx/Makefile does NOT define this macro, so the production .so does not compile in the entry points. Verified locally: - plugins/mysqlx/ProxySQL_MySQLX_Plugin.so builds clean with PROXYSQL40=1 PROXYSQL31=1 PROXYSQLFFTO=1 PROXYSQLTSDB=1 PROXYSQLGENAI=1 (no MYSQLX_TEST_BUILD). - test/tap/tests/unit/mysqlx_robustness_unit-t builds and runs: 74/74 assertions pass, including the ones that exercise inject_identity_for_test (visible only because the test Makefile defines MYSQLX_TEST_BUILD). |
4 weeks ago |
|
|
4bd4b462be |
fix(mysqlx): three blocking protocol/pool correctness bugs
Three independent issues, fixed together because they all sit on the
data-plane critical path and each one alone is enough to corrupt the
session state machine.
1) MysqlxConnection::reset() did not scrub backend_ds_ buffers.
The pooled-connection reuse path (Mysqlx_Thread::return_connection_
to_cache → reset → next session's get_connection_from_cache) calls
MysqlxConnection::reset() between sessions. The previous version of
reset() cleared in_transaction_, has_prepared_stmt_, reusable_, and
auth_state_ but left the underlying MysqlxDataStream's read_buf_,
write_buf_, ssl_write_buf_, and complete_frames_ untouched. Any
straggler frame the prior session left in flight — for example a
NOTICE that arrived after the terminal frame, an unread row that
the prior session abandoned, or a half-parsed frame whose body had
not finished arriving — would be served to the next session as if
it were the response to its first query. That is a real
cross-session data leak, not just a robustness issue.
Adds MysqlxDataStream::clear_io_buffers() which scrubs the I/O
queues without touching fd_, ssl_, rbio_ssl_, wbio_ssl_, or
encrypted_. Preserving the SSL state is critical: rebuilding the
SSL* would force a fresh TLS handshake on every pool checkout and
would discard ALPN / cipher negotiation already done. Calls it
from MysqlxConnection::reset().
2) handler_capabilities_set silently accepted unparseable
CapabilitiesSet messages.
In plugins/mysqlx/src/mysqlx_session.cpp the previous logic was
`if (cap_set.ParseFromArray(...))` { ... } and on parse failure
fell through to the unconditional `pop_frame(); send_ok();
status_=CONNECTING_CLIENT;`. A buggy or hostile client that ships
an unparseable capability payload would be told the negotiation
succeeded — the server then proceeded with default capabilities
while the client believed it had selected something. This is the
exact kind of confused-state bug the X Protocol error codes exist
to prevent.
Returns send_error(5051, "Invalid CapabilitiesSet payload") on
parse failure. 5051 is the X Protocol convention for an
unrecognized/unparseable capability message; 5052 is reserved for
"supported capability with rejected value" and is already used
for the compression-value-not-supported path two blocks down.
3) step_auth_authenticate_start_sent ignored the return of
AuthenticateContinue::ParseFromArray.
In plugins/mysqlx/src/mysqlx_connection.cpp the backend-side auth
state machine called `cont.ParseFromArray(frame->data() + 5,
frame->size() - 5)` and discarded the bool. A backend (or a MITM
that has bypassed TLS, or a misbehaving X-Protocol-aware proxy
between us and the backend) returning a malformed
AuthenticateContinue would produce an empty auth_data() field;
the resulting empty challenge was then handed to
mysqlx_mysql41_scramble() which would compute a scramble against
a zero-length challenge — undefined-input territory. Backend
auth would still fail eventually, but only after operating on
uninitialized protobuf fields.
Now: on parse failure, mark BACKEND_AUTH_ERROR and return -1
so the failure surfaces immediately and we never trust the
half-parsed message body.
Verified: plugins/mysqlx builds cleanly with PROXYSQL40=1
PROXYSQL31=1 PROXYSQLFFTO=1 PROXYSQLTSDB=1 PROXYSQLGENAI=1.
Existing unit tests for protocol parsing and auth state are
unchanged in expected behaviour (the new code paths trip only on
malformed inputs that no current test exercises).
|
4 weeks ago |
|
|
9f5ed235b8 |
fix(build,test groups): unblock CI on plugin-chassis
Two unrelated CI blockers, fixed together because each one alone leaves
the pipeline red and they are trivially independent:
1) `make cleanbuild` (and any other goal that recurses into plugins/mysqlx
on a v3.0/v3.1 box without libprotobuf-dev) failed in
plugins/mysqlx/Makefile because the protobuf-3.x ABI check fires at
parse time. The check is correct for *building* the plugin — running
pre-generated .pb.cc against an ABI-incompatible libprotobuf would
produce a .so that links cleanly and crashes on first virtual
dispatch — but it has no business firing for `clean`/`cleanall`,
which only delete object files. Wrap the check in
`ifeq ($(filter clean cleanall,$(MAKECMDGOALS)),)` so the safety
guarantee is preserved on build paths and clean is now usable on a
bare host. CI-builds was failing every job at Makefile:540 cleanbuild
for this reason, and the failure cascaded through every dependent
test workflow.
2) `mysqlx_compression_unit-t` was added in the X-Protocol Phase-1/2/3
compression commits but never registered in `test/tap/groups/groups.json`.
The lint workflow `check_groups.py --source` flagged it as
"executable test missing from groups.json" and exited 1, blocking
the entire CI run. Add the entry to `unit-tests-g1` with the
`@proxysql_min_version:4.0` tag, matching every other mysqlx unit
test in the file.
Also restore six MySQL test entries that lost their `mysql90-g3`,
`mysql95-g3` tags during the
|
4 weeks ago |
|
|
ce39154731
|
Merge pull request #5593 from sysown/ProtocolX
feat: MySQL X Protocol plugin (dynamically loaded) |
4 weeks ago |
|
|
31d7ae9ecb |
docs(mysqlx): reconcile comprehensive-testing plan against ProtocolX-rebased
Audit the 14-task plan from 2026-04-09 against the actual test tree on
ProtocolX-rebased and record the result inline.
Findings:
- Tasks 1-8, 10-14: every Tier-1 / Tier-2 / Tier-3 target file exists
with a plan() at or above the assertion budget the plan called for.
Tasks 5, 6, 8, 12 went well beyond their targets through interim
expansion work; the others land exactly on plan.
- Task 9 is obsolete: test_mysqlx_listener_smoke-t.cpp was deleted in
|
4 weeks ago |
|
|
aef01ef0be |
feat(mysqlx): compress outbound server frames (Phase 3)
Phase 3 of three-phase X Protocol compression support: server→client
compression on outbound frames. Wraps up the MVP — CapabilitiesSet
negotiation (Phase 1), inbound decompression (Phase 2), and now
outbound compression all roundtrip.
What this commit does
=====================
forward_frame_to_client() — the chokepoint for backend→client frame
forwarding — now routes through send_to_client_compressed(), which:
1. Returns early to plain client_ds_.enqueue_frame() when compression
is not negotiated OR the body is below COMPRESSION_MIN_OUTPUT_BYTES
(50 bytes — same threshold the upstream MySQL X plugin uses; per-
message envelope + framing overhead would otherwise dwarf savings).
2. With combine_mixed_messages = false: emits one Compression frame
per body. The protobuf has server_messages set to the original
frame's msg_type and uncompressed_size set to the original body
length, so a spec-compliant client can decompress in place.
3. With combine_mixed_messages = true: appends a fully-framed copy
of the body to compress_batch_framed_ and bumps compress_batch_count_.
Once the count reaches max_combine_messages (defaulting to 64 if
the client didn't supply one), or flush_compression_batch() is
invoked at a natural boundary, all buffered frames are emitted as
one Compression message with NEITHER server_messages nor
client_messages set — payload is the concatenated stream of framed
X messages, matching the spec's third payload shape.
The flush points are:
- handler_waiting_server_msg() when it sees a terminal frame (end
of a result set / final OK / etc.) — the response is "done" so
anything still buffered must reach the wire before we go back to
WAITING_CLIENT_XMSG.
- handler_session_reset_waiting() on the ERROR path before
write_to_net(), same reasoning.
Mid-response we deliberately do NOT flush — that would defeat the
combine_mixed_messages benefit by emitting a Compression message per
batch hit, which is exactly what we're trying to avoid for streaming
result sets. The count cap bounds how long a single batch can grow.
Compressor selection mirrors Phase 2:
- zstd_stream uses ZSTD_compressCCtx() with a per-session ZSTD_CCtx
that's lazily allocated and freed in reset_compression_state().
- lz4_message uses LZ4_compress_default() one-shot.
On compressor failure (ZSTD_isError or lz4 returning <= 0) the helper
falls back to enqueueing the body uncompressed — losing compression
benefit beats dropping the message. The session itself stays healthy.
Tests
=====
mysqlx_compression_unit-t now plans 64 sub-tests, all passing:
- Phase 1: 22 sub-tests for capability negotiation
- Phase 2: 17 sub-tests for inbound decompression
- Phase 3 (new, 25 sub-tests):
- zstd round-trip: frame on the wire is COMPRESSION with
server_messages = NOTICE; payload decompresses back to the
exact original 200-byte body
- lz4 round-trip, same shape
- below-threshold passthrough: 20-byte body emitted as plain
NOTICE, not COMPRESSION (verifies the fast path)
- combine_mixed_messages with max_combine_messages=3: three
successive sends produce ONE Compression frame whose
decompressed payload contains all three NOTICE bodies in
order, with neither server_messages nor client_messages set
- compression-disabled passthrough: when no negotiation, the
helper acts as a plain enqueue_frame() (proves a client that
never opts in is unaffected)
A few new test-only accessors expose the batch state and
send_to_client_compressed() entry point so tests can exercise the
output path without wiring a fake backend (which would block on
connect() in the dispatcher anyway).
Verification
============
Top-level `PROXYSQLGENAI=1 make` builds cleanly. mysqlx_compression_unit-t
passes 64/64. plugin_lifecycle_unit-t (26/26) passes unchanged.
mysqlx_session_unit-t still has its two pre-existing failures at
sub-tests 33-34 (auth flow), unrelated to compression and present on
this branch before the Phase 1 commit.
|
4 weeks ago |
|
|
b1fd6b31fc |
feat(mysqlx): decompress incoming Compression messages (Phase 2)
Phase 2 of three-phase X Protocol compression support: client→server
decompression. Compression on the server→client path (Phase 3) still
goes out uncompressed; CapabilitiesSet stores the negotiation in
Phase 1 and this commit consumes it.
What this commit does
=====================
When the client sends a Mysqlx.Connection.Compression message AND
compression has been negotiated, we now:
1. Parse the Compression protobuf — payload bytes, optional
uncompressed_size hint, optional client_messages tag.
2. Decompress the payload using the negotiated algorithm:
- zstd_stream: streaming decompression via a ZSTD_DCtx that
persists across messages on the same session (per spec —
successive Compression frames may continue a single zstd
stream, so we cannot recreate the context per frame).
- lz4_message: one-shot LZ4_decompress_safe. The X spec defines
lz4_message as one independent frame per message, so no
persistent context is needed.
3. Feed the decompressed bytes back into client_ds_.feed_bytes() so
the existing frame parser picks them up. Two payload shapes per
spec are handled:
- client_messages set: payload is one decompressed body of that
type — we re-frame with a 5-byte X header in front.
- neither set: payload is already a sequence of fully-framed
X messages — fed verbatim.
4. The dispatch loop re-enters on the same handler tick (to_process
set), so a Compression-wrapped StmtExecute runs end-to-end without
an extra network roundtrip.
If client_messages is unset and server_messages IS set, the message
is rejected (5008): server_messages on the c→s path is always wrong.
Anti-bomb / bounds
==================
COMPRESSION_MAX_DECOMPRESSED_BYTES = 16 MiB caps how much output a
single Compression message can produce, mirroring MysqlxDataStream's
existing on-the-wire X_MAX_PAYLOAD_SIZE so a Compression frame never
expands beyond what the rest of the data plane can handle anyway. If
the client provides an uncompressed_size hint smaller than 16 MiB we
honor that as the tighter bound. Hint of 0 with non-empty payload is
treated as malformed.
For zstd, the decompression loop re-checks the cap before each
ZSTD_decompressStream call and bails (with 5008) the moment the
output buffer would exceed it. A no-progress condition (zout.pos == 0
with input remaining) also bails — that catches malformed streams
that would otherwise spin forever.
For lz4, LZ4_decompress_safe(dstCapacity = cap) naturally enforces
the limit: the decompressor refuses to write past dstCapacity and
returns an error code we map to 5008.
Linkage / build
===============
The plugin .so is dlopen'd with RTLD_LOCAL, so symbols from libzstd
/ liblz4 that the proxysql binary may already pull in are NOT
visible to the plugin. This commit links the static
deps/zstd/zstd/lib/libzstd.a + deps/lz4/lz4/lib/liblz4.a archives
directly into the .so so the plugin is self-contained.
The session header forward-declares ZSTD_DCtx / ZSTD_CCtx so the
zstd headers don't leak through include/mysqlx_session.h into other
translation units.
Tests
=====
mysqlx_compression_unit-t now covers Phase 2 end-to-end (39 sub-
tests total, all passing):
- Phase 1: capability negotiation (22 sub-tests, unchanged)
- decompress zstd_stream client_messages=SQL_STMT_EXECUTE,
inner StmtExecute reaches dispatch (no 5008, session moves
past WAITING_CLIENT_XMSG)
- same for lz4_message
- oversize bomb attempt: lie about uncompressed_size, send
a 1 MiB-of-zeros payload — rejected with 5008
- garbage compressed payload: rejected with 5008
- sanity: COMPRESSION before negotiation still 5008
Verification
============
Top-level `PROXYSQLGENAI=1 make` builds cleanly; the plugin .so
links against the static zstd + lz4 archives. plugin_lifecycle_unit-t
(26/26) passes unchanged. mysqlx_session_unit-t still has its two
pre-existing failures at sub-tests 33-34, identical to behavior
before this commit (verified by stashing only the Phase 2 edits to
plugins/mysqlx/{src,include}/* + Makefile and rebuilding). The
mysqlx_thread_unit-t / mysqlx_concurrent_unit-t hangs are also
pre-existing and reproduce on the unmodified branch.
|
4 weeks ago |
|
|
f19be5f3a0 |
feat(mysqlx): negotiate X Protocol compression capability (Phase 1)
Phase 1 of three-phase X Protocol compression support: capability
negotiation only. The COMPRESSION message itself is still rejected
with error 5008 in dispatch_client_message(); Phase 2 wires up
decompression on input and Phase 3 wires up compression on output.
What this commit does
=====================
- send_capabilities() now advertises a `compression` capability listing
the algorithms the plugin can support: zstd_stream and lz4_message.
Both libraries (libzstd, liblz4) are already statically linked into
libproxysql.a / pulled into the unit-test link line, so this does not
introduce any new runtime dependency.
- handler_capabilities_set() detects when a client sets the `compression`
capability and parses the OBJECT value's sub-keys:
- `algorithm` (required string) — must match an advertised value;
anything else is rejected with X-Protocol error 5052 (the
capability-prepare-failed code per the spec).
- `server_combine_mixed_messages` / `combine_mixed_messages` (bool)
- `server_max_combine_messages` / `max_combine_messages` (uint)
Both spelling variants are accepted because mysql-connector-python
emits the short form while libmysqlclient emits the spec form, and
the upstream MySQL server tolerates both.
- Negotiation outcome is stored on MysqlxSession via three new members
(compression_algo_, compression_combine_mixed_messages_,
compression_max_combine_messages_). Phase 2 / Phase 3 will read
these to drive (de)compression. They are reset by both init() and
reset() so a session reuse does not inherit stale negotiation.
- Unsupported algorithms (e.g. deflate_stream) and structurally
malformed values (wrong protobuf type, missing algorithm field) are
rejected with a non-fatal X-Protocol Error frame — the session
remains healthy so the client can either retry CapabilitiesSet or
proceed without compression.
Why 5052 (non-fatal) and not 5008
---------------------------------
5008 is the runtime "compression message arrived but compression is
disabled" error and stays in dispatch_client_message() for now. 5052
is the spec-defined "capability prepare failed" status used during the
CapabilitiesSet handshake; treating an unknown algorithm as a
capability error matches the upstream MySQL X plugin's behavior and
lets compliant clients downgrade to no-compression on the same
connection.
Tests
=====
New unit test: test/tap/tests/unit/mysqlx_compression_unit-t.cpp
(22 sub-tests, all passing). Covers:
- CapGet response advertises `compression` with both algorithms
- CapSet zstd_stream + combine hints accepted, stored on session
- CapSet lz4_message accepted, stored on session
- CapSet deflate_stream rejected with 5052 (non-fatal), session
remains healthy with no algorithm set
- CapSet with wrong-shape compression value (scalar instead of
object) rejected with 5052
Existing mysqlx_session_unit-t / plugin_lifecycle_unit-t still pass
(the two pre-existing failures in mysqlx_session_unit-t at sub-tests
33-34, "auth succeeded for correct password" and "session in
WAITING_CLIENT_XMSG after auth", are present on this branch before
this commit and unrelated to compression — verified by stashing only
the mysqlx_session.{cpp,h} edits and re-running).
Build infra fix piggy-backed on this commit
-------------------------------------------
test/tap/tests/unit/Makefile referenced
$(SQLITE3_LDIR)/../libsqlite_rembed.a in the GenAI-tier link line,
but that .a is no longer produced on this branch (it was the artifact
of the now-removed sqlite-rembed Rust extension). Without removing
this stale reference, no plugin/mysqlx unit test can link, which
blocks verifying the new compression test alongside the existing
mysqlx tests required by the task. Mirrors the upstream fix that
already landed on sibling branches as commit
|
4 weeks ago |
|
|
79cac4c976 |
chore(mysqlx): retire MysqlxFrontendSession, MysqlxBackendSession, X_FAST_FORWARD
Three pieces of dead code that survived the MysqlxWorker retirement
(commit
|
4 weeks ago |
|
|
6ef036a00c
|
Merge pull request #5671 from sysown/v3.0-fix-macos-release-upload
ci: fix macOS package naming and release upload |
1 month ago |
|
|
78f06fcade |
ci: fix macOS package naming and release upload
The 6 macOS workflows had three interacting bugs:
1. All three tier variants (stable/v31/genai) produced tarballs with
the same filename (proxysql-${GIT_VERSION}-macos-<arch>.tar.gz),
where GIT_VERSION came straight from `git describe`. The Makefile
bumps the version for v31/genai builds, but the workflow did not
mirror that — so a v3.1 or v4.0 binary was packaged under a 3.0.x
name.
2. `gh release upload --clobber` then overwrote the tarballs of the
sibling tier jobs racing on the same filename, leaving only one
surviving macOS artifact per arch across the three tiers.
3. `gh release create v3.0-head --draft 2>/dev/null || true` spawned
extra duplicate drafts, and `gh release upload v3.0-head` picked a
non-deterministic draft (often a stale SHA) rather than the
canonical current-SHA draft used by the Linux package workflows.
Fixes, matching the Linux CI-package-* workflows:
- Add an `init_release` job that finds or creates the canonical draft
for the current SHA+tag via a race-tolerant lowest-id-wins loop, and
passes RELEASE_ID to the build job.
- Compute the tarball version by mirroring the Makefile's tier bump
(major+1 for GENAI, minor+1 for 31), so artifacts are named
proxysql-3.0.8-…, proxysql-3.1.8-…, proxysql-4.0.8-… — consistent
with the Linux RPM/DEB naming convention.
- Upload by release ID with per-asset delete-if-exists, eliminating
cross-tier clobber and stale-draft targeting.
|
1 month ago |