conduktor.io ↗

Kafka DeleteRecords Request Wire Format v2 — Binary Protocol Layout

What is DeleteRecords?

Advances the log start offset for partitions, effectively discarding records below that offset. Used by kafka-delete-records.sh for retention compaction and GDPR data deletion; the deleted data may remain on disk until the next log segment cleanup.

Related Errors

OFFSET_OUT_OF_RANGE · TOPIC_AUTHORIZATION_FAILED · UNKNOWN_TOPIC_OR_PARTITION

Wire Diagram

Request Header · flexible
message_size int32 · 4B
api_key int16 · 2B
api_version int16 · 2B
correlation_id int32 · 4B
client_id string (compact)
tagged var
DeleteRecordsRequest v2
Topics array
TimeoutMs int32 · 4B
tagged var
Name string (compact)
Partitions array
tagged var
PartitionIndex int32 · 4B
Offset int64 · 8B
tagged var

Schema & Example

Schema
{
  "Topics": [{
      "Name": string,
      "Partitions": [{
          "PartitionIndex": int32,
          "Offset": int64
      }]
  }],
  "TimeoutMs": int32
}
Example
{
  "Topics": [{
      "Name": "orders",
      "Partitions": [{
          "PartitionIndex": 3,
          "Offset": 284729
      }]
  }],
  "TimeoutMs": 30000
}