Skip to content

Commit cece90a

Browse files
authored
Merge pull request #1710 from tursodatabase/no-internal-connection-tracking
do not track internal connections
2 parents 294ab4a + 3a4eca3 commit cece90a

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

libsql-server/src/connection/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,13 @@ impl<F> MakeThrottledConnection<F> {
314314
1
315315
}
316316
}
317+
318+
pub async fn untracked(&self) -> Result<F::Connection, Error>
319+
where
320+
F: MakeConnection,
321+
{
322+
self.connection_maker.create().await
323+
}
317324
}
318325

319326
struct WaitersGuard<'a> {

libsql-server/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ use utils::services::idle_shutdown::IdleShutdownKicker;
7373
use self::bottomless_migrate::bottomless_migrate;
7474
use self::config::MetaStoreConfig;
7575
use self::connection::connection_manager::InnerWalManager;
76+
use self::connection::MakeThrottledConnection;
7677
use self::namespace::configurator::{
7778
BaseNamespaceConfig, LibsqlPrimaryConfigurator, LibsqlReplicaConfigurator,
7879
LibsqlSchemaConfigurator, NamespaceConfigurators, PrimaryConfig, PrimaryConfigurator,
@@ -338,7 +339,7 @@ pub type SqldStorage =
338339

339340
#[tracing::instrument(skip(connection_maker))]
340341
async fn run_periodic_checkpoint<C>(
341-
connection_maker: Arc<C>,
342+
connection_maker: Arc<MakeThrottledConnection<C>>,
342343
period: Duration,
343344
namespace_name: NamespaceName,
344345
) -> anyhow::Result<()>
@@ -362,7 +363,7 @@ where
362363
} else {
363364
interval.tick().await;
364365
}
365-
retry = match connection_maker.create().await {
366+
retry = match connection_maker.untracked().await {
366367
Ok(conn) => {
367368
if let Err(e) = conn.vacuum_if_needed().await {
368369
tracing::warn!("vacuum failed: {}", e);

libsql-server/src/namespace/configurator/helpers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use tokio_util::io::StreamReader;
1717
use crate::connection::config::DatabaseConfig;
1818
use crate::connection::connection_manager::InnerWalManager;
1919
use crate::connection::legacy::MakeLegacyConnection;
20-
use crate::connection::{Connection as _, MakeConnection};
20+
use crate::connection::{Connection as _, MakeConnection, MakeThrottledConnection};
2121
use crate::database::{PrimaryConnection, PrimaryConnectionMaker};
2222
use crate::error::LoadDumpError;
2323
use crate::namespace::broadcasters::BroadcasterHandle;
@@ -380,7 +380,7 @@ pub(super) async fn make_stats(
380380
// right after checkpointing is exactly where it should be done.
381381
pub(crate) async fn run_storage_monitor<M: MakeConnection>(
382382
stats: Weak<Stats>,
383-
connection_maker: Arc<M>,
383+
connection_maker: Arc<MakeThrottledConnection<M>>,
384384
) -> anyhow::Result<()> {
385385
// on initialization, the database file doesn't exist yet, so we wait a bit for it to be
386386
// created
@@ -392,7 +392,7 @@ pub(crate) async fn run_storage_monitor<M: MakeConnection>(
392392
return Ok(());
393393
};
394394

395-
match connection_maker.create().await {
395+
match connection_maker.untracked().await {
396396
Ok(conn) => {
397397
let _ = BLOCKING_RT
398398
.spawn_blocking(move || {

0 commit comments

Comments
 (0)