Skip to content

Commit 3583792

Browse files
committed
readyset-data: Reduce logging of unknown collations to once per process
The author didn't expect that this error would fire once per row during snapshotting. Change-Id: If85cf7a6e72567d6994911889f1751b2f74e0834 Reviewed-on: https://gerrit.readyset.name/c/readyset/+/9716 Tested-by: Buildkite CI Reviewed-by: Michael Zink <[email protected]>
1 parent f5dbb4a commit 3583792

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ itoa = "1.0"
159159
lazy_static = "1.4.0"
160160
left-right = "0.11"
161161
libc = "0.2"
162+
log-once = "0.4.1"
162163
lru = "0.14.0"
163164
machine-uid = "0.5"
164165
md5 = "0.7.0"

readyset-data/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ cidr = { workspace = true }
4545
postgres-types = { workspace = true, features = ["with-cidr-0_2"] }
4646
vec1 = { workspace = true }
4747
yore = { workspace = true }
48+
log-once = { workspace = true }
4849

4950
# Local dependencies
5051
nom-sql = { path = "../nom-sql" }

readyset-data/src/collation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ use std::hash::Hash;
44

55
use icu::collator::options::{CollatorOptions, Strength};
66
use icu::collator::{Collator, CollatorBorrowed};
7+
use log_once::error_once;
78
use serde::{Deserialize, Serialize};
89
use strum::{EnumCount, FromRepr};
910
use test_strategy::Arbitrary;
10-
use tracing::error;
1111

1212
use crate::{Dialect, SqlEngine};
1313

@@ -148,7 +148,7 @@ impl Collation {
148148
/// return a reasonable default for the dialect.
149149
pub fn get_or_default(dialect: Dialect, collation: &str) -> Self {
150150
Self::try_get(dialect, collation).unwrap_or_else(|| {
151-
error!("Unknown {} collation {}", dialect.engine(), collation);
151+
error_once!("Unknown {} collation {}", dialect.engine(), collation);
152152
Self::default_for(dialect)
153153
})
154154
}

0 commit comments

Comments
 (0)