mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-09 14:32:57 +00:00
## Problem https://github.com/neondatabase/neon/pull/9746 lifted decoding and interpretation of WAL to the safekeeper. This reduced the ingested amount on the pageservers by around 10x for a tenant with 8 shards, but doubled the ingested amount for single sharded tenants. Also, https://github.com/neondatabase/neon/pull/9746 uses bincode which doesn't support schema evolution. Technically the schema can be evolved, but it's very cumbersome. ## Summary of changes This patch set addresses both problems by adding protobuf support for the interpreted wal records and adding compression support. Compressed protobuf reduced the ingested amount by 100x on the 32 shards `test_sharded_ingest` case (compared to non-interpreted proto). For the 1 shard case the reduction is 5x. Sister change to `rust-postgres` is [here](https://github.com/neondatabase/rust-postgres/pull/33). ## Links Related: https://github.com/neondatabase/neon/issues/9336 Epic: https://github.com/neondatabase/neon/issues/9329
44 lines
775 B
Protocol Buffer
44 lines
775 B
Protocol Buffer
syntax = "proto3";
|
|
|
|
package interpreted_wal;
|
|
|
|
message InterpretedWalRecords {
|
|
repeated InterpretedWalRecord records = 1;
|
|
optional uint64 next_record_lsn = 2;
|
|
}
|
|
|
|
message InterpretedWalRecord {
|
|
optional bytes metadata_record = 1;
|
|
SerializedValueBatch batch = 2;
|
|
uint64 next_record_lsn = 3;
|
|
bool flush_uncommitted = 4;
|
|
uint32 xid = 5;
|
|
}
|
|
|
|
message SerializedValueBatch {
|
|
bytes raw = 1;
|
|
repeated ValueMeta metadata = 2;
|
|
uint64 max_lsn = 3;
|
|
uint64 len = 4;
|
|
}
|
|
|
|
enum ValueMetaType {
|
|
Serialized = 0;
|
|
Observed = 1;
|
|
}
|
|
|
|
message ValueMeta {
|
|
ValueMetaType type = 1;
|
|
CompactKey key = 2;
|
|
uint64 lsn = 3;
|
|
optional uint64 batch_offset = 4;
|
|
optional uint64 len = 5;
|
|
optional bool will_init = 6;
|
|
}
|
|
|
|
message CompactKey {
|
|
int64 high = 1;
|
|
int64 low = 2;
|
|
}
|
|
|