8000 Ignore me: by tabVersion · Pull Request #21868 · risingwavelabs/risingwave · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Ignore me: #21868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions src/connector/src/connector_common/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,30 @@ impl Connection for KafkaConnection {
}
}

use rdkafka::config::RDKafkaLogLevel;

pub fn read_kafka_log_level() -> RDKafkaLogLevel {
let log_level =
std::env::var("RISINGWAVE_KAFKA_LOG_LEVEL").unwrap_or_else(|_| "INFO".to_owned());
match log_level.to_uppercase().as_str() {
"DEBUG" => RDKafkaLogLevel::Debug,
"INFO" => RDKafkaLogLevel::Info,
"WARN" => RDKafkaLogLevel::Warning,
"ERROR" => RDKafkaLogLevel::Error,
"CRITICAL" => RDKafkaLogLevel::Critical,
"EMERG" => RDKafkaLogLevel::Emerg,
"ALERT" => RDKafkaLogLevel::Alert,
"NOTICE" => RDKafkaLogLevel::Notice,
_ => {
tracing::info!(
"Invalid RISINGWAVE_KAFKA_LOG_LEVEL: {}, using INFO instead",
log_level
);
RDKafkaLogLevel::Info
}
}
}

impl KafkaConnection {
async fn build_client(&self) -> ConnectorResult<BaseConsumer<RwConsumerContext>> {
let mut config = ClientConfig::new();
Expand All @@ -94,8 +118,10 @@ impl KafkaConnection {
)
.await?;
let client_ctx = RwConsumerContext::new(ctx_common);
let client: BaseConsumer<RwConsumerContext> =
config.create_with_context(client_ctx).await?;
let client: BaseConsumer<RwConsumerContext> = config
.set_log_level(read_kafka_log_level())
.create_with_context(client_ctx)
.await?;
if self.inner.is_aws_msk_iam() {
#[cfg(not(madsim))]
client.poll(Duration::from_secs(10)); // note: this is a blocking call
Expand Down
4 changes: 2 additions & 2 deletions src/connector/src/connector_common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ pub use common::{
};
mod connection;
pub use connection::{
validate_connection, ConfluentSchemaRegistryConnection, Connection, IcebergConnection,
KafkaConnection, SCHEMA_REGISTRY_CONNECTION_TYPE,
read_kafka_log_level, validate_connection, ConfluentSchemaRegistryConnection, Connection,
IcebergConnection, KafkaConnection, SCHEMA_REGISTRY_CONNECTION_TYPE,
};

mod iceberg;
Expand Down
6 changes: 4 additions & 2 deletions src/connector/src/sink/kafka.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use with_options::WithOptions;
use super::catalog::{SinkFormat, SinkFormatDesc};
use super::{Sink, SinkError, SinkParam};
use crate::connector_common::{
AwsAuthProps, KafkaCommon, KafkaConnectionProps, KafkaPrivateLinkCommon,
read_kafka_log_level, AwsAuthProps, KafkaCommon, KafkaConnectionProps, KafkaPrivateLinkCommon,
RdKafkaPropertiesCommon,
};
use crate::sink::formatter::SinkFormatterImpl;
Expand Down Expand Up @@ -436,7 +436,9 @@ impl KafkaSinkWriter {
.await?;
let producer_ctx = RwProducerContext::new(ctx_common);
// Generate the producer
c.create_with_context(producer_ctx).await?
c.set_log_level(read_kafka_log_level())
.create_with_context(producer_ctx)
.await?
};

Ok(KafkaSinkWriter {
Expand Down
14 changes: 14 additions & 0 deletions src/connector/src/source/kafka/enumerator/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use rdkafka::{ClientConfig, Offset, TopicPartitionList};
use risingwave_common::bail;
use risingwave_common::metrics::LabelGuardedMetric;

use crate::connector_common::read_kafka_log_level;
use crate::error::{ConnectorError, ConnectorResult};
use crate::source::base::SplitEnumerator;
use crate::source::kafka::split::KafkaSplit;
Expand Down Expand Up @@ -82,6 +83,7 @@ impl SplitEnumerator for KafkaSplitEnumerator {
let topic = common_props.topic.clone();
config.set("bootstrap.servers", &broker_address);
config.set("isolation.level", KAFKA_ISOLATION_LEVEL);
config.set_log_level(read_kafka_log_level());
properties.connection.set_security_properties(&mut config);
properties.set_client(&mut config);
let mut scan_start_offset = match properties
Expand Down Expand Up @@ -195,6 +197,18 @@ impl SplitEnumerator for KafkaSplitEnumerator {
})
.collect();

let arc_client = self.client.clone();
{
#[cfg(not(madsim))]
tokio::task::spawn_blocking(move || {
arc_client.poll(Duration::from_secs(10));
});
#[cfg(madsim)]
tokio::spawn(async move {
arc_client.poll(Duration::from_secs(10)).await;
});
}

Ok(ret)
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/connector/src/source/kafka/source/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ use async_trait::async_trait;
use futures::StreamExt;
use futures_async_stream::try_stream;
use prometheus::core::{AtomicI64, GenericGauge};
use rdkafka::config::RDKafkaLogLevel;
use rdkafka::consumer::{Consumer, StreamConsumer};
use rdkafka::error::KafkaError;
use rdkafka::{ClientConfig, Message, Offset, TopicPartitionList};
use risingwave_common::metrics::LabelGuardedMetric;
use risingwave_pb::plan_common::additional_column::ColumnType as AdditionalColumnType;

use crate::connector_common::read_kafka_log_level;
use crate::error::ConnectorResult as Result;
use crate::parser::ParserConfig;
use crate::source::base::SourceMessage;
Expand Down Expand Up @@ -103,10 +103,12 @@ impl SplitReader for KafkaSplitReader {

let client_ctx = RwConsumerContext::new(ctx_common);
let consumer: StreamConsumer<RwConsumerContext> = config
.set_log_level(RDKafkaLogLevel::Info)
.set_log_level(read_kafka_log_level())
.create_with_context(client_ctx)
.await
.context("failed to create kafka consumer")?;
// poll consumer to trigger callback functions
let _ = tokio::time::timeout(Duration::from_millis(100), consumer.recv()).await;

let mut tpl = TopicPartitionList::with_capacity(splits.len());

Expand Down
8 changes: 8 additions & 0 deletions src/tests/simulation/tests/integration_tests/scale/sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ async fn test_sink_append_only() -> Result<()> {
}

consumer.assign(&tpl).unwrap();

// poll consumer to trigger callback functions
let _ = tokio::time::timeout(Duration::from_millis(1000), consumer.recv()).await;

consumer
})
.await;
Expand Down Expand Up @@ -185,6 +189,10 @@ async fn test_sink_debezium() -> Result<()> {
}

consumer.assign(&tpl).unwrap();

// poll consumer to trigger callback functions
let _ = tokio::time::timeout(Duration::from_millis(1000), consumer.recv()).await;

consumer
})
.await;
Expand Down
0