How to Fix MySQL Error 1870 (WARN_ON_BLOCKHOLE_IN_RBR)

Published
Length
3 min read

Luis Felipe Dias

All posts

You trigger mysql error 1870 when a query modifies a BLACKHOLE table under row-based logging. You fix it by switching the session log format to statement or mixed mode. MySQL maps this warning to symbol WARN_ON_BLOCKHOLE_IN_RBR and SQLSTATE code HY000. The engine warns that row events are not logged for statements that modify BLACKHOLE tables. The message also lists the specific table names involved in the query. Why mysql error 1870 happens in row-based replication The BLACKHOLE storage eng

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You trigger mysql error 1870 when a query modifies a BLACKHOLE table under row-based logging. You fix it by switching the session log format to statement or mixed mode.

MySQL maps this warning to symbol WARN_ON_BLOCKHOLE_IN_RBR and SQLSTATE code HY000. The engine warns that row events are not logged for statements that modify BLACKHOLE tables. The message also lists the specific table names involved in the query.

Why mysql error 1870 happens in row-based replication

The BLACKHOLE storage engine accepts data writes but discards the rows right away. It never stores any data on the disk. Teams often use these empty tables as replication relays or audit log filters.

Binary logging in MySQL supports statement, row, and mixed modes. Statement mode writes the raw SQL text straight into the binary log. Row mode records the actual row changes made inside the storage engine.

Updates and deletes on a BLACKHOLE table match zero stored rows. Because no rows exist, the storage engine produces zero row events during those operations. Under row format, the server skips writing these changes to the binary log.

When this happens, replica servers downstream never receive the update or delete events. Your replica databases can drift out of sync with your primary cluster. MySQL raises warning 1870 so your team notices the missing binary log events.

How to diagnose the warning in production

Start your check by reviewing the warning output from the database session. The server message names both the statement type and the exact BLACKHOLE table. You can then inspect the storage engine type for that table in the schema.

Next, check the active binary log format for the database server and the client session. Many modern clusters run row format by default to keep data consistent across nodes. If an app runs updates or deletes against a BLACKHOLE table, warning 1870 fires.

Just-in-Time Access + Single Sign-On (SSO): architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Look at your app query logs to see which service sends these write statements. Sometimes a legacy job writes to an old relay table by mistake. Other times, an intermediate relay server uses the wrong binary log mode.

How to fix mysql error 1870 safely

Do not grant broad superuser permissions to app roles to change global server variables. Also, never turn off binary logging across the whole cluster just to silence warnings. Instead, apply targeted fixes that match how your architecture uses the table.

If the table acts as a replication relay, switch the binary log format. Set the format to statement or mixed mode for that specific relay server or session. In statement mode, MySQL writes the SQL command to the log without needing stored rows.

If the table should store real data, change its storage engine to a standard engine. Run a schema change during a planned window to convert the table. Once the table stores real rows, row-based logging works without any warnings.

If your app only inserts rows into the BLACKHOLE table, remove update and delete queries. Inserts still generate log events, while updates and deletes cause the logging gap. Cleaning up unused write queries stops the warning at the source.

Inspect every MySQL query and response in flight

Static grants and network rules block bad logins. They cannot pause a risky query for review or mask emails in a result set. By design, hoop.dev sits inline in the MySQL protocol as a sidecar for your MySQL. For every plain query, prepared statement, or cursor an agent or human runs in production, hoop.dev decides to pass, mask, block, or hold it for review.

First, hoop.dev guardrails block banned actions before MySQL runs them, and an AI Analyzer you configure can score intent or escalate for approval. Next, hoop.dev data masking rewrites sensitive string columns in results in memory, and every verdict goes to the audit trail. Find the open-source binary on GitHub.

Frequently asked questions

Does mysql error 1870 block my query from running?

No, code 1870 is a warning with SQLSTATE HY000, so the query still runs. Still, the change does not reach the binary log, unless strict warning rules stop execution.

Why do insert statements work while updates trigger warning 1870?

An insert supplies new values that the server can write as a new row event. Updates and deletes look for existing rows, find nothing in the BLACKHOLE table, and log nothing.

Should I change the global binary log format on my primary database?

Avoid changing the global format on a busy primary database without testing all apps first. Instead, scope the format change to the specific session or dedicated relay host that needs it.

The query runs. The emails stay hidden.