vitessio/vitess · error

SHOW BINARY LOGS returned no rows

Error message

SHOW BINARY LOGS returned no rows

What it means

limitOpenBinlogSize in snapshot_conn runs SHOW BINARY LOGS on the source MySQL to compute binlog sizes for a snapshot stream. If the query succeeds but returns no rows, it cannot identify the current binlog and fails with "SHOW BINARY LOGS returned no rows". A MySQL server always reports at least its current binlog when binary logging is enabled, so no rows indicates binlogs are unavailable.

Source

Thrown at go/vt/vttablet/tabletserver/vstreamer/snapshot_conn.go:164

	_, _ = conn.ExecuteFetch("rollback", 1, false)
	conn.Conn.Close()
}

func mysqlConnect(ctx context.Context, cp dbconfigs.Connector) (*mysql.Conn, error) {
	return cp.Connect(ctx)
}

// limitOpenBinlogSize will rotate the binary log if the current binary
// log is greater than binlogRotationThreshold.
func (conn *snapshotConn) limitOpenBinlogSize() (bool, error) {
	rotatedLog := false
	// Output: https://dev.mysql.com/doc/refman/en/show-binary-logs.html
	res, err := conn.ExecuteFetch("SHOW BINARY LOGS", -1, false)
	if err != nil {
		return rotatedLog, err
	}
	if res == nil || len(res.Rows) == 0 {
		return rotatedLog, errors.New("SHOW BINARY LOGS returned no rows")
	}
	// the current log will be the last one in the results
	curLogIdx := len(res.Rows) - 1
	curLogSize, err := res.Rows[curLogIdx][1].ToInt64()
	if err != nil {
		return rotatedLog, err
	}
	if curLogSize > atomic.LoadInt64(&vttablet.VStreamerBinlogRotationThreshold) {
		if _, err = conn.ExecuteFetch("FLUSH BINARY LOGS", 0, false); err != nil {
			return rotatedLog, err
		}
		rotatedLog = true
	}
	return rotatedLog, nil
}

// GetBinlogRotationThreshold returns the current byte size at which a VStreamer
// will attempt to rotate the binary log before starting a GTID snapshot based

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Enable binary logging on the source MySQL (log_bin=ON) and restart mysqld.
  2. Verify with `SHOW BINARY LOGS;` directly on the MySQL instance that rows are returned.
  3. Ensure the connecting user has sufficient privileges (REPLICATION CLIENT) to see binlogs.
  4. If the source is a managed instance without binlogs, snapshot streaming from it is unsupported — choose a different source.

Example fix

// before (my.cnf)
# log_bin not set -> SHOW BINARY LOGS empty
// after (my.cnf)
log_bin = mysql-bin
server_id = 1
Defensive patterns

Strategy: validation

Validate before calling

res, err := conn.ExecuteFetch("SHOW BINARY LOGS", -1, false)
if err != nil || res == nil || len(res.Rows) == 0 {
  return errors.New("source MySQL has no binary logs; enable log_bin before snapshot streaming")
}

Try / catch

if err != nil && strings.Contains(err.Error(), "SHOW BINARY LOGS returned no rows") {
  return fmt.Errorf("source %s must have binary logging enabled: %w", alias, err)
}

Prevention

When it happens

Trigger: VStreamWithSnapshot against a MySQL server with binary logging disabled (log_bin=OFF), or a server where SHOW BINARY LOGS is inaccessible/empty (e.g. managed setups hiding binlogs, or wrong user privileges combined with no logs).

Common situations: Pointing a VReplication snapshot stream at an rdonly/replica tablet whose MySQL has log_bin disabled; cloud-managed MySQL instances without binary logs; MySQL restarted into a state without binlog files.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/1dc176695bc5ecb7. Report an issue: GitHub.