{"record":{"id":"29aeb333a0f251cd","repo":"vitessio/vitess","slug":"can-t-set-semi-sync-mode-v-make-sure-plugins-ar","errorCode":null,"errorMessage":"can't set semi-sync mode: %v; make sure plugins are loaded in my.cnf","messagePattern":"can't set semi-sync mode: (.+?); make sure plugins are loaded in my\\.cnf","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/mysqlctl/replication.go","lineNumber":1271,"sourceCode":"func (mysqld *Mysqld) SetSemiSyncEnabled(ctx context.Context, primary, replica bool) error {\n\tlog.Info(fmt.Sprintf(\"Setting semi-sync mode: primary=%v, replica=%v\", primary, replica))\n\n\t// Convert bool to int.\n\tvar p, s int\n\tif primary {\n\t\tp = 1\n\t}\n\tif replica {\n\t\ts = 1\n\t}\n\n\tquery, err := mysqld.enableSemiSyncQuery(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = mysqld.ExecuteSuperQuery(ctx, fmt.Sprintf(query, p, s))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't set semi-sync mode: %v; make sure plugins are loaded in my.cnf\", err)\n\t}\n\treturn nil\n}\n\n// SemiSyncEnabled returns whether semi-sync is enabled for primary or replica.\n// If the semi-sync plugin is not loaded, we assume semi-sync is disabled.\nfunc (mysqld *Mysqld) SemiSyncEnabled(ctx context.Context) (primary, replica bool) {\n\tvars, err := mysqld.fetchVariables(ctx, \"rpl_semi_sync_%_enabled\")\n\tif err != nil {\n\t\treturn false, false\n\t}\n\tswitch mysqld.SemiSyncType(ctx) {\n\tcase mysql.SemiSyncTypeSource:\n\t\tprimary = vars[\"rpl_semi_sync_source_enabled\"] == \"ON\"\n\t\treplica = vars[\"rpl_semi_sync_replica_enabled\"] == \"ON\"\n\tcase mysql.SemiSyncTypeMaster:\n\t\tprimary = vars[\"rpl_semi_sync_master_enabled\"] == \"ON\"\n\t\treplica = vars[\"rpl_semi_sync_slave_enabled\"] == \"ON\"","sourceCodeStart":1253,"sourceCodeEnd":1289,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/mysqlctl/replication.go#L1253-L1289","documentation":"SetSemiSyncEnabled issues `SET GLOBAL rpl_semi_sync_master_enabled` / `rpl_semi_sync_replica_enabled` variables. If MySQL rejects the statement — most commonly because the semi-sync plugin is not installed — this error wraps the server error with a hint about loading plugins in my.cnf.","triggerScenarios":"Calling mysqld.SetSemiSyncEnabled(...) when the rpl_semi_sync_master/replica plugin is not loaded, so the system variables don't exist and the SET statement fails with ER_UNKNOWN_SYSTEM_VARIABLE.","commonSituations":"Fresh MySQL installs without semi-sync plugins configured; MariaDB where plugin variable names differ (rpl_semi_sync_master vs rpl_semi_sync_source); my.cnf missing plugin-load lines.","solutions":["Load the semi-sync plugin: install_plugin or add `plugin-load-add=semisync_master.so;semisync_slave.so` to my.cnf and restart mysqld","Verify with `SHOW VARIABLES LIKE 'rpl_semi_sync%'` that the variables exist","For MariaDB use the MariaDB-appropriate plugin/variable names (rpl_semi_sync_source/rpl_semi_sync_replica)","Check the mysqld error log for plugin load failures (wrong .so path or version)"],"exampleFix":"// before: my.cnf without semi-sync plugin\n// after: in my.cnf\n// [mysqld]\n// plugin-load-add=semisync_master.so\n// plugin-load-add=semisync_slave.so\n// rpl_semi_sync_master_enabled=1","handlingStrategy":"validation","validationCode":"qr, err := mysqld.FetchSuperQuery(ctx, \"SHOW VARIABLES LIKE 'rpl_semi_sync%'\")\nif err != nil || len(qr.Rows) == 0 {\n    log.Warn(\"semi-sync plugin not loaded; cannot enable semi-sync\")\n}","typeGuard":null,"tryCatchPattern":"err := mysqld.SetSemiSyncEnabled(ctx, true, true)\nif err != nil && strings.Contains(err.Error(), \"can't set semi-sync mode\") {\n    log.Error(\"semi-sync plugin missing; load semisync plugins in my.cnf\", slog.Any(\"error\", err))\n}","preventionTips":["Include plugin-load-add for semisync in all my.cnf templates","Verify rpl_semi_sync variables exist after each MySQL upgrade","Use MariaDB-specific variable names when running MariaDB"],"tags":["mysql","semi-sync","plugin","configuration"],"backgroundTag":"unknown-system-variable","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}