copy support

This commit is contained in:
Lev Kokotov
2022-02-04 08:06:45 -08:00
parent 05250d9374
commit 77507e7343
3 changed files with 35 additions and 4 deletions

View File

@@ -13,16 +13,24 @@ Meow. PgBouncer rewritten in Rust, with sharding, load balancing and failover su
1. Session mode.
2. Transaction mode (basic).
3. `COPY` protocol support.
## Missing
1. `COPY` support.
2. Query cancellation support.
3. All the features I promised above. Will make them soon, promise :-).
4. Authentication, ehem, this proxy is letting anyone in at the moment.
1. Query cancellation support.
2. All the features I promised above. Will make them soon, promise :-).
3. Authentication, ehem, this proxy is letting anyone in at the moment.
## Benchmarks
You can setup PgBench locally through PgCat:
```
pgbench -h 127.0.0.1 -p 5433 -i
```
Coincidenly, this uses `COPY` so you can test if that works.
### PgBouncer
```

View File

@@ -182,6 +182,26 @@ impl Client {
}
}
// CopyData
'd' => {
// Forward the data to the server,
// don't buffer it since it can be rather large.
server.send(original).await?;
}
'c' | 'f' => {
// Copy is done.
server.send(original).await?;
let response = server.recv().await?;
match write_all_half(&mut self.write, response).await {
Ok(_) => (),
Err(err) => {
server.mark_bad();
return Err(err);
}
};
}
_ => {
println!(">>> Unexpected code: {}", code);
}

View File

@@ -205,6 +205,9 @@ impl Server {
break;
}
// CopyInResponse: copy is starting from client to server
'G' => break,
_ => {
// Keep buffering,
}