Skip to content

Commit

Permalink
Implement feature #7682 : Firebird 5 - use ParallelWorkers setting fr…
Browse files Browse the repository at this point in the history
…om firebird.conf as default for all parallelised operations
  • Loading branch information
hvlad committed Jul 27, 2023
1 parent 7b130a4 commit 9ca1372
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/alice/alice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ int alice(Firebird::UtilSvc* uSvc)
#ifdef TRUSTED_AUTH
tdgbl->ALICE_data.ua_trusted = false;
#endif
tdgbl->ALICE_data.ua_parallel_workers = uSvc->getParallelWorkers();

// Start by parsing switches

Expand Down
2 changes: 1 addition & 1 deletion src/alice/exe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ static void buildDpb(Firebird::ClumpletWriter& dpb, const SINT64 switches)
dpb.insertByte(isc_dpb_set_db_replica, tdgbl->ALICE_data.ua_replica_mode);
}

if (switches & sw_parallel_workers) {
if (tdgbl->ALICE_data.ua_parallel_workers > 0) {
dpb.insertInt(isc_dpb_parallel_workers, tdgbl->ALICE_data.ua_parallel_workers);
}

Expand Down
2 changes: 1 addition & 1 deletion src/burp/burp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ int gbak(Firebird::UtilSvc* uSvc)
tdgbl->gbl_sw_old_descriptions = false;
tdgbl->gbl_sw_mode = false;
tdgbl->gbl_sw_skip_count = 0;
tdgbl->gbl_sw_par_workers = 1;
tdgbl->gbl_sw_par_workers = uSvc->getParallelWorkers();
tdgbl->action = NULL;

burp_fil* file = NULL;
Expand Down
3 changes: 2 additions & 1 deletion src/burp/restore.epp
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,8 @@ void create_database(BurpGlobals* tdgbl, Firebird::IProvider* provider, const TE
}
else
{
dpb.insertInt(isc_dpb_parallel_workers, tdgbl->gbl_sw_par_workers);
if (tdgbl->gbl_sw_par_workers > 0)
dpb.insertInt(isc_dpb_parallel_workers, tdgbl->gbl_sw_par_workers);
dpb.insertByte(isc_dpb_shutdown, isc_dpb_shut_multi);
}
dpb.insertInt(isc_dpb_shutdown_delay, 0);
Expand Down
1 change: 1 addition & 0 deletions src/common/UtilSvc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class StandaloneUtilityInterface : public UtilSvc
virtual void initStatus() { }
virtual bool utf8FileNames() { return false; }
virtual Firebird::ICryptKeyCallback* getCryptCallback() { return NULL; }
virtual int getParallelWorkers() { return 0; };
};


Expand Down
1 change: 1 addition & 0 deletions src/common/UtilSvc.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class UtilSvc : public Firebird::GlobalStorage
virtual unsigned int getAuthBlock(const unsigned char** bytes) = 0;
virtual bool utf8FileNames() = 0;
virtual Firebird::ICryptKeyCallback* getCryptCallback() = 0;
virtual int getParallelWorkers() = 0;

void setDataMode(bool value)
{
Expand Down
4 changes: 3 additions & 1 deletion src/jrd/svc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ Service::Service(const TEXT* service_name, USHORT spb_length, const UCHAR* spb_d
svc_username(getPool()), svc_sql_role(getPool()), svc_auth_block(getPool()),
svc_expected_db(getPool()), svc_trusted_role(false), svc_utf8(false),
svc_switches(getPool()), svc_perm_sw(getPool()), svc_address_path(getPool()),
svc_command_line(getPool()),
svc_command_line(getPool()), svc_parallel_workers(0),
svc_network_protocol(getPool()), svc_remote_address(getPool()), svc_remote_process(getPool()),
svc_remote_pid(0), svc_trace_manager(NULL), svc_crypt_callback(crypt_callback),
svc_existence(FB_NEW_POOL(*getDefaultMemoryPool()) SvcMutex(this)),
Expand Down Expand Up @@ -731,6 +731,8 @@ Service::Service(const TEXT* service_name, USHORT spb_length, const UCHAR* spb_d
if (svcname == "@@@")
svc_debug = true;
#endif
// Could be overrided in SPB
svc_parallel_workers = Config::getParallelWorkers();

// Process the service parameter block.
ClumpletReader spb(ClumpletReader::spbList, spb_data, spb_length, spbVersionError);
Expand Down
2 changes: 2 additions & 0 deletions src/jrd/svc.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class Service : public Firebird::UtilSvc, public TypedHandle<type_svc>
virtual bool utf8FileNames();
// get database encryption key transfer callback routine
virtual Firebird::ICryptKeyCallback* getCryptCallback();
virtual int getParallelWorkers() { return svc_parallel_workers; }

virtual TraceManager* getTraceManager()
{
Expand Down Expand Up @@ -324,6 +325,7 @@ class Service : public Firebird::UtilSvc, public TypedHandle<type_svc>
Firebird::string svc_perm_sw; // Switches, taken from services table and/or passed using spb_command_line
Firebird::UCharBuffer svc_address_path;
Firebird::string svc_command_line;
int svc_parallel_workers;

Firebird::string svc_network_protocol;
Firebird::string svc_remote_address;
Expand Down

0 comments on commit 9ca1372

Please sign in to comment.