From 0ce66da575c0aab10378f2532b78ba91bb2b17e6 Mon Sep 17 00:00:00 2001 From: alexpeshkoff Date: Thu, 17 Dec 2009 11:00:47 +0000 Subject: [PATCH] Add On/Off parameter to switch -D(irect) --- src/common/classes/ClumpletReader.cpp | 1 + src/include/consts_pub.h | 2 +- src/jrd/svc.cpp | 7 +++++++ src/msgs/messages2.sql | 2 +- src/utilities/fbsvcmgr.cpp | 2 +- src/utilities/nbackup.cpp | 20 ++++++++++++++++++-- 6 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/common/classes/ClumpletReader.cpp b/src/common/classes/ClumpletReader.cpp index 9a3943f34a..b01be565ff 100644 --- a/src/common/classes/ClumpletReader.cpp +++ b/src/common/classes/ClumpletReader.cpp @@ -332,6 +332,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: diff --git a/src/include/consts_pub.h b/src/include/consts_pub.h index e068adca22..06f10edec4 100644 --- a/src/include/consts_pub.h +++ b/src/include/consts_pub.h @@ -500,8 +500,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 * diff --git a/src/jrd/svc.cpp b/src/jrd/svc.cpp index 6aaec638cf..1ca690b1dc 100644 --- a/src/jrd/svc.cpp +++ b/src/jrd/svc.cpp @@ -2487,6 +2487,13 @@ bool Service::process_switches(ClumpletReader& spb, string& 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; diff --git a/src/msgs/messages2.sql b/src/msgs/messages2.sql index 756e865c5e..b15b8a976d 100644 --- a/src/msgs/messages2.sql +++ b/src/msgs/messages2.sql @@ -3459,7 +3459,7 @@ Analyzing database pages ...', NULL, NULL); (NULL, 'nbackup.cpp', 'usage', NULL, 24, 21, NULL, ' incremental backups of multi-file databases are not supported yet', NULL, NULL) (NULL, 'nbackup.cpp', 'usage', NULL, 24, 22, NULL, ' "stdout" may be used as a value of for -B option', NULL, NULL) (NULL, 'nbackup.cpp', 'usage', NULL, 24, 23, NULL, 'PROBLEM ON "%s".', NULL, NULL) -(NULL, 'nbackup.cpp', 'usage', NULL, 24, 70, NULL, ' -D Use direct I/O when scanning database', NULL, NULL) +(NULL, 'nbackup.cpp', 'usage', NULL, 24, 70, NULL, ' -D [ON | OFF] Use or not direct I/O when scanning database', NULL, NULL) --(NULL, 'nbackup.cpp', 'usage', NULL, 24, 71, NULL, '', NULL, NULL); stop diff --git a/src/utilities/fbsvcmgr.cpp b/src/utilities/fbsvcmgr.cpp index 2c89d49e35..dcebd02c00 100644 --- a/src/utilities/fbsvcmgr.cpp +++ b/src/utilities/fbsvcmgr.cpp @@ -446,7 +446,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} }; diff --git a/src/utilities/nbackup.cpp b/src/utilities/nbackup.cpp index 6c3c63e947..a1f6ed6280 100644 --- a/src/utilities/nbackup.cpp +++ b/src/utilities/nbackup.cpp @@ -1206,12 +1206,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; // Read global command line parameters for (int itr = 1; itr < argc; ++itr) @@ -1261,7 +1267,17 @@ void nbackup(UtilSvc* uSvc) break; case 'D': - direct_io = true; + if (++itr >= argc) + missing_parameter_for_switch(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, "Wrong parameter %s for switch -D, need ON or OFF", onOff.c_str()); break; case 'F':