From 1bc4392e16c6968b958d260cb859e3c03d8f1fdd Mon Sep 17 00:00:00 2001 From: Lucio Franco Date: Mon, 26 Feb 2024 14:05:50 -0500 Subject: [PATCH] server: fix stats report out of bounds --- libsql-server/src/connection/libsql.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libsql-server/src/connection/libsql.rs b/libsql-server/src/connection/libsql.rs index 21ee7d99da..653e0963bb 100644 --- a/libsql-server/src/connection/libsql.rs +++ b/libsql-server/src/connection/libsql.rs @@ -928,11 +928,17 @@ impl Connection { let rows_written = stmt.get_status(StatementStatus::RowsWritten) as u64; if rows_read >= 10_000 || rows_written >= 1_000 { + let sql = if sql.len() >= 512 { + &sql[..512] + } else { + &sql[..] + }; + tracing::info!( "high read ({}) or write ({}) query: {}", rows_read, rows_written, - &sql[..512] + sql ); }