1v0.2.1

Anomaly Engine & 4 GiB Wraps

Automated detection for huge transactions, replication lag spikes, schema churn, and 4 GiB position wraps.

Production database incidents often originate from subtle binlog anomalies: a batch job updating 500,000 rows in a single uncommitted transaction, schema alterations flooding the log, or position offset roll-overs breaking replication monitors.

Detected Anomaly Categories

Binsight's analyzer scans binlogs during indexing and flags the following patterns:

  • Huge Transactions: Single transactions containing >10,000 row events or spanning >50 MB of binary payload.
  • Long-Running Transactions: Transactions with elapsed duration >30 seconds between BEGIN and XID, which hold locks and cause replication lag.
  • Schema Churn: Rapid succession of DDL statements (ALTER TABLE, CREATE TABLE, DROP TABLE) that invalidate replica table maps.
  • Rolled-Back Mutations: Statements touching non-transactional tables inside an aborting transaction.

The 4 GiB Position Wrap Bug

In MySQL binary log format v4, the event header stores the next_position offset as an unsigned 32-bit integer (uint32):

Specification
Max uint32 = 4,294,967,295 bytes (4 GiB - 1 byte)

When a single binlog file exceeds 4 GiB (which occurs during large analytical queries, bulk imports, or delayed file rotations), the position counter silently wraps back to zero:

Position Rollover
Event at 4,294,967,200 (Length: 150 B) -> Next Position wraps to: 54

Standard CLI tools and legacy monitoring agents print position 54, interpreting the stream as moving backwards in time or resetting to the beginning of the file.

How the 64-bit Accumulator Works

Binsight tracks byte offset progression using a monotonic 64-bit coordinate space:

Calculation Formula
Global 64-Bit Offset = (WrapCount * 4 GiB) + uint32_position

When a rollover is detected, Binsight increments the wrap count, preserves continuous monotonic ordering, and surfaces an anomaly badge in the UI showing both the raw wrapped position and the canonical 64-bit offset.

Catching DDL Schema Churn

When an ALTER TABLE executes on a primary, subsequent row events reference a new internal table_id mapping. Binsight tracks table ID lineage across rotations, allowing you to trace column additions and drops directly within the event timeline.

ESC
Quick Commands
Navigation
↑ ↓ navigate↵ select