Skip to content

Commit

Permalink
feat!: drop the wa-37420 feature
Browse files Browse the repository at this point in the history
  • Loading branch information
loyd committed Nov 12, 2023
1 parent d678b15 commit 92dd060
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 95 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- run: cargo test
- run: cargo test --no-default-features
- run: cargo test --features uuid,time
- run: cargo test --all-features

services:
clickhouse:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- derive: support `serde::skip_deserializing` ([#83]).

### Changed
- **BREAKING** drop the `wa-37420` feature.
- derive: move to syn v2.

### Fixed
Expand Down
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ uuid = ["dep:uuid"]
time = ["dep:time"]
tls = ["dep:hyper-tls"]

# Temporary workaround for https://github.com/ClickHouse/ClickHouse/issues/37420
wa-37420 = []

[dependencies]
clickhouse-derive = { version = "0.1.1", path = "derive" }

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ clickhouse = { version = "0.11.6", features = ["test-util"] }

</summary>

CH server older than v22.6 (2022-06-16) handles `RowBinary` [incorrectly](https://github.com/ClickHouse/ClickHouse/issues/37420) in some rare cases. Enable `wa-37420` feature to solve this problem. Don't use it for newer versions.
CH server older than v22.6 (2022-06-16) handles `RowBinary` [incorrectly](https://github.com/ClickHouse/ClickHouse/issues/37420) in some rare cases. Use 0.11 and enable `wa-37420` feature to solve this problem. Don't use it for newer versions.

</details>
<details>
Expand Down
20 changes: 0 additions & 20 deletions src/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ const MIN_CHUNK_SIZE: usize = BUFFER_SIZE - 1024; // slightly less to avoid extr
#[must_use]
pub struct Insert<T> {
buffer: BytesMut,
#[cfg(feature = "wa-37420")]
chunk_count: usize,
sender: Option<body::Sender>,
#[cfg(feature = "lz4")]
compression: Compression,
Expand Down Expand Up @@ -102,8 +100,6 @@ impl<T> Insert<T> {

Ok(Self {
buffer: BytesMut::with_capacity(BUFFER_SIZE),
#[cfg(feature = "wa-37420")]
chunk_count: 0,
sender: Some(sender),
#[cfg(feature = "lz4")]
compression: client.compression,
Expand Down Expand Up @@ -189,10 +185,6 @@ impl<T> Insert<T> {
return Ok(());
}

// A temporary workaround for https://github.com/ClickHouse/ClickHouse/issues/37420.
#[cfg(feature = "wa-37420")]
self.prepend_bom();

// Hyper uses non-trivial and inefficient schema of buffering chunks.
// It's difficult to determine when allocations occur.
// So, instead we control it manually here and rely on the system allocator.
Expand Down Expand Up @@ -250,18 +242,6 @@ impl<T> Insert<T> {
Ok(mem::replace(&mut self.buffer, BytesMut::with_capacity(BUFFER_SIZE)).freeze())
}

#[cfg(feature = "wa-37420")]
fn prepend_bom(&mut self) {
if self.chunk_count == 0 && self.buffer.starts_with(&[0xef, 0xbb, 0xbf]) {
let mut new_chunk = BytesMut::with_capacity(self.buffer.len() + 3);
new_chunk.extend_from_slice(&[0xef, 0xbb, 0xbf]);
new_chunk.extend_from_slice(&self.buffer);
self.buffer = new_chunk;
}

self.chunk_count += 1;
}

fn abort(&mut self) {
if let Some(sender) = self.sender.take() {
sender.abort();
Expand Down
1 change: 0 additions & 1 deletion tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ mod nested;
mod query;
mod time;
mod uuid;
mod wa_37420;
mod watch;

const HOST: &str = "localhost:8123";
Expand Down
70 changes: 0 additions & 70 deletions tests/it/wa_37420.rs

This file was deleted.

0 comments on commit 92dd060

Please sign in to comment.