Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature #7682 : use ParallelWorkers setting from firebird.conf as default for all parallelised operations #7686

Merged
merged 3 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 4 additions & 0 deletions src/burp/backup.epp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ int BACKUP_backup(const TEXT* dbb_file, const TEXT* file_name)
stmt->free(fbStatus);
}

if (tdgbl->gbl_sw_par_workers)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Braces for multi-line if, please.

BURP_verbose(410, SafeArg() << tdgbl->gbl_sw_par_workers);
// msg 410 use up to @1 parallel workers

// decide what type of database we've got

detectRuntimeODS();
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
7 changes: 6 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 Expand Up @@ -10333,6 +10334,10 @@ bool restore(BurpGlobals* tdgbl, Firebird::IProvider* provider, const TEXT* file
*
**************************************/

if (tdgbl->gbl_sw_par_workers)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Braces for multi-line if, please.

BURP_verbose(410, SafeArg() << tdgbl->gbl_sw_par_workers);
// msg 410 use up to @1 parallel workers

// Read burp record first

MVOL_init_read (file_name, &tdgbl->RESTORE_format);
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
1 change: 1 addition & 0 deletions src/include/firebird/impl/msg/gbak.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,4 @@ FB_IMPL_MSG_NO_SYMBOL(GBAK, 406, " @1PAR(ALLEL) parallel workers")
FB_IMPL_MSG_SYMBOL(GBAK, 407, gbak_missing_prl_wrks, "parallel workers parameter missing")
FB_IMPL_MSG_SYMBOL(GBAK, 408, gbak_inv_prl_wrks, "expected parallel workers, encountered \"@1\"")
FB_IMPL_MSG_NO_SYMBOL(GBAK, 409, " @1D(IRECT_IO) direct IO for backup file(s)")
FB_IMPL_MSG_NO_SYMBOL(GBAK, 410, "use up to @1 parallel workers")
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