Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/risingwavelabs/risingwave i…
Browse files Browse the repository at this point in the history
…nto li0k/storage_fix_strategy_for_append_only
  • Loading branch information
Li0k committed Jan 22, 2025
2 parents 7e6db5b + 1fa4f93 commit 60c8c79
Show file tree
Hide file tree
Showing 21 changed files with 52 additions and 50 deletions.
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docker/docker-compose-distributed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ services:
healthcheck:
test:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
interval: 1s
timeout: 5s
retries: 5
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose-with-azblob.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ services:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/6660; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5688; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5690; exit $$?;'
interval: 1s
timeout: 5s
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose-with-gcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ services:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/6660; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5688; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5690; exit $$?;'
interval: 1s
timeout: 5s
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose-with-hdfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ services:
healthcheck:
test:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
interval: 1s
timeout: 5s
retries: 5
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose-with-local-fs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ services:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/6660; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5688; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5690; exit $$?;'
interval: 1s
timeout: 5s
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose-with-obs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ services:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/6660; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5688; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5690; exit $$?;'
interval: 1s
timeout: 5s
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose-with-oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ services:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/6660; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5688; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5690; exit $$?;'
interval: 1s
timeout: 5s
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose-with-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ services:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/6660; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5688; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5690; exit $$?;'
interval: 1s
timeout: 5s
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose-with-sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ services:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/6660; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5688; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5690; exit $$?;'
interval: 1s
timeout: 5s
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ services:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/6660; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5688; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/5690; exit $$?;'
interval: 1s
timeout: 5s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ services:
healthcheck:
test:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
interval: 1s
timeout: 30s
environment:
Expand Down Expand Up @@ -113,4 +113,4 @@ volumes:

networks:
iceberg_net:
name: iceberg
name: iceberg
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ services:
healthcheck:
test:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
interval: 1s
timeout: 30s
environment:
Expand Down Expand Up @@ -93,4 +93,4 @@ volumes:

networks:
iceberg_net:
name: iceberg
name: iceberg
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ services:
healthcheck:
test:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
interval: 1s
timeout: 30s
networks:
Expand Down Expand Up @@ -96,4 +96,4 @@ volumes:
external: false

networks:
iceberg_net:
iceberg_net:
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
healthcheck:
test:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
interval: 1s
timeout: 30s
networks:
Expand Down Expand Up @@ -72,4 +72,4 @@ volumes:
external: false

networks:
iceberg_net:
iceberg_net:
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ services:
healthcheck:
test:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
interval: 1s
timeout: 30s
environment:
Expand Down Expand Up @@ -113,4 +113,4 @@ volumes:

networks:
iceberg_net:
name: iceberg
name: iceberg
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ services:
healthcheck:
test:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
interval: 1s
timeout: 30s
environment:
Expand Down Expand Up @@ -93,4 +93,4 @@ volumes:

networks:
iceberg_net:
name: iceberg
name: iceberg
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ services:
healthcheck:
test:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
interval: 1s
timeout: 30s
networks:
Expand Down Expand Up @@ -96,4 +96,4 @@ volumes:
external: false

networks:
iceberg_net:
iceberg_net:
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
healthcheck:
test:
- CMD-SHELL
- bash -c 'printf \"GET / HTTP/1.1\n\n\" > /dev/tcp/127.0.0.1/4566; exit $$?;'
- bash -c '> /dev/tcp/127.0.0.1/4566; exit $$?;'
interval: 1s
timeout: 30s
networks:
Expand Down Expand Up @@ -72,4 +72,4 @@ volumes:
external: false

networks:
iceberg_net:
iceberg_net:
1 change: 1 addition & 0 deletions src/utils/pgwire/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jsonwebtoken = "9"
openssl = "0.10.66"
panic-message = "0.3"
parking_lot = { workspace = true }
peekable = { version = "0.2", features = ["tokio"] }
postgres-types = { version = "0.2.6" }
reqwest = "0.12.2"
risingwave_common = { workspace = true }
Expand Down
36 changes: 12 additions & 24 deletions src/utils/pgwire/src/pg_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ use std::ffi::CStr;
use std::io::{Error, ErrorKind, IoSlice, Result, Write};

use anyhow::anyhow;
use byteorder::{BigEndian, ByteOrder, NetworkEndian};
use byteorder::{BigEndian, ByteOrder};
/// Part of code learned from <https://github.com/zenithdb/zenith/blob/main/zenith_utils/src/pq_proto.rs>.
use bytes::{Buf, BufMut, Bytes, BytesMut};
use peekable::tokio::AsyncPeekable;
use tokio::io::{AsyncRead, AsyncReadExt};

use crate::error_or_notice::ErrorOrNoticeMessage;
Expand Down Expand Up @@ -297,31 +298,18 @@ impl FeMessage {
impl FeStartupMessage {
/// Read startup message from the stream.
pub async fn read(stream: &mut (impl AsyncRead + Unpin)) -> Result<FeMessage> {
let mut buffer1 = vec![0; 1];
let result = stream.read_exact(&mut buffer1).await;
let filled1 = match result {
Ok(n) => n,
Err(err) => {
// Detect whether it is a health check.
if err.kind() == ErrorKind::UnexpectedEof {
return Ok(FeMessage::HealthCheck);
} else {
return Err(err);
}
let mut stream = AsyncPeekable::new(stream);

if let Err(err) = stream.peek_exact(&mut [0; 1]).await {
// If the stream is empty, it can be a health check. Do not return error.
if err.kind() == ErrorKind::UnexpectedEof {
return Ok(FeMessage::HealthCheck);
} else {
return Err(err);
}
};
assert_eq!(filled1, 1);

let mut buffer2 = vec![0; 3];
let filled2 = stream.read_exact(&mut buffer2).await?;
assert_eq!(filled2, 3);

let mut buffer3 = BytesMut::with_capacity(4);
buffer3.put_slice(&buffer1);
buffer3.put_slice(&buffer2);

let len = NetworkEndian::read_i32(&buffer3);
}

let len = stream.read_i32().await?;
let protocol_num = stream.read_i32().await?;
let payload_len = (len - 8) as usize;
if payload_len >= isize::MAX as usize {
Expand Down

0 comments on commit 60c8c79

Please sign in to comment.