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

Inline minor ODS upgrade #7397

Merged
merged 8 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all 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: 0 additions & 1 deletion src/alice/alice.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ enum alice_repl_mode {

struct user_action
{
ULONG ua_switches;
const char* ua_user;
const char* ua_role;
const char* ua_password;
Expand Down
7 changes: 6 additions & 1 deletion src/alice/aliceswi.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const SINT64 sw_nolinger = QUADCONST(0x0000001000000000);
const SINT64 sw_icu = QUADCONST(0x0000002000000000);
const SINT64 sw_role = QUADCONST(0x0000004000000000);
const SINT64 sw_replica = QUADCONST(0x0000008000000000);
const SINT64 sw_upgrade = QUADCONST(0x0000010000000000);

// Popular combination of compatible switches
const SINT64 sw_auth_set = sw_user | sw_password | sw_role | sw_fetch_password | sw_trusted_auth;
Expand Down Expand Up @@ -126,7 +127,8 @@ enum alice_switches
IN_SW_ALICE_ICU = 48,
IN_SW_ALICE_ROLE = 49,
IN_SW_ALICE_REPLICA = 50,
IN_SW_ALICE_PARALLEL_WORKERS = 51
IN_SW_ALICE_PARALLEL_WORKERS = 51,
IN_SW_ALICE_UPGRADE = 52
};

static const char* const ALICE_SW_ASYNC = "ASYNC";
Expand Down Expand Up @@ -259,6 +261,9 @@ static const Switches::in_sw_tab_t alice_in_sw_table[] =
0, (sw_user | sw_password | sw_fetch_password), false, false, 115, 3, NULL},
// msg 115: -trusted use trusted authentication
#endif
{IN_SW_ALICE_UPGRADE, isc_spb_rpr_upgrade_db, "UPGRADE", sw_upgrade,
0, ~(sw_upgrade | sw_user | sw_password | sw_nolinger | sw_role), false, true, 137, 2, NULL},
// msg 137: \t-upgrade\t\tupgrade database ODS
{IN_SW_ALICE_NO_RESERVE, 0, "USE", sw_no_reserve,
0, ~(sw_no_reserve | sw_auth_set | sw_nolinger), false, false, 49, 1, NULL},
// msg 49: \t-use\t\tuse full or reserve space for versions
Expand Down
3 changes: 3 additions & 0 deletions src/alice/exe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ static void buildDpb(Firebird::ClumpletWriter& dpb, const SINT64 switches)
if (switches & sw_icu)
dpb.insertTag(isc_dpb_reset_icu);

if (switches & sw_upgrade)
dpb.insertTag(isc_dpb_upgrade_db);

const unsigned char* authBlock;
unsigned int authBlockSize = tdgbl->uSvc->getAuthBlock(&authBlock);

Expand Down
2 changes: 2 additions & 0 deletions src/include/firebird/impl/consts_pub.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
#define isc_dpb_decfloat_round 94
#define isc_dpb_decfloat_traps 95
#define isc_dpb_clear_map 96
#define isc_dpb_upgrade_db 97
#define isc_dpb_parallel_workers 100
#define isc_dpb_worker_attach 101

Expand Down Expand Up @@ -536,6 +537,7 @@
#define isc_spb_rpr_kill_shadows 0x40
#define isc_spb_rpr_full 0x80
#define isc_spb_rpr_icu 0x0800
#define isc_spb_rpr_upgrade_db 0x1000

/*****************************************
* Parameters for isc_action_svc_restore *
Expand Down
1 change: 1 addition & 0 deletions src/include/firebird/impl/msg/gfix.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,4 @@ FB_IMPL_MSG_SYMBOL(GFIX, 133, gfix_role_req, "SQL role name required")
FB_IMPL_MSG_SYMBOL(GFIX, 134, gfix_opt_repl, " -repl(ica) replica mode <none / read_only / read_write>")
FB_IMPL_MSG_SYMBOL(GFIX, 135, gfix_repl_mode_req, "replica mode (none / read_only / read_write) required")
FB_IMPL_MSG_SYMBOL(GFIX, 136, gfix_opt_parallel, " -par(allel) parallel workers <n> (-sweep)")
FB_IMPL_MSG_SYMBOL(GFIX, 137, gfix_opt_upgrade, " -up(grade) upgrade database ODS")
1 change: 1 addition & 0 deletions src/include/firebird/impl/msg/jrd.h
Original file line number Diff line number Diff line change
Expand Up @@ -963,3 +963,4 @@ FB_IMPL_MSG(JRD, 961, wrong_shmem_bitness, -902, "08", "006", "@1-bit engine can
FB_IMPL_MSG(JRD, 962, wrong_proc_plan, -281, "HY", "000", "Procedures cannot specify access type other than NATURAL in the plan")
FB_IMPL_MSG(JRD, 963, invalid_blob_util_handle, -402, "42", "000", "Invalid RDB$BLOB_UTIL handle")
FB_IMPL_MSG(JRD, 964, bad_temp_blob_id, -402, "42", "000", "Invalid temporary BLOB ID")
FB_IMPL_MSG(JRD, 965, ods_upgrade_err, -901, "HY", "000", "ODS upgrade failed while adding new system %s")
3 changes: 3 additions & 0 deletions src/include/gen/Firebird.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3986,6 +3986,7 @@ IProfilerStatsImpl = class(IProfilerStats)
isc_dpb_decfloat_round = byte(94);
isc_dpb_decfloat_traps = byte(95);
isc_dpb_clear_map = byte(96);
isc_dpb_upgrade_db = byte(97);
isc_dpb_parallel_workers = byte(100);
isc_dpb_worker_attach = byte(101);
isc_dpb_address = byte(1);
Expand Down Expand Up @@ -4222,6 +4223,7 @@ IProfilerStatsImpl = class(IProfilerStats)
isc_spb_rpr_kill_shadows = $40;
isc_spb_rpr_full = $80;
isc_spb_rpr_icu = $0800;
isc_spb_rpr_upgrade_db = $1000;
isc_spb_res_buffers = byte(9);
isc_spb_res_page_size = byte(10);
isc_spb_res_length = byte(11);
Expand Down Expand Up @@ -5304,6 +5306,7 @@ IProfilerStatsImpl = class(IProfilerStats)
isc_wrong_proc_plan = 335545282;
isc_invalid_blob_util_handle = 335545283;
isc_bad_temp_blob_id = 335545284;
isc_ods_upgrade_err = 335545285;
isc_gfix_db_name = 335740929;
isc_gfix_invalid_sw = 335740930;
isc_gfix_incmp_sw = 335740932;
Expand Down
6 changes: 3 additions & 3 deletions src/jrd/RecordSourceNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,10 +620,10 @@ RelationSourceNode* RelationSourceNode::parse(thread_db* tdbb, CompilerScratch*

// Scan the relation if it hasn't already been scanned for meta data

if ((!(node->relation->rel_flags & REL_scanned) || (node->relation->rel_flags & REL_being_scanned)) &&
((node->relation->rel_flags & REL_force_scan) || !(csb->csb_g_flags & csb_internal)))
if ((!(node->relation->rel_flags & REL_scanned) ||
(node->relation->rel_flags & REL_being_scanned)) &&
!(csb->csb_g_flags & csb_internal))
{
node->relation->rel_flags &= ~REL_force_scan;
MET_scan_relation(tdbb, node->relation);
}
else if (node->relation->rel_flags & REL_sys_triggers)
Expand Down
31 changes: 15 additions & 16 deletions src/jrd/Relation.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,22 +384,21 @@ const ULONG REL_scanned = 0x0001; // Field expressions scanned (or being sca
const ULONG REL_system = 0x0002;
const ULONG REL_deleted = 0x0004; // Relation known gonzo
const ULONG REL_get_dependencies = 0x0008; // New relation needs dependencies during scan
const ULONG REL_force_scan = 0x0010; // system relation has been updated since ODS change, force a scan
const ULONG REL_check_existence = 0x0020; // Existence lock released pending drop of relation
const ULONG REL_blocking = 0x0040; // Blocking someone from dropping relation
const ULONG REL_sys_triggers = 0x0080; // The relation has system triggers to compile
const ULONG REL_sql_relation = 0x0100; // Relation defined as sql table
const ULONG REL_check_partners = 0x0200; // Rescan primary dependencies and foreign references
const ULONG REL_being_scanned = 0x0400; // relation scan in progress
const ULONG REL_sys_trigs_being_loaded = 0x0800; // System triggers being loaded
const ULONG REL_deleting = 0x1000; // relation delete in progress
const ULONG REL_temp_tran = 0x2000; // relation is a GTT delete rows
const ULONG REL_temp_conn = 0x4000; // relation is a GTT preserve rows
const ULONG REL_virtual = 0x8000; // relation is virtual
const ULONG REL_jrd_view = 0x10000; // relation is VIEW
const ULONG REL_gc_blocking = 0x20000; // request to downgrade\release gc lock
const ULONG REL_gc_disabled = 0x40000; // gc is disabled temporarily
const ULONG REL_gc_lockneed = 0x80000; // gc lock should be acquired
const ULONG REL_check_existence = 0x0010; // Existence lock released pending drop of relation
const ULONG REL_blocking = 0x0020; // Blocking someone from dropping relation
const ULONG REL_sys_triggers = 0x0040; // The relation has system triggers to compile
const ULONG REL_sql_relation = 0x0080; // Relation defined as sql table
const ULONG REL_check_partners = 0x0100; // Rescan primary dependencies and foreign references
const ULONG REL_being_scanned = 0x0200; // relation scan in progress
const ULONG REL_sys_trigs_being_loaded = 0x0400; // System triggers being loaded
const ULONG REL_deleting = 0x0800; // relation delete in progress
const ULONG REL_temp_tran = 0x1000; // relation is a GTT delete rows
const ULONG REL_temp_conn = 0x2000; // relation is a GTT preserve rows
const ULONG REL_virtual = 0x4000; // relation is virtual
const ULONG REL_jrd_view = 0x8000; // relation is VIEW
const ULONG REL_gc_blocking = 0x10000; // request to downgrade\release gc lock
const ULONG REL_gc_disabled = 0x20000; // gc is disabled temporarily
const ULONG REL_gc_lockneed = 0x40000; // gc lock should be acquired


/// class jrd_rel
Expand Down
1 change: 0 additions & 1 deletion src/jrd/WorkerAttachment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ WorkerStableAttachment::WorkerStableAttachment(FbStatusVector* status, Jrd::Atta

LCK_init(tdbb, LCK_OWNER_attachment);
INI_init(tdbb);
INI_init2(tdbb);
PAG_header(tdbb, true);
PAG_attachment_id(tdbb);
TRA_init(attachment);
Expand Down
39 changes: 0 additions & 39 deletions src/jrd/dfw.epp
Original file line number Diff line number Diff line change
Expand Up @@ -1481,26 +1481,6 @@ void DFW_merge_work(jrd_tra* transaction, SavNumber old_sav_number, SavNumber ne
}


void DFW_perform_system_work(thread_db* tdbb)
{
/**************************************
*
* D F W _ p e r f o r m _ s y s t e m _ w o r k
*
**************************************
*
* Functional description
* Flush out the work left to be done in the
* system transaction.
*
**************************************/
SET_TDBB(tdbb);
Jrd::Attachment* attachment = tdbb->getAttachment();

DFW_perform_work(tdbb, attachment->getSysTransaction());
}


void DFW_perform_work(thread_db* tdbb, jrd_tra* transaction)
{
/**************************************
Expand Down Expand Up @@ -1680,25 +1660,6 @@ void DFW_perform_post_commit_work(jrd_tra* transaction)
}


DeferredWork* DFW_post_system_work(thread_db* tdbb, enum dfw_t type, const dsc* desc, USHORT id)
{
/**************************************
*
* D F W _ p o s t _ s y s t e m _ w o r k
*
**************************************
*
* Functional description
* Post work to be done in the context of system transaction.
*
**************************************/
SET_TDBB(tdbb);
Jrd::Attachment* attachment = tdbb->getAttachment();

return DFW_post_work(attachment->getSysTransaction(), type, desc, id, "");
}


DeferredWork* DFW_post_work(jrd_tra* transaction, enum dfw_t type, const dsc* desc, USHORT id,
const MetaName& package)
{
Expand Down
2 changes: 0 additions & 2 deletions src/jrd/dfw_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ USHORT DFW_assign_index_type(Jrd::thread_db*, const Jrd::MetaName&, SSHORT, SSHO
void DFW_delete_deferred(Jrd::jrd_tra*, SavNumber);
Firebird::SortedArray<int>& DFW_get_ids(Jrd::DeferredWork* work);
void DFW_merge_work(Jrd::jrd_tra*, SavNumber, SavNumber);
void DFW_perform_system_work(Jrd::thread_db*);
void DFW_perform_work(Jrd::thread_db*, Jrd::jrd_tra*);
void DFW_perform_post_commit_work(Jrd::jrd_tra*);
Jrd::DeferredWork* DFW_post_system_work(Jrd::thread_db*, Jrd::dfw_t, const dsc*, USHORT);
Jrd::DeferredWork* DFW_post_work(Jrd::jrd_tra*, Jrd::dfw_t, const dsc*, USHORT,
const Jrd::MetaName& package = NULL);
Jrd::DeferredWork* DFW_post_work(Jrd::jrd_tra*, Jrd::dfw_t, const Firebird::string&, USHORT,
Expand Down
Loading