Skip to content

Commit 56d53c3

Browse files
committed
read "char" as u8, not char
1 parent d532a86 commit 56d53c3

51 files changed

Lines changed: 564 additions & 556 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎benches/bootstrap_pump.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ fn descriptor(filenode: u32, shape: Shape) -> Arc<RelDescriptor> {
120120
type_name: "int4".into(),
121121
type_byval: true,
122122
type_len: 4,
123-
type_align: 'i',
124-
type_storage: 'p',
123+
type_align: b'i',
124+
type_storage: b'p',
125125
missing_default: None,
126126
})
127127
.collect();
@@ -133,7 +133,7 @@ fn descriptor(filenode: u32, shape: Shape) -> Arc<RelDescriptor> {
133133
type_name: "text".into(),
134134
type_byval: false,
135135
type_len: -1,
136-
type_storage: 'x',
136+
type_storage: b'x',
137137
..attributes[0].clone()
138138
});
139139
}
@@ -147,8 +147,8 @@ fn descriptor(filenode: u32, shape: Shape) -> Arc<RelDescriptor> {
147147
toast_oid: 0,
148148
namespace_oid: 2200,
149149
rel_name: RelName::new("public", &format!("t{filenode}")),
150-
kind: 'r',
151-
persistence: 'p',
150+
kind: b'r',
151+
persistence: b'p',
152152
ancestors: Vec::new(),
153153
replident: ReplIdent::Default { pk_attnums: None },
154154
attributes,

‎benches/spool_read.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ fn attr(attnum: i16, type_oid: u32, type_len: i16) -> RelAttr {
174174
type_name: String::new(),
175175
type_byval: type_len > 0,
176176
type_len,
177-
type_align: 'i',
178-
type_storage: if type_len > 0 { 'p' } else { 'x' },
177+
type_align: b'i',
178+
type_storage: if type_len > 0 { b'p' } else { b'x' },
179179
missing_default: None,
180180
}
181181
}
@@ -229,8 +229,8 @@ async fn plan(args: &Args, repeat: usize) -> anyhow::Result<()> {
229229
toast_oid: 0,
230230
namespace_oid: 2200,
231231
rel_name: RelName::new("public", &format!("spool_bench_{i}")),
232-
kind: 'r',
233-
persistence: 'p',
232+
kind: b'r',
233+
persistence: b'p',
234234
ancestors: Vec::new(),
235235
replident: ReplIdent::Default { pk_attnums: None },
236236
attributes: vec![attr(1, INT4OID, 4), attr(2, TEXTOID, -1)],

‎benches/xact_spill.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ async fn run(args: Args) -> anyhow::Result<()> {
8383
toast_oid: 0,
8484
namespace_oid: 2200,
8585
rel_name: RelName::new("public", "spill_bench"),
86-
kind: 'r',
87-
persistence: 'p',
86+
kind: b'r',
87+
persistence: b'p',
8888
ancestors: Vec::new(),
8989
replident: ReplIdent::Default { pk_attnums: None },
9090
attributes: vec![RelAttr {
@@ -97,8 +97,8 @@ async fn run(args: Args) -> anyhow::Result<()> {
9797
type_name: "text".into(),
9898
type_byval: false,
9999
type_len: -1,
100-
type_align: 'i',
101-
type_storage: 'x',
100+
type_align: b'i',
101+
type_storage: b'x',
102102
missing_default: None,
103103
}],
104104
});

‎src/backfill/backfill_bootstrap.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ pub async fn seed_catalog_from_source(client: &Client) -> Result<CatalogMap> {
322322
next = *up;
323323
}
324324
let desc = Arc::new(desc);
325-
if desc.kind == 'p' {
325+
if desc.kind == b'p' {
326326
map.insert_partitioned(desc);
327327
} else {
328328
map.insert(desc);
@@ -350,9 +350,9 @@ pub async fn seed_in_snapshot(client: &Client) -> Result<CatalogMap> {
350350
result
351351
}
352352

353-
async fn fetch_replident(client: &Client, c: char, rel_oid: Oid) -> Result<ReplIdent> {
353+
async fn fetch_replident(client: &Client, c: u8, rel_oid: Oid) -> Result<ReplIdent> {
354354
// Capture the PK even under FULL so the CH ORDER BY uses it, not `_lsn`
355-
let pk_attnums = if c == 'd' || c == 'f' {
355+
let pk_attnums = if c == b'd' || c == b'f' {
356356
client
357357
.query_opt(
358358
"SELECT indkey::int2[] FROM pg_index \
@@ -364,7 +364,7 @@ async fn fetch_replident(client: &Client, c: char, rel_oid: Oid) -> Result<ReplI
364364
} else {
365365
None
366366
};
367-
let using_index = if c == 'i' {
367+
let using_index = if c == b'i' {
368368
client
369369
.query_opt(
370370
"SELECT indexrelid::oid, indkey::int2[] FROM pg_index \

‎src/backfill/backup_page_walk.rs‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,14 +1063,14 @@ pub(crate) fn toast_chunk_rel() -> RelDescriptor {
10631063
type_name: String::new(),
10641064
type_byval: type_len > 0,
10651065
type_len,
1066-
type_align: 'i',
1067-
type_storage: 'p',
1066+
type_align: b'i',
1067+
type_storage: b'p',
10681068
missing_default: None,
10691069
};
10701070
let mut rel = make_rel();
10711071
rel.oid = 16401;
10721072
rel.rfn.rel_node = 16401;
1073-
rel.kind = 't';
1073+
rel.kind = b't';
10741074
rel.rel_name = RelName::new("pg_toast", "pg_toast_16400");
10751075
rel.attributes = vec![
10761076
attr(1, "chunk_id", OIDOID, 4),
@@ -1126,8 +1126,8 @@ pub(crate) fn make_rel() -> RelDescriptor {
11261126
toast_oid: 0,
11271127
namespace_oid: 2200,
11281128
rel_name: RelName::new("public", "t"),
1129-
kind: 'r',
1130-
persistence: 'p',
1129+
kind: b'r',
1130+
persistence: b'p',
11311131
ancestors: Vec::new(),
11321132
replident: ReplIdent::Default { pk_attnums: None },
11331133
attributes: vec![RelAttr {
@@ -1140,8 +1140,8 @@ pub(crate) fn make_rel() -> RelDescriptor {
11401140
type_name: "int4".into(),
11411141
type_byval: true,
11421142
type_len: 4,
1143-
type_align: 'i',
1144-
type_storage: 'p',
1143+
type_align: b'i',
1144+
type_storage: b'p',
11451145
missing_default: None,
11461146
}],
11471147
}
@@ -1161,9 +1161,9 @@ pub(crate) fn make_rel_named(
11611161
desc.oid = oid;
11621162
desc.toast_oid = toast_oid;
11631163
desc.kind = if &*name.namespace == PG_TOAST_NS {
1164-
't'
1164+
b't'
11651165
} else {
1166-
'r'
1166+
b'r'
11671167
};
11681168
desc.rel_name = name;
11691169
std::sync::Arc::new(desc)

‎src/backfill/bootstrap_oracle.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,8 @@ mod tests {
624624
type_name: type_name.into(),
625625
type_byval: type_len > 0,
626626
type_len,
627-
type_align: 'i',
628-
type_storage: if type_len < 0 { 'x' } else { 'p' },
627+
type_align: b'i',
628+
type_storage: if type_len < 0 { b'x' } else { b'p' },
629629
missing_default: None,
630630
}
631631
}
@@ -641,8 +641,8 @@ mod tests {
641641
toast_oid: 0,
642642
namespace_oid: 2200,
643643
rel_name: RelName::new("public", "foo"),
644-
kind: 'r',
645-
persistence: 'p',
644+
kind: b'r',
645+
persistence: b'p',
646646
ancestors: Vec::new(),
647647
replident: ReplIdent::Default { pk_attnums: None },
648648
attributes: attrs,

‎src/backfill/copy_backfill.rs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,14 +1246,14 @@ impl CopyBackfiller {
12461246
if mode == InitialLoadMode::None {
12471247
return;
12481248
}
1249-
if desc.kind == 'p' {
1249+
if desc.kind == b'p' {
12501250
// No rows of its own: load each partition routed to it
12511251
let rules = self.table_rules();
12521252
let partitions: Vec<_> = self
12531253
.log
12541254
.active_present_at(opt_in_lsn)
12551255
.into_iter()
1256-
.filter(|d| d.kind != 'p')
1256+
.filter(|d| d.kind != b'p')
12571257
.filter(|d| {
12581258
matches!(routing(d, rules.as_deref()), Routing::Ancestor(r) if r.oid == desc.oid)
12591259
})
@@ -2431,8 +2431,8 @@ mod tests {
24312431
type_name: String::new(),
24322432
type_byval: true,
24332433
type_len: 8,
2434-
type_align: 'd',
2435-
type_storage: 'p',
2434+
type_align: b'd',
2435+
type_storage: b'p',
24362436
missing_default: None,
24372437
}
24382438
}
@@ -2448,8 +2448,8 @@ mod tests {
24482448
toast_oid: 0,
24492449
namespace_oid: 2200,
24502450
rel_name: RelName::new("app", "orders"),
2451-
kind: 'r',
2452-
persistence: 'p',
2451+
kind: b'r',
2452+
persistence: b'p',
24532453
ancestors: Vec::new(),
24542454
replident: ReplIdent::Default { pk_attnums: None },
24552455
attributes: attrs,
@@ -2460,8 +2460,8 @@ mod tests {
24602460
RelAttr {
24612461
type_len: -1,
24622462
type_byval: false,
2463-
type_align: 'i',
2464-
type_storage: 'x',
2463+
type_align: b'i',
2464+
type_storage: b'x',
24652465
..attr(attnum, name, type_oid, false)
24662466
}
24672467
}

‎src/backfill/spool.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ mod tests {
703703
spool.push(copy).await.unwrap();
704704
let out = drain_all(spool).await;
705705
assert_eq!(out[0].data, TupleData::Copy(row.clone()));
706-
let rel = crate::schema::int4_rel(16400, "t", 'r', &[(1, "id"), (2, "e"), (3, "f")]);
706+
let rel = crate::schema::int4_rel(16400, "t", b'r', &[(1, "id"), (2, "e"), (3, "f")]);
707707
assert_eq!(copy_slot(&row, &rel, 1), DatumRef::Send(b"\x01send"));
708708
assert_eq!(copy_slot(&row, &rel, 2), DatumRef::Null);
709709
}

‎src/backfill/visibility_gate.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ mod tests {
989989
body.type_oid = crate::schema::TEXTOID;
990990
body.type_len = -1;
991991
// SET STORAGE PLAIN leaves existing external values untouched
992-
body.type_storage = 'p';
992+
body.type_storage = b'p';
993993
d.attributes.push(body);
994994
let mut catalog = CatalogMap::new();
995995
catalog.insert(desc.clone());

‎src/backfill/wal_replay.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ impl WalReplaySink {
439439
let Ok((rel, _)) = self.log.descriptor_at_spanned(rfn, record.next_lsn) else {
440440
continue;
441441
};
442-
if rel.kind != 't' {
442+
if rel.kind != b't' {
443443
continue;
444444
}
445445
let page = crate::decode::fpi::restore_block_image(block, record.page_magic)
@@ -1651,8 +1651,8 @@ mod tests {
16511651
toast_oid: 0,
16521652
namespace_oid: 2200,
16531653
rel_name: RelName::new("public", "t"),
1654-
kind: 'r',
1655-
persistence: 'p',
1654+
kind: b'r',
1655+
persistence: b'p',
16561656
ancestors: Vec::new(),
16571657
replident: ReplIdent::Default { pk_attnums: None },
16581658
attributes: Vec::new(),

0 commit comments

Comments
 (0)