Skip to content

Commit

Permalink
Improvement CORE-1107: Services API extension for new (single, full) …
Browse files Browse the repository at this point in the history
…shutdown modes
  • Loading branch information
AlexPeshkoff committed Sep 16, 2008
1 parent 2e8bdd9 commit 9b69175
Show file tree
Hide file tree
Showing 15 changed files with 149 additions and 76 deletions.
2 changes: 2 additions & 0 deletions lang_helpers/gds_codes.ftn
Expand Up @@ -1826,5 +1826,7 @@ C --
PARAMETER (GDS__fbsvcmgr_query_err = 336986117)
INTEGER*4 GDS__fbsvcmgr_switch_unknown
PARAMETER (GDS__fbsvcmgr_switch_unknown = 336986118)
INTEGER*4 GDS__fbsvcmgr_bad_sm
PARAMETER (GDS__fbsvcmgr_bad_sm = 336986159)
INTEGER*4 GDS__utl_trusted_switch
PARAMETER (GDS__utl_trusted_switch = 337051649)
1 change: 1 addition & 0 deletions lang_helpers/gds_codes.pas
Expand Up @@ -920,4 +920,5 @@
gds_fbsvcmgr_info_err = 336986116;
gds_fbsvcmgr_query_err = 336986117;
gds_fbsvcmgr_switch_unknown = 336986118;
gds_fbsvcmgr_bad_sm = 336986159;
gds_utl_trusted_switch = 337051649;
58 changes: 33 additions & 25 deletions src/alice/aliceswi.h
Expand Up @@ -46,9 +46,9 @@ const unsigned long sw_two_phase = 0x00004000UL;
const unsigned long sw_housekeeping = 0x00008000UL;
const unsigned long sw_kill = 0x00010000UL; // Byte 2, Bit 0
//const unsigned long sw_begin_log = 0x00020000UL;
//const unsigned long sw_quit_log = 0x00040000UL;
//const unsigned long sw_quit_log = 0x00040000UL;
const unsigned long sw_write = 0x00080000UL;
const unsigned long sw_no_reserve = 0x00100000UL;
const unsigned long sw_no_reserve = 0x00100000UL;
const unsigned long sw_user = 0x00200000UL;
const unsigned long sw_password = 0x00400000UL;
const unsigned long sw_shut = 0x00800000UL;
Expand Down Expand Up @@ -112,7 +112,8 @@ enum alice_switches
IN_SW_ALICE_TRUSTED_AUTH = 44,
#endif
IN_SW_ALICE_TRUSTED_SVC = 45,
IN_SW_ALICE_TRUSTED_ROLE = 46
IN_SW_ALICE_TRUSTED_ROLE = 46,
IN_SW_ALICE_HIDDEN_ONLINE = 47
};

static const char* ALICE_SW_ASYNC = "async";
Expand All @@ -126,7 +127,7 @@ static const in_sw_tab_t alice_in_sw_table[] =
{IN_SW_ALICE_ACTIVATE, isc_spb_prp_activate, "activate", sw_activate,
0, ~(sw_activate | sw_user | sw_password), FALSE, 25, 0, NULL},
// msg 25: \t-activate shadow file for database usage
{IN_SW_ALICE_ATTACH, 0, "attach", sw_attach,
{IN_SW_ALICE_ATTACH, isc_spb_prp_attachments_shutdown, "attach", sw_attach,
sw_shut, 0, FALSE, 26, 0, NULL},
// msg 26: \t-attach\tshutdown new database attachments
#ifdef DEV_BUILD
Expand All @@ -153,7 +154,7 @@ static const in_sw_tab_t alice_in_sw_table[] =
{IN_SW_ALICE_FULL, isc_spb_rpr_full, "full", sw_full,
sw_validate, 0, FALSE, 32, 0, NULL},
// msg 32: \t-full\t\tvalidate record fragments (-v)
{IN_SW_ALICE_FORCE, 0, "force", sw_force,
{IN_SW_ALICE_FORCE, isc_spb_prp_force_shutdown, "force", sw_force,
sw_shut, 0, FALSE, 33, 0, NULL},
// msg 33: \t-force\t\tforce database shutdown
{IN_SW_ALICE_HOUSEKEEPING, isc_spb_prp_sweep_interval, "housekeeping",
Expand Down Expand Up @@ -211,15 +212,15 @@ static const in_sw_tab_t alice_in_sw_table[] =
{IN_SW_ALICE_SWEEP, isc_spb_rpr_sweep_db, "sweep", sw_sweep,
0, ~(sw_sweep | sw_user | sw_password), FALSE, 45, 0, NULL},
// msg 45: \t-sweep\t\tforce garbage collection
{IN_SW_ALICE_SHUT, 0, "shut", sw_shut,
{IN_SW_ALICE_SHUT, isc_spb_prp_shutdown_mode, "shut", sw_shut,
0, ~(sw_shut | sw_attach | sw_cache | sw_force | sw_tran | sw_user | sw_password),
FALSE, 46, 0, NULL},
// msg 46: \t-shut\t\tshutdown
{IN_SW_ALICE_TWO_PHASE, isc_spb_rpr_recover_two_phase, "two_phase",
sw_two_phase,
0, ~(sw_two_phase | sw_user | sw_password), FALSE, 47, 0, NULL},
// msg 47: \t-two_phase\tperform automated two-phase recovery
{IN_SW_ALICE_TRAN, 0, "tran", sw_tran,
{IN_SW_ALICE_TRAN, isc_spb_prp_transactions_shutdown, "tran", sw_tran,
sw_shut, 0, FALSE, 48, 0, NULL},
// msg 48: \t-tran\t\tshutdown transaction startup
#ifdef TRUSTED_AUTH
Expand Down Expand Up @@ -258,28 +259,35 @@ static const in_sw_tab_t alice_in_sw_table[] =
/* The next nine 'virtual' switches are hidden from user and are needed
for services API
************************************************************************/
{IN_SW_ALICE_HIDDEN_ASYNC, isc_spb_prp_wm_async, "write async", 0, 0, 0,
FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_SYNC, isc_spb_prp_wm_sync, "write sync", 0, 0, 0,
FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_USEALL, isc_spb_prp_res_use_full, "use full", 0, 0, 0,
FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_RESERVE, isc_spb_prp_res, "use reserve", 0, 0, 0,
FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_FORCE, isc_spb_prp_shutdown_db, "shut -force", 0, 0, 0,
FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_TRAN, isc_spb_prp_deny_new_transactions, "shut -tran",
0, 0, 0, FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_ATTACH, isc_spb_prp_deny_new_attachments,
"shut -attach", 0, 0, 0, FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_RDONLY, isc_spb_prp_am_readonly, "mode read_only", 0,
0, 0, FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_RDWRITE, isc_spb_prp_am_readwrite, "mode read_write",
0, 0, 0, FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_ASYNC, isc_spb_prp_wm_async, "write async",
0, 0, 0, FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_SYNC, isc_spb_prp_wm_sync, "write sync",
0, 0, 0, FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_USEALL, isc_spb_prp_res_use_full, "use full",
0, 0, 0, FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_RESERVE, isc_spb_prp_res, "use reserve",
0, 0, 0, FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_FORCE, isc_spb_prp_shutdown_db, "shut -force",
0, 0, 0, FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_TRAN, isc_spb_prp_deny_new_transactions, "shut -tran",
0, 0, 0, FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_ATTACH, isc_spb_prp_deny_new_attachments, "shut -attach",
0, 0, 0, FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_ONLINE, isc_spb_prp_online_mode, "online",
0, 0, 0, FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_RDONLY, isc_spb_prp_am_readonly, "mode read_only",
0, 0, 0, FALSE, 0, 0, NULL},
{IN_SW_ALICE_HIDDEN_RDWRITE, isc_spb_prp_am_readwrite, "mode read_write",
0, 0, 0, FALSE, 0, 0, NULL},
/************************************************************************/
{IN_SW_ALICE_0, 0, NULL, 0,
0, 0, FALSE, 0, 0, NULL}
};

static const char* alice_mode_sw_table[] =
{
"normal", "multi", "single", "full"
};

#endif // ALICE_ALICESWI_H

5 changes: 5 additions & 0 deletions src/common/classes/ClumpletReader.cpp
Expand Up @@ -280,10 +280,15 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const
case isc_spb_prp_deny_new_transactions:
case isc_spb_prp_set_sql_dialect:
case isc_spb_options:
case isc_spb_prp_force_shutdown:
case isc_spb_prp_attachments_shutdown:
case isc_spb_prp_transactions_shutdown:
return IntSpb;
case isc_spb_prp_reserve_space:
case isc_spb_prp_write_mode:
case isc_spb_prp_access_mode:
case isc_spb_prp_shutdown_mode:
case isc_spb_prp_online_mode:
return ByteSpb;
}
invalid_structure("unknown parameter for setting database properties");
Expand Down
16 changes: 15 additions & 1 deletion src/include/consts_pub.h
Expand Up @@ -360,13 +360,27 @@
#define isc_spb_prp_set_sql_dialect 14
#define isc_spb_prp_activate 0x0100
#define isc_spb_prp_db_online 0x0200
#define isc_spb_prp_force_shutdown 41
#define isc_spb_prp_attachments_shutdown 42
#define isc_spb_prp_transactions_shutdown 43
#define isc_spb_prp_shutdown_mode 44
#define isc_spb_prp_online_mode 45

/********************************************
* Parameters for isc_spb_prp_shutdown_mode *
* and isc_spb_prp_onlibe_mode *
********************************************/
#define isc_spb_prp_sm_normal 0
#define isc_spb_prp_sm_multi 1
#define isc_spb_prp_sm_single 2
#define isc_spb_prp_sm_full 3

/********************************************
* Parameters for isc_spb_prp_reserve_space *
********************************************/

#define isc_spb_prp_res_use_full 35
#define isc_spb_prp_res 36
#define isc_spb_prp_res 36

/******************************************
* Parameters for isc_spb_prp_write_mode *
Expand Down
1 change: 1 addition & 0 deletions src/include/gen/codetext.h
Expand Up @@ -909,6 +909,7 @@ static const struct {
{"fbsvcmgr_info_err", 336986116},
{"fbsvcmgr_query_err", 336986117},
{"fbsvcmgr_switch_unknown", 336986118},
{"fbsvcmgr_bad_sm", 336986159},
{"utl_trusted_switch", 337051649},
{NULL, 0}
};
6 changes: 4 additions & 2 deletions src/include/gen/iberror.h
Expand Up @@ -943,8 +943,9 @@ const ISC_STATUS isc_fbsvcmgr_bad_rs = 336986115L;
const ISC_STATUS isc_fbsvcmgr_info_err = 336986116L;
const ISC_STATUS isc_fbsvcmgr_query_err = 336986117L;
const ISC_STATUS isc_fbsvcmgr_switch_unknown = 336986118L;
const ISC_STATUS isc_fbsvcmgr_bad_sm = 336986159L;
const ISC_STATUS isc_utl_trusted_switch = 337051649L;
const ISC_STATUS isc_err_max = 888;
const ISC_STATUS isc_err_max = 889;

#else /* c definitions */

Expand Down Expand Up @@ -1857,8 +1858,9 @@ const ISC_STATUS isc_err_max = 888;
#define isc_fbsvcmgr_info_err 336986116L
#define isc_fbsvcmgr_query_err 336986117L
#define isc_fbsvcmgr_switch_unknown 336986118L
#define isc_fbsvcmgr_bad_sm 336986159L
#define isc_utl_trusted_switch 337051649L
#define isc_err_max 888
#define isc_err_max 889

#endif

Expand Down
3 changes: 2 additions & 1 deletion src/include/gen/msgs.h
Expand Up @@ -909,6 +909,7 @@ static const struct {
{336986116, "Unknown tag (@1) in info_svr_db_info block after isc_svc_query()"}, /* 885, fbsvcmgr_info_err */
{336986117, "Unknown tag (@1) in isc_svc_query() results"}, /* 886, fbsvcmgr_query_err */
{336986118, "Unknown switch \"@1\""}, /* 887, fbsvcmgr_switch_unknown */
{337051649, "Switches trusted_svc and trusted_role are not supported from command line"}, /* 888, utl_trusted_switch */
{336986159, "Wrong value for shutdown mode"}, /* 888, fbsvcmgr_bad_sm */
{337051649, "Switches trusted_svc and trusted_role are not supported from command line"}, /* 889, utl_trusted_switch */
{0, NULL}
};
1 change: 1 addition & 0 deletions src/include/gen/sql_code.h
Expand Up @@ -908,6 +908,7 @@ static const struct {
{336986116, -901}, /* 4 fbsvcmgr_info_err */
{336986117, -901}, /* 5 fbsvcmgr_query_err */
{336986118, -901}, /* 6 fbsvcmgr_switch_unknown */
{336986159, -901}, /* 47 fbsvcmgr_bad_sm */
{337051649, -901}, /* 1 utl_trusted_switch */
{0, 0}
};
1 change: 1 addition & 0 deletions src/include/gen/sql_state.h
Expand Up @@ -908,6 +908,7 @@ static const struct {
{336986116, "00000"}, // 4 fbsvcmgr_info_err
{336986117, "00000"}, // 5 fbsvcmgr_query_err
{336986118, "00000"}, // 6 fbsvcmgr_switch_unknown
{336986159, "00000"}, // 47 fbsvcmgr_bad_sm
{337051649, "00000"}, // 1 utl_trusted_switch
{0, NULL}
};
17 changes: 17 additions & 0 deletions src/jrd/svc.cpp
Expand Up @@ -2314,6 +2314,9 @@ bool Service::process_switches(ClumpletReader& spb, string& switches)
case isc_spb_prp_shutdown_db:
case isc_spb_prp_deny_new_attachments:
case isc_spb_prp_deny_new_transactions:
case isc_spb_prp_force_shutdown:
case isc_spb_prp_attachments_shutdown:
case isc_spb_prp_transactions_shutdown:
case isc_spb_prp_set_sql_dialect:
case isc_spb_rpr_commit_trans:
case isc_spb_rpr_rollback_trans:
Expand All @@ -2332,6 +2335,20 @@ bool Service::process_switches(ClumpletReader& spb, string& switches)
return false;
}
break;
case isc_spb_prp_shutdown_mode:
case isc_spb_prp_online_mode:
if (get_action_svc_parameter(spb.getClumpTag(), alice_in_sw_table, switches))
{
unsigned int val = spb.getInt();
if (val >= FB_NELEM(alice_mode_sw_table))
{
return false;
}
switches += alice_mode_sw_table[val];
switches += " ";
break;
}
return false;
default:
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/msgs/facilities2.sql
Expand Up @@ -29,7 +29,7 @@ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUM
('2002-03-05 02:30:12', 'LICENSE', 19, 60)
('2002-03-05 02:31:54', 'DOS', 20, 74)
('2007-04-07 13:11:00', 'GSTAT', 21, 37)
('2007-05-02 13:15:27', 'FBSVCMGR', 22, 47)
('2008-09-16 16:51:42', 'FBSVCMGR', 22, 48)
('2007-12-21 19:03:07', 'UTL', 23, 2)
stop

Expand Down

0 comments on commit 9b69175

Please sign in to comment.