Open avkviring opened 2 years ago
Hello, can you expand select! and query! macroses?
BadSession is retriable status and retry_transaction must retry query with new session if your callback return YdbError::YdbStatusError with BadSession status.
cause of the messages can be:
#[macro_export]
macro_rules! select {
($ydb:expr, $query:expr, $($name:ident => $type:ty),* ) => {{
$ydb.retry_transaction(|mut t| async move {
let query_result = t.query($query).await?;
let result_set = query_result.into_only_result()?;
let result:Vec<_> = result_set.rows().map(|mut row| {
$(
let $name:Option<$type> = row.remove_field_by_name(stringify!($name)).unwrap().try_into().unwrap();
)*
($($name.unwrap().into()),*)
}).collect();
Ok(result)
})
}};
}
#[macro_export]
macro_rules! query {
($sql:expr) => {{
ydb::Query::new($sql)
}};
($sql:expr, $($name:ident => $value:expr),*) => {{
let mut query = String::new();
let mut params: std::collections::HashMap<String, ydb::Value> = Default::default();
$(
{
let value = &$value;
let name = stringify!($name);
let type_name = $crate::converters::YDBValueConverter::get_type_name(value);
let ydb_value =$crate::converters::YDBValueConverter::to_ydb_value(value);
params.insert(format!("${}",name), ydb_value);
query.push_str(format!("declare ${} as {};\n",name,type_name).as_str());
}
)*
ydb::Query::new(format!("{}\n{}",query, $sql)).with_params(params)
}};
}
End of retries timeout (small retry timeout and/or many died session on server side).
I use standard timeout, and service is not highload yet
May be problem in NeedRetry::IdempotentOnly? I already understood what not :-)
I add tracing to retry_transaction for understand what happens.
Can you add tracing/logging to your program (example), update ydb to version 0.3.0 and show log?
Hi, I have small holidays. I do it in few days.
Also I open my library for all - https://crates.io/crates/ydb-steroids
Hi
Periodically I see this errors
In this function