Skip to content

Commit

Permalink
Rename GUC variable according to PR suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaruza committed Dec 23, 2024
1 parent f8bca89 commit fd16493
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/pgduckdb/pgduckdb_guc.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ extern bool duckdb_enable_external_access;
extern bool duckdb_allow_unsigned_extensions;
extern bool duckdb_autoinstall_known_extensions;
extern bool duckdb_autoload_known_extensions;
extern int max_workers_per_postgres_scan;
extern int duckdb_max_workers_per_postgres_scan;
extern char *duckdb_motherduck_postgres_database;
extern int duckdb_motherduck_enabled;
extern char *duckdb_motherduck_token;
Expand Down
4 changes: 2 additions & 2 deletions src/pgduckdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
static void DuckdbInitGUC(void);

bool duckdb_force_execution = false;
int max_workers_per_postgres_scan = 2;
int duckdb_max_workers_per_postgres_scan = 2;
int duckdb_motherduck_enabled = MotherDuckEnabled::MOTHERDUCK_AUTO;
char *duckdb_motherduck_token = strdup("");
char *duckdb_motherduck_postgres_database = strdup("postgres");
Expand Down Expand Up @@ -161,7 +161,7 @@ DuckdbInitGUC(void) {

DefineCustomVariable("duckdb.max_workers_per_postgres_scan",
"Maximum number of PostgreSQL workers used for a single Postgres scan",
&max_workers_per_postgres_scan, 2, 8);
&duckdb_max_workers_per_postgres_scan, 2, 8);

DefineCustomVariable("duckdb.postgres_role",
"Which postgres role should be allowed to use DuckDB execution, use the secrets and create "
Expand Down
2 changes: 1 addition & 1 deletion src/scan/postgres_table_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ PostgresTableReader::ParallelWorkerNumber(Cardinality cardinality) {
static const int base_log = 8;
int cardinality_log = std::log2(cardinality);
int base = cardinality_log / base_log;
return std::max(1, std::min(base, std::max(max_workers_per_postgres_scan, max_parallel_workers)));
return std::max(1, std::min(base, std::max(duckdb_max_workers_per_postgres_scan, max_parallel_workers)));
}

const char *
Expand Down

0 comments on commit fd16493

Please sign in to comment.