diff --git a/src/meta/node/src/server.rs b/src/meta/node/src/server.rs index 58fba106cd7f..f8bfd4f8b407 100644 --- a/src/meta/node/src/server.rs +++ b/src/meta/node/src/server.rs @@ -173,9 +173,17 @@ pub async fn rpc_serve( ) } MetaStoreBackend::Sql { endpoint } => { + let max_connection = if DbBackend::Sqlite.is_prefix_of(&endpoint) { + // Due to the fact that Sqlite is prone to the error "(code: 5) database is locked" under concurrent access, + // here we forcibly specify the number of connections as 1. + 1 + } else { + 10 + }; + let mut options = sea_orm::ConnectOptions::new(endpoint); options - .max_connections(20) + .max_connections(max_connection) .connect_timeout(Duration::from_secs(10)) .idle_timeout(Duration::from_secs(30)); let conn = sea_orm::Database::connect(options).await?;