From 89aae0bdc0b82fffb43fc3840eaf9a14c6d95349 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Tue, 15 Jul 2025 01:13:35 -0700 Subject: [PATCH] Add flag to disable sql auto pipelining (#21067) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- src/feature_flags.zig | 3 ++- src/sql/postgres/PostgresSQLConnection.zig | 5 +++++ test/internal/ban-words.test.ts | 2 +- test/js/web/fetch/blob.test.ts | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/feature_flags.zig b/src/feature_flags.zig index a18d3c4add..c69577d00e 100644 --- a/src/feature_flags.zig +++ b/src/feature_flags.zig @@ -15,8 +15,8 @@ pub const RuntimeFeatureFlag = enum { BUN_ENABLE_EXPERIMENTAL_SHELL_BUILTINS, BUN_FEATURE_FLAG_DISABLE_ADDRCONFIG, BUN_FEATURE_FLAG_DISABLE_ASYNC_TRANSPILER, - BUN_FEATURE_FLAG_DISABLE_DNS_CACHE_LIBINFO, BUN_FEATURE_FLAG_DISABLE_DNS_CACHE, + BUN_FEATURE_FLAG_DISABLE_DNS_CACHE_LIBINFO, BUN_FEATURE_FLAG_DISABLE_INSTALL_INDEX, BUN_FEATURE_FLAG_DISABLE_IO_POOL, BUN_FEATURE_FLAG_DISABLE_IPV4, @@ -25,6 +25,7 @@ pub const RuntimeFeatureFlag = enum { BUN_FEATURE_FLAG_DISABLE_RWF_NONBLOCK, BUN_FEATURE_FLAG_DISABLE_SOURCE_MAPS, BUN_FEATURE_FLAG_DISABLE_SPAWNSYNC_FAST_PATH, + BUN_FEATURE_FLAG_DISABLE_SQL_AUTO_PIPELINING, BUN_FEATURE_FLAG_DISABLE_UV_FS_COPYFILE, BUN_FEATURE_FLAG_EXPERIMENTAL_BAKE, BUN_FEATURE_FLAG_FORCE_IO_POOL, diff --git a/src/sql/postgres/PostgresSQLConnection.zig b/src/sql/postgres/PostgresSQLConnection.zig index b1e3b3ac65..02281e6e70 100644 --- a/src/sql/postgres/PostgresSQLConnection.zig +++ b/src/sql/postgres/PostgresSQLConnection.zig @@ -934,6 +934,11 @@ pub fn hasQueryRunning(this: *PostgresSQLConnection) bool { } pub fn canPipeline(this: *PostgresSQLConnection) bool { + if (bun.getRuntimeFeatureFlag(.BUN_FEATURE_FLAG_DISABLE_SQL_AUTO_PIPELINING)) { + @branchHint(.unlikely); + return false; + } + return this.nonpipelinable_requests == 0 and // need to wait for non pipelinable requests to finish !this.flags.use_unnamed_prepared_statements and // unnamed statements are not pipelinable !this.flags.waiting_to_prepare and // cannot pipeline when waiting prepare diff --git a/test/internal/ban-words.test.ts b/test/internal/ban-words.test.ts index 07be2c6a1c..82f3447532 100644 --- a/test/internal/ban-words.test.ts +++ b/test/internal/ban-words.test.ts @@ -1,4 +1,4 @@ -import { file, Glob } from "bun"; +import { Glob, file } from "bun"; import path from "path"; import { normalize } from "path/posix"; diff --git a/test/js/web/fetch/blob.test.ts b/test/js/web/fetch/blob.test.ts index 1e7697cbdd..7742f40dab 100644 --- a/test/js/web/fetch/blob.test.ts +++ b/test/js/web/fetch/blob.test.ts @@ -2,6 +2,7 @@ import { expect, test } from "bun:test"; import type { BlobOptions } from "node:buffer"; import type { BinaryLike } from "node:crypto"; import path from "node:path"; + test("blob: imports have sourcemapped stacktraces", async () => { const blob = new Blob( [