Closed makorne closed 3 weeks ago
Thank you for issue! I will investigate this issue
Second issue is related to original ydb client I suppose that first too
I'm not sure. I'm developing two projects on both of then, and I've never seen this problem on the original. Now I`ve transferred the second one to the original, and the problem is gone. Maybe it will appear under load, but in your project it appears even with single requests.
May be the issue because wrong implemenation of u8 and u16 types? They dont work and I was temparary changed the colums on u32.
YdbStatusError(YdbStatusError { message: "Operation { id: \"\", ready: true, status: BadRequest, issues: [IssueMessage { position: None, message: \"contrib/ydb/core/kqp/session_actor/kqp_session_actor.cpp:768: Invalid value representation for type: Uint8, expected value case: 3, but current: 2\", end_position: None, issue_code: 0, severity: 1, issues: [] }], result: Some(Any { type_url: \"type.googleapis.com/Ydb.Table.ExecuteQueryResult\", value: [18, 28, 10, 26, 48, 49, 106, 56, 118, 107, 52, 100, 56, 112, 49, 103, 51, 113, 116, 120, 49, 113, 118, 118, 53, 100, 97, 113, 110, 52] }), metadata: None, cost_info: None }", operation_status: 400010, issues: [YdbIssue { issue_code: 0, message: "contrib/ydb/core/kqp/session_actor/kqp_session_actor.cpp:768: Invalid value representation for type: Uint8, expected value case: 3, but current: 2", issues: [], severity: Error }]
I create simple example:
use std::{env, str::FromStr};
use tracing::{info, Level};
use ydb::{ydb_params, ClientBuilder, ServiceAccountCredentials};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
init_logs();
let connection_string =
env::var("YDB_CONNECTION_STRING").map_err(|_| "YDB_CONNECTION_STRING not set")?;
let client = ClientBuilder::new_from_connection_string(connection_string)?
.with_credentials(ServiceAccountCredentials::from_env()?)
.client()?;
info!("Waiting for client");
client.wait().await?;
let table_client = client.table_client();
table_client.retry_execute_scheme_query("CREATE TABLE test (id Uint64 NOT NULL, name Utf8, age UInt8, description Utf8, PRIMARY KEY (id))").await?;
let res = table_client.retry_transaction(|mut t| async move {
let desc: Option<String> = None;
let res = t.query(ydb::Query::from(r#"
DECLARE $id as Uint64;
DECLARE $name as Text;
DECLARE $age as Uint8;
DECLARE $descr as Text?;
INSERT INTO test (id, name, age, description) VALUES ( $id, $name, $age, $descr)
"#).with_params(
ydb_params!(
"id" => 1,
"name" => "test".to_owned(),
"age" => 33u8,
"descr" => desc
)
)).await?;
Ok(res)
}).await?;
info!("res: {:?}", res);
Ok(())
}
fn init_logs() {
let level = env::var("RUST_LOG").unwrap_or("INFO".to_string());
let log_level = Level::from_str(&level).unwrap();
let subscriber = tracing_subscriber::FmtSubscriber::builder()
.with_max_level(log_level)
.finish();
tracing::subscriber::set_global_default(subscriber).expect("Error setting subscriber");
}
and have this error:
ERROR ydb::client_table: error=YdbStatusError(YdbStatusError { message: "Operation { id: \"\", ready: true, status: BadRequest, issues: [IssueMessage { position: None, message: \"contrib/ydb/core/kqp/session_actor/kqp_session_actor.cpp:902: Invalid value representation for type: Uint8, expected value case: 3, but current: 2\", end_position: None, issue_code: 0, severity: 1, issues: [] }], result: Some(Any { type_url: \"type.googleapis.com/Ydb.Table.ExecuteQueryResult\", value: [18, 28, 10, 26, 48, 49, 106, 56, 122, 107, 52, 102, 98, 107, 102, 110, 48, 53, 52, 51, 115, 57, 54, 122, 54, 56, 115, 122, 102, 97] }), metadata: None, cost_info: None }", operation_status: 400010, issues: [YdbIssue { issue_code: 0, message: "contrib/ydb/core/kqp/session_actor/kqp_session_actor.cpp:902: Invalid value representation for type: Uint8, expected value case: 3, but current: 2", issues: [], severity: Error }] })
Error: YdbStatusError(YdbStatusError { message: "Operation { id: \"\", ready: true, status: BadRequest, issues: [IssueMessage { position: None, message: \"contrib/ydb/core/kqp/session_actor/kqp_session_actor.cpp:902: Invalid value representation for type: Uint8, expected value case: 3, but current: 2\", end_position: None, issue_code: 0, severity: 1, issues: [] }], result: Some(Any { type_url: \"type.googleapis.com/Ydb.Table.ExecuteQueryResult\", value: [18, 28, 10, 26, 48, 49, 106, 56, 122, 107, 52, 102, 98, 107, 102, 110, 48, 53, 52, 51, 115, 57, 54, 122, 54, 56, 115, 122, 102, 97] }), metadata: None, cost_info: None }", operation_status: 400010, issues: [YdbIssue { issue_code: 0, message: "contrib/ydb/core/kqp/session_actor/kqp_session_actor.cpp:902: Invalid value representation for type: Uint8, expected value case: 3, but current: 2", issues: [], severity: Error }] })
I created an issue: https://github.com/ydb-platform/ydb-rs-sdk/issues/210
I didn`t do it because it makes no sense. Sdk is dead. There 33 errors that are not resolved for 3 month! Even already self-assigned by developer! This simple errors with u8 and u16 is just because the developer is too lazy and does not write tests and examples
I created pull request https://github.com/ydb-platform/ydb-rs-sdk/pull/211 that fixed this issue and also update my fork for sqlx implementation. Test example is now working as expected.
Hi! Thank you for your useful crate!
But there seems to be some errors here. Often the data is not written to tables or not readable. I`m using a local ydb in docker to avoid network errors. I have never seen such on a regular ydb client.
For example:
Or