8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 02:03:04 +01:00

Frontported changes to make -Direct switch of nbackup accept on/off parameter

This commit is contained in:
alexpeshkoff 2009-12-18 14:06:28 +00:00
parent 5b3296a433
commit f2753b7e86
16 changed files with 56 additions and 21 deletions

View File

@ -2100,6 +2100,8 @@ C --
PARAMETER (GDS__nbackup_err_eofhdr_restdb = 337117250)
INTEGER*4 GDS__nbackup_lostguid_l0bk
PARAMETER (GDS__nbackup_lostguid_l0bk = 337117251)
INTEGER*4 GDS__nbackup_switchd_parameter
PARAMETER (GDS__nbackup_switchd_parameter = 337117255)
INTEGER*4 GDS__trace_conflict_acts
PARAMETER (GDS__trace_conflict_acts = 337182750)
INTEGER*4 GDS__trace_act_notfound

View File

@ -1057,6 +1057,7 @@ const
gds_nbackup_err_copy = 337117249;
gds_nbackup_err_eofhdr_restdb = 337117250;
gds_nbackup_lostguid_l0bk = 337117251;
gds_nbackup_switchd_parameter = 337117255;
gds_trace_conflict_acts = 337182750;
gds_trace_act_notfound = 337182751;
gds_trace_switch_once = 337182752;

View File

@ -333,6 +333,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const
switch (tag)
{
case isc_spb_nbk_file:
case isc_spb_nbk_direct:
case isc_spb_dbname:
return StringSpb;
case isc_spb_nbk_level:

View File

@ -501,8 +501,8 @@
#define isc_spb_nbk_level 5
#define isc_spb_nbk_file 6
#define isc_spb_nbk_direct 7
#define isc_spb_nbk_no_triggers 0x01
#define isc_spb_nbk_direct 0x02
/***************************************
* Parameters for isc_action_svc_trace *

View File

@ -1046,6 +1046,7 @@ static const struct {
{"nbackup_err_copy", 337117249},
{"nbackup_err_eofhdr_restdb", 337117250},
{"nbackup_lostguid_l0bk", 337117251},
{"nbackup_switchd_parameter", 337117255},
{"trace_conflict_acts", 337182750},
{"trace_act_notfound", 337182751},
{"trace_switch_once", 337182752},

View File

@ -1080,6 +1080,7 @@ const ISC_STATUS isc_nbackup_err_eofbk = 337117248L;
const ISC_STATUS isc_nbackup_err_copy = 337117249L;
const ISC_STATUS isc_nbackup_err_eofhdr_restdb = 337117250L;
const ISC_STATUS isc_nbackup_lostguid_l0bk = 337117251L;
const ISC_STATUS isc_nbackup_switchd_parameter = 337117255L;
const ISC_STATUS isc_trace_conflict_acts = 337182750L;
const ISC_STATUS isc_trace_act_notfound = 337182751L;
const ISC_STATUS isc_trace_switch_once = 337182752L;
@ -1091,7 +1092,7 @@ const ISC_STATUS isc_trace_switch_user_only = 337182757L;
const ISC_STATUS isc_trace_switch_param_miss = 337182758L;
const ISC_STATUS isc_trace_param_act_notcompat = 337182759L;
const ISC_STATUS isc_trace_mandatory_switch_miss = 337182760L;
const ISC_STATUS isc_err_max = 1035;
const ISC_STATUS isc_err_max = 1036;
#else /* c definitions */
@ -2141,6 +2142,7 @@ const ISC_STATUS isc_err_max = 1035;
#define isc_nbackup_err_copy 337117249L
#define isc_nbackup_err_eofhdr_restdb 337117250L
#define isc_nbackup_lostguid_l0bk 337117251L
#define isc_nbackup_switchd_parameter 337117255L
#define isc_trace_conflict_acts 337182750L
#define isc_trace_act_notfound 337182751L
#define isc_trace_switch_once 337182752L
@ -2152,7 +2154,7 @@ const ISC_STATUS isc_err_max = 1035;
#define isc_trace_switch_param_miss 337182758L
#define isc_trace_param_act_notcompat 337182759L
#define isc_trace_mandatory_switch_miss 337182760L
#define isc_err_max 1035
#define isc_err_max 1036
#endif

View File

@ -1049,16 +1049,17 @@ Data source : @4"}, /* 606, eds_statement */
{337117249, "Error (@1) creating database file: @2 via copying from: @3"}, /* 1022, nbackup_err_copy */
{337117250, "Unexpected end of file when reading header of restored database file (stage @1)"}, /* 1023, nbackup_err_eofhdr_restdb */
{337117251, "Cannot get backup guid clumplet from L0 backup"}, /* 1024, nbackup_lostguid_l0bk */
{337182750, "conflicting actions \"@1\" and \"@2\" found"}, /* 1025, trace_conflict_acts */
{337182751, "action switch not found"}, /* 1026, trace_act_notfound */
{337182752, "switch \"@1\" must be set only once"}, /* 1027, trace_switch_once */
{337182753, "value for switch \"@1\" is missing"}, /* 1028, trace_param_val_miss */
{337182754, "invalid value (\"@1\") for switch \"@2\""}, /* 1029, trace_param_invalid */
{337182755, "unknown switch \"@1\" encountered"}, /* 1030, trace_switch_unknown */
{337182756, "switch \"@1\" can be used by service only"}, /* 1031, trace_switch_svc_only */
{337182757, "switch \"@1\" can be used by interactive user only"}, /* 1032, trace_switch_user_only */
{337182758, "mandatory parameter \"@1\" for switch \"@2\" is missing"}, /* 1033, trace_switch_param_miss */
{337182759, "parameter \"@1\" is incompatible with action \"@2\""}, /* 1034, trace_param_act_notcompat */
{337182760, "mandatory switch \"@1\" is missing"}, /* 1035, trace_mandatory_switch_miss */
{337117255, "Wrong parameter %s for switch -D, need ON or OFF"}, /* 1025, nbackup_switchd_parameter */
{337182750, "conflicting actions \"@1\" and \"@2\" found"}, /* 1026, trace_conflict_acts */
{337182751, "action switch not found"}, /* 1027, trace_act_notfound */
{337182752, "switch \"@1\" must be set only once"}, /* 1028, trace_switch_once */
{337182753, "value for switch \"@1\" is missing"}, /* 1029, trace_param_val_miss */
{337182754, "invalid value (\"@1\") for switch \"@2\""}, /* 1030, trace_param_invalid */
{337182755, "unknown switch \"@1\" encountered"}, /* 1031, trace_switch_unknown */
{337182756, "switch \"@1\" can be used by service only"}, /* 1032, trace_switch_svc_only */
{337182757, "switch \"@1\" can be used by interactive user only"}, /* 1033, trace_switch_user_only */
{337182758, "mandatory parameter \"@1\" for switch \"@2\" is missing"}, /* 1034, trace_switch_param_miss */
{337182759, "parameter \"@1\" is incompatible with action \"@2\""}, /* 1035, trace_param_act_notcompat */
{337182760, "mandatory switch \"@1\" is missing"}, /* 1036, trace_mandatory_switch_miss */
{0, NULL}
};

View File

@ -1045,6 +1045,7 @@ static const struct {
{337117249, -901}, /* 65 nbackup_err_copy */
{337117250, -901}, /* 66 nbackup_err_eofhdr_restdb */
{337117251, -901}, /* 67 nbackup_lostguid_l0bk */
{337117255, -901}, /* 71 nbackup_switchd_parameter */
{337182750, -901}, /* 30 trace_conflict_acts */
{337182751, -901}, /* 31 trace_act_notfound */
{337182752, -901}, /* 32 trace_switch_once */

View File

@ -1045,6 +1045,7 @@ static const struct {
{337117249, "00000"}, // 65 nbackup_err_copy
{337117250, "00000"}, // 66 nbackup_err_eofhdr_restdb
{337117251, "00000"}, // 67 nbackup_lostguid_l0bk
{337117255, "00000"}, // 71 nbackup_switchd_parameter
{337182750, "00000"}, // 30 trace_conflict_acts
{337182751, "00000"}, // 31 trace_act_notfound
{337182752, "00000"}, // 32 trace_switch_once

View File

@ -2506,11 +2506,18 @@ bool Service::process_switches(ClumpletReader& spb, string& switches)
break;
case isc_spb_options:
if (!get_action_svc_bitmask(spb, nbackup_option_in_sw_table, switches))
if (!get_action_svc_bitmask(spb, nbackup_in_sw_table, switches))
{
return false;
}
break;
case isc_spb_nbk_direct:
if (!get_action_svc_parameter(spb.getClumpTag(), nbackup_in_sw_table, switches))
{
return false;
}
get_action_svc_string(spb, switches);
}
break;

View File

@ -33,7 +33,7 @@ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUM
('2009-06-22 05:57:59', 'GSTAT', 21, 46)
('2008-09-16 01:10:30', 'FBSVCMGR', 22, 52)
('2009-07-18 12:12:12', 'UTL', 23, 2)
('2009-12-16 19:27:50', 'NBACKUP', 24, 71)
('2009-12-18 16:54:52', 'NBACKUP', 24, 72)
('2009-07-20 07:55:48', 'FBTRACEMGR', 25, 41)
stop

View File

@ -3421,7 +3421,8 @@ Analyzing database pages ...', NULL, NULL);
('nbackup_lostguid_l0bk', 'NBackup::restore_database', 'nbackup.cpp', NULL, 24, 67, NULL, 'Cannot get backup guid clumplet from L0 backup', NULL, NULL)
(NULL, 'nbackup', 'nbackup.cpp', NULL, 24, 68, NULL, 'Physical Backup Manager version @1', NULL, NULL)
(NULL, 'restore_database', 'nbackup.cpp', NULL, 24, 69, NULL, 'Enter name of the backup file of level @1 ("." - do not restore further):', NULL, NULL)
(NULL, 'usage', 'nbackup.cpp', NULL, 24, 70, NULL, ' -D(IRECT) Use direct I/O when scanning database', NULL, NULL)
(NULL, 'usage', 'nbackup.cpp', NULL, 24, 70, NULL, ' -D(IRECT) [ON | OFF] Use or not direct I/O when scanning database', NULL, NULL)
('nbackup_switchd_parameter', 'main', 'nbackup.cpp', NULL, 24, 71, NULL, 'Wrong parameter %s for switch -D, need ON or OFF', NULL, NULL)
--('nbackup_', '', 'nbackup.cpp', NULL, 24, , NULL, '', NULL, NULL)
-- FBTRACEMGR
-- All messages use the new format.

View File

@ -1043,6 +1043,7 @@ COMMIT WORK;
(-901, '00', '000', 24, 65, 'nbackup_err_copy', NULL, NULL)
(-901, '00', '000', 24, 66, 'nbackup_err_eofhdr_restdb', NULL, NULL)
(-901, '00', '000', 24, 67, 'nbackup_lostguid_l0bk', NULL, NULL)
(-901, '00', '000', 24, 71, 'nbackup_switchd_parameter', NULL, NULL)
-- FBTRACEMGR
(-901, '00', '000', 25, 30, 'trace_conflict_acts', NULL, NULL)
(-901, '00', '000', 25, 31, 'trace_act_notfound', NULL, NULL)

View File

@ -453,7 +453,7 @@ const SvcSwitches nbackOptions[] =
{"nbk_file", putStringArgument, 0, isc_spb_nbk_file, 0},
{"nbk_level", putNumericArgument, 0, isc_spb_nbk_level, 0},
{"nbk_no_triggers", putOption, 0, isc_spb_nbk_no_triggers, 0},
{"nbk_direct", putOption, 0, isc_spb_nbk_direct, 0},
{"nbk_direct", putStringArgument, 0, isc_spb_nbk_direct, 0},
{0, 0, 0, 0, 0}
};

View File

@ -1276,12 +1276,18 @@ void nbackup(UtilSvc* uSvc)
string username, password;
PathName database, filename;
bool run_db_triggers = true;
bool direct_io = false;
bool direct_io =
#ifdef WIN_NT
true;
#else
false;
#endif
NBackup::BackupFiles backup_files;
int level;
bool print_size = false, version = false;
string trustedUser;
bool trustedRole = false;
string onOff;
const Switches switches(nbackup_action_in_sw_table, FB_NELEM(nbackup_action_in_sw_table),
false, true);
@ -1336,7 +1342,17 @@ void nbackup(UtilSvc* uSvc)
break;
case IN_SW_NBK_DIRECT:
direct_io = true;
if (++itr >= argc)
missingParameterForSwitch(uSvc, argv[itr - 1]);
onOff = argv[itr];
onOff.upper();
if (onOff == "ON")
direct_io = true;
else if (onOff == "OFF")
direct_io = false;
else
usage(uSvc, isc_nbackup_switchd_parameter, onOff.c_str());
break;
case IN_SW_NBK_FIXUP:

View File

@ -50,7 +50,7 @@ const int IN_SW_NBK_HELP = 14;
const int IN_SW_NBK_DIRECT = 15;
static const struct Switches::in_sw_tab_t nbackup_option_in_sw_table [] =
static const struct Switches::in_sw_tab_t nbackup_in_sw_table [] =
{
{IN_SW_NBK_NODBTRIG, isc_spb_nbk_no_triggers, "T", 0, 0, 0, false, 0, 1, NULL},
{IN_SW_NBK_DIRECT, isc_spb_nbk_direct, "DIRECT", 0, 0, 0, false, 0, 1, NULL},