{"record":{"id":"047bacc522d7bc51","repo":"vitessio/vitess","slug":"no-rpl-semi-sync-replica-status-variable-in-mysql","errorCode":null,"errorMessage":"no rpl_semi_sync_replica_status variable in mysql","messagePattern":"no rpl_semi_sync_replica_status variable in mysql","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/mysqlctl/replication.go","lineNumber":1322,"sourceCode":"\tcase mysql.SemiSyncTypeMaster:\n\t\tprimary = vars[\"Rpl_semi_sync_master_status\"] == \"ON\"\n\t\treplica = vars[\"Rpl_semi_sync_slave_status\"] == \"ON\"\n\t}\n\treturn primary, replica\n}\n\n// SemiSyncReplicationStatus returns whether semi-sync is currently used by replication.\nfunc (mysqld *Mysqld) SemiSyncReplicationStatus(ctx context.Context) (bool, error) {\n\tquery, err := mysqld.semiSyncReplicationStatusQuery(ctx)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tqr, err := mysqld.FetchSuperQuery(ctx, query)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif len(qr.Rows) != 1 {\n\t\treturn false, errors.New(\"no rpl_semi_sync_replica_status variable in mysql\")\n\t}\n\tif qr.Rows[0][1].ToString() == \"ON\" {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}\n\n// SemiSyncExtensionLoaded returns whether semi-sync plugins are loaded.\nfunc (mysqld *Mysqld) SemiSyncExtensionLoaded(ctx context.Context) (mysql.SemiSyncType, error) {\n\tconn, connErr := getPoolReconnect(ctx, mysqld.dbaPool)\n\tif connErr != nil {\n\t\treturn mysql.SemiSyncTypeUnknown, connErr\n\t}\n\tdefer conn.Recycle()\n\n\treturn conn.Conn.SemiSyncExtensionLoaded()\n}\n","sourceCodeStart":1304,"sourceCodeEnd":1340,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/mysqlctl/replication.go#L1304-L1340","documentation":"SemiSyncReplicationStatus runs a SHOW query for rpl_semi_sync_replica_status and requires exactly one row. If the row is missing, the semi-sync plugin is not loaded (so the variable doesn't exist), and this error is returned with false. It is the replica-side counterpart of ErrNoSemiSync handling.","triggerScenarios":"Calling Mysqld.SemiSyncReplicationStatus when the query for rpl_semi_sync_replica_status returns len(qr.Rows) != 1 — the semi-sync plugin isn't installed, so MySQL has no such status variable.","commonSituations":"Checking semi-sync status on a replica where semisync_slave.so was never installed; MySQL version mismatch where the replica uses newer source/replica naming (rpl_semi_sync_replica_status missing on older servers expecting rpl_semi_sync_slave_status); plugin load failures at mysqld startup.","solutions":["Install and enable the semi-sync replica plugin: INSTALL PLUGIN rpl_semi_sync_replica SONAME 'semisync_replica.so'; SET GLOBAL rpl_semi_sync_replica_enabled=ON.","Use SemiSyncExtensionLoaded/SemiSyncType to detect plugin absence first and skip the status check.","On older MySQL (<8.0.26), the variable is rpl_semi_sync_slave_status — match the query to the server version.","Handle the error as 'semi-sync inactive' rather than fatal if semi-sync is optional in your deployment."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"loaded, _ := mysqld.SemiSyncExtensionLoaded(ctx)\nif !loaded {\n    // plugin not installed; SemiSyncReplicationStatus would fail\n    return\n}\n","typeGuard":"func isSemiSyncMissing(err error) bool {\n    return errors.Is(err, mysqlctl.ErrNoSemiSync) || strings.Contains(err.Error(), \"rpl_semi_sync_replica_status\")\n}","tryCatchPattern":"on, err := mysqld.SemiSyncReplicationStatus(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"rpl_semi_sync_replica_status\") {\n        log.Warn(\"semi-sync replica plugin not loaded; semi-sync inactive\")\n        return nil\n    }\n    return vterrors.Wrapf(err, \"semi-sync replica status\")\n}","preventionTips":["Install semisync_replica.so (or semisync_slave.so pre-8.0.26) on every replica.","Match variable names to the server's MySQL version (replica vs slave naming).","Verify plugin load at mysqld startup logs before relying on semi-sync status checks."],"tags":["mysql","semi-sync","replication","replica"],"backgroundTag":"semi-sync-plugin-not-loaded","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}