From 2ac6ae28049bacce698e3f38502a0f46c59ecacf Mon Sep 17 00:00:00 2001 From: hvlad Date: Sat, 8 Aug 2009 12:41:45 +0000 Subject: [PATCH] Improvement CORE-2587 : User friendly diagnostic when engine can't create shared memory already created by the antoher engine process in another windows session --- src/jrd/isc_sync.cpp | 8 +++++++- src/msgs/facilities2.sql | 2 +- src/msgs/messages2.sql | 1 + src/msgs/system_errors2.sql | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/jrd/isc_sync.cpp b/src/jrd/isc_sync.cpp index 425e1a4c94..e7dad53767 100644 --- a/src/jrd/isc_sync.cpp +++ b/src/jrd/isc_sync.cpp @@ -2402,8 +2402,14 @@ UCHAR* ISC_map_file(ISC_STATUS* status_vector, NULL); if (file_handle == INVALID_HANDLE_VALUE) { + const DWORD err = GetLastError(); + + if ((err == ERROR_USER_MAPPED_FILE) && init_flag && file_exists && trunc_flag) + Arg::Gds(isc_instance_conflict).copyTo(status_vector); + else + error(status_vector, "CreateFile", err); + CloseHandle(event_handle); - error(status_vector, "CreateFile", GetLastError()); return NULL; } diff --git a/src/msgs/facilities2.sql b/src/msgs/facilities2.sql index 9b2b6a6010..59fb205164 100644 --- a/src/msgs/facilities2.sql +++ b/src/msgs/facilities2.sql @@ -1,7 +1,7 @@ /* MAX_NUMBER is the next number to be used, always one more than the highest message number. */ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES (?, ?, ?, ?); -- -('2009-08-06 09:05:54', 'JRD', 0, 664) +('2009-08-08 15:21:00', 'JRD', 0, 665) -- Reserved 513-529 by CVC ('2009-07-16 05:41:59', 'QLI', 1, 530) ('2008-11-28 20:27:04', 'GDEF', 2, 346) diff --git a/src/msgs/messages2.sql b/src/msgs/messages2.sql index 3e20a459ea..e7495842dc 100644 --- a/src/msgs/messages2.sql +++ b/src/msgs/messages2.sql @@ -771,6 +771,7 @@ Data source : @4', NULL, NULL) ('sysf_fp_overflow', 'evlStdMath', 'SysFunction.cpp', NULL, 0, 661, NULL, 'Floating point overflow in built-in function @1', NULL, NULL); ('udf_fp_overflow', 'FUN_evaluate', 'fun.epp', NULL, 0, 662, NULL, 'Floating point overflow in result from UDF @1', NULL, NULL); ('udf_fp_nan', 'FUN_evaluate', 'fun.epp', NULL, 0, 663, NULL, 'Invalid floating point value returned by UDF @1', NULL, NULL); +('instance_conflict', 'ISC_map_file', 'isc_sync.cpp', NULL, 0, 664, NULL, 'Database is probably already opened by another engine instance in another Windows session', NULL, NULL); -- QLI (NULL, NULL, NULL, NULL, 1, 0, NULL, 'expected type', NULL, NULL); (NULL, NULL, NULL, NULL, 1, 1, NULL, 'bad block type', NULL, NULL); diff --git a/src/msgs/system_errors2.sql b/src/msgs/system_errors2.sql index dbd4327e4f..655200b681 100644 --- a/src/msgs/system_errors2.sql +++ b/src/msgs/system_errors2.sql @@ -669,6 +669,7 @@ set bulk_insert INSERT INTO SYSTEM_ERRORS (SQL_CODE, SQL_CLASS, SQL_SUBCLASS, FA (-833, '42', '000', 0, 661, 'sysf_fp_overflow', NULL, NULL) (-901, '39', '000', 0, 662, 'udf_fp_overflow', NULL, NULL) (-901, '39', '000', 0, 663, 'udf_fp_nan', NULL, NULL) +(-902, '42', '000', 0, 664, 'instance_conflict', NULL, NULL) -- GFIX (-901, '00', '000', 3, 1, 'gfix_db_name', NULL, NULL) (-901, '00', '000', 3, 2, 'gfix_invalid_sw', NULL, NULL)