|
From: <ro...@us...> - 2014-03-28 22:00:11
|
Revision: 59330
http://sourceforge.net/p/firebird/code/59330
Author: robocop
Date: 2014-03-28 22:00:05 +0000 (Fri, 28 Mar 2014)
Log Message:
-----------
Do not take explicit locks on virtual/sys/temp tables using TPBs.
Modified Paths:
--------------
firebird/trunk/lang_helpers/gds_codes.ftn
firebird/trunk/lang_helpers/gds_codes.pas
firebird/trunk/src/include/gen/codetext.h
firebird/trunk/src/include/gen/iberror.h
firebird/trunk/src/include/gen/msgs.h
firebird/trunk/src/include/gen/sql_code.h
firebird/trunk/src/include/gen/sql_state.h
firebird/trunk/src/jrd/par.cpp
firebird/trunk/src/jrd/tra.cpp
firebird/trunk/src/msgs/facilities2.sql
firebird/trunk/src/msgs/messages2.sql
firebird/trunk/src/msgs/system_errors2.sql
Modified: firebird/trunk/lang_helpers/gds_codes.ftn
===================================================================
--- firebird/trunk/lang_helpers/gds_codes.ftn 2014-03-28 16:55:52 UTC (rev 59329)
+++ firebird/trunk/lang_helpers/gds_codes.ftn 2014-03-28 22:00:05 UTC (rev 59330)
@@ -1556,6 +1556,12 @@
PARAMETER (GDS__info_unprepared_stmt = 335545071)
INTEGER*4 GDS__idx_key_value
PARAMETER (GDS__idx_key_value = 335545072)
+ INTEGER*4 GDS__forupdate_virtualtbl
+ PARAMETER (GDS__forupdate_virtualtbl = 335545073)
+ INTEGER*4 GDS__forupdate_systbl
+ PARAMETER (GDS__forupdate_systbl = 335545074)
+ INTEGER*4 GDS__forupdate_temptbl
+ PARAMETER (GDS__forupdate_temptbl = 335545075)
INTEGER*4 GDS__gfix_db_name
PARAMETER (GDS__gfix_db_name = 335740929)
INTEGER*4 GDS__gfix_invalid_sw
Modified: firebird/trunk/lang_helpers/gds_codes.pas
===================================================================
--- firebird/trunk/lang_helpers/gds_codes.pas 2014-03-28 16:55:52 UTC (rev 59329)
+++ firebird/trunk/lang_helpers/gds_codes.pas 2014-03-28 22:00:05 UTC (rev 59330)
@@ -785,6 +785,9 @@
gds_auth_datalength = 335545070;
gds_info_unprepared_stmt = 335545071;
gds_idx_key_value = 335545072;
+ gds_forupdate_virtualtbl = 335545073;
+ gds_forupdate_systbl = 335545074;
+ gds_forupdate_temptbl = 335545075;
gds_gfix_db_name = 335740929;
gds_gfix_invalid_sw = 335740930;
gds_gfix_incmp_sw = 335740932;
Modified: firebird/trunk/src/include/gen/codetext.h
===================================================================
--- firebird/trunk/src/include/gen/codetext.h 2014-03-28 16:55:52 UTC (rev 59329)
+++ firebird/trunk/src/include/gen/codetext.h 2014-03-28 22:00:05 UTC (rev 59330)
@@ -774,6 +774,9 @@
{"auth_datalength", 335545070},
{"info_unprepared_stmt", 335545071},
{"idx_key_value", 335545072},
+ {"forupdate_virtualtbl", 335545073},
+ {"forupdate_systbl", 335545074},
+ {"forupdate_temptbl", 335545075},
{"gfix_db_name", 335740929},
{"gfix_invalid_sw", 335740930},
{"gfix_incmp_sw", 335740932},
Modified: firebird/trunk/src/include/gen/iberror.h
===================================================================
--- firebird/trunk/src/include/gen/iberror.h 2014-03-28 16:55:52 UTC (rev 59329)
+++ firebird/trunk/src/include/gen/iberror.h 2014-03-28 22:00:05 UTC (rev 59330)
@@ -808,6 +808,9 @@
const ISC_STATUS isc_auth_datalength = 335545070L;
const ISC_STATUS isc_info_unprepared_stmt = 335545071L;
const ISC_STATUS isc_idx_key_value = 335545072L;
+const ISC_STATUS isc_forupdate_virtualtbl = 335545073L;
+const ISC_STATUS isc_forupdate_systbl = 335545074L;
+const ISC_STATUS isc_forupdate_temptbl = 335545075L;
const ISC_STATUS isc_gfix_db_name = 335740929L;
const ISC_STATUS isc_gfix_invalid_sw = 335740930L;
const ISC_STATUS isc_gfix_incmp_sw = 335740932L;
@@ -1254,7 +1257,7 @@
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 = 1198;
+const ISC_STATUS isc_err_max = 1201;
#else /* c definitions */
@@ -2032,6 +2035,9 @@
#define isc_auth_datalength 335545070L
#define isc_info_unprepared_stmt 335545071L
#define isc_idx_key_value 335545072L
+#define isc_forupdate_virtualtbl 335545073L
+#define isc_forupdate_systbl 335545074L
+#define isc_forupdate_temptbl 335545075L
#define isc_gfix_db_name 335740929L
#define isc_gfix_invalid_sw 335740930L
#define isc_gfix_incmp_sw 335740932L
@@ -2478,7 +2484,7 @@
#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 1198
+#define isc_err_max 1201
#endif
Modified: firebird/trunk/src/include/gen/msgs.h
===================================================================
--- firebird/trunk/src/include/gen/msgs.h 2014-03-28 16:55:52 UTC (rev 59329)
+++ firebird/trunk/src/include/gen/msgs.h 2014-03-28 22:00:05 UTC (rev 59330)
@@ -777,6 +777,9 @@
{335545070, "Client authentication plugin expected @2 bytes of @3 from server, got @1"}, /* auth_datalength */
{335545071, "Attempt to get information about an unprepared dynamic SQL statement."}, /* info_unprepared_stmt */
{335545072, "Problematic key value is @1"}, /* idx_key_value */
+ {335545073, "Cannot select virtual table @1 for update WITH LOCK"}, /* forupdate_virtualtbl */
+ {335545074, "Cannot select system table @1 for update WITH LOCK"}, /* forupdate_systbl */
+ {335545075, "Cannot select temporary table @1 for update WITH LOCK"}, /* forupdate_temptbl */
{335740929, "data base file name (@1) already given"}, /* gfix_db_name */
{335740930, "invalid switch @1"}, /* gfix_invalid_sw */
{335740932, "incompatible switch combination"}, /* gfix_incmp_sw */
Modified: firebird/trunk/src/include/gen/sql_code.h
===================================================================
--- firebird/trunk/src/include/gen/sql_code.h 2014-03-28 16:55:52 UTC (rev 59329)
+++ firebird/trunk/src/include/gen/sql_code.h 2014-03-28 22:00:05 UTC (rev 59330)
@@ -773,6 +773,9 @@
{335545070, -902}, /* 750 auth_datalength */
{335545071, -901}, /* 751 info_unprepared_stmt */
{335545072, -901}, /* 752 idx_key_value */
+ {335545073, -901}, /* 753 forupdate_virtualtbl */
+ {335545074, -901}, /* 754 forupdate_systbl */
+ {335545075, -901}, /* 755 forupdate_temptbl */
{335740929, -901}, /* 1 gfix_db_name */
{335740930, -901}, /* 2 gfix_invalid_sw */
{335740932, -901}, /* 4 gfix_incmp_sw */
Modified: firebird/trunk/src/include/gen/sql_state.h
===================================================================
--- firebird/trunk/src/include/gen/sql_state.h 2014-03-28 16:55:52 UTC (rev 59329)
+++ firebird/trunk/src/include/gen/sql_state.h 2014-03-28 22:00:05 UTC (rev 59330)
@@ -773,6 +773,9 @@
{335545070, "28000"}, // 750 auth_datalength
{335545071, "HY007"}, // 751 info_unprepared_stmt
{335545072, "HY007"}, // 752 idx_key_value
+ {335545073, "HY000"}, // 753 forupdate_virtualtbl
+ {335545074, "HY000"}, // 754 forupdate_systbl
+ {335545075, "HY000"}, // 755 forupdate_temptbl
{335740929, "00000"}, // 1 gfix_db_name
{335740930, "00000"}, // 2 gfix_invalid_sw
{335740932, "00000"}, // 4 gfix_incmp_sw
Modified: firebird/trunk/src/jrd/par.cpp
===================================================================
--- firebird/trunk/src/jrd/par.cpp 2014-03-28 16:55:52 UTC (rev 59329)
+++ firebird/trunk/src/jrd/par.cpp 2014-03-28 22:00:05 UTC (rev 59330)
@@ -1402,6 +1402,22 @@
break;
case blr_writelock:
+ // PAR_parseRecordSource() called RelationSourceNode::parse() => MET_scan_relation().
+ for (size_t iter = 0; iter < rse->rse_relations.getCount(); ++iter)
+ {
+ const RecordSourceNode* subNode = rse->rse_relations[iter];
+ if (subNode->type != RelationSourceNode::TYPE)
+ continue;
+ const RelationSourceNode* relNode = static_cast<const RelationSourceNode*>(subNode);
+ const jrd_rel* relation = relNode->relation;
+ fb_assert(relation);
+ if (relation->isVirtual())
+ PAR_error(csb, Arg::Gds(isc_forupdate_virtualtbl) << relation->rel_name, false);
+ if (relation->isSystem())
+ PAR_error(csb, Arg::Gds(isc_forupdate_systbl) << relation->rel_name, false);
+ if (relation->isTemporary())
+ PAR_error(csb, Arg::Gds(isc_forupdate_temptbl) << relation->rel_name, false);
+ }
rse->flags |= RseNode::FLAG_WRITELOCK;
break;
Modified: firebird/trunk/src/jrd/tra.cpp
===================================================================
--- firebird/trunk/src/jrd/tra.cpp 2014-03-28 16:55:52 UTC (rev 59329)
+++ firebird/trunk/src/jrd/tra.cpp 2014-03-28 22:00:05 UTC (rev 59330)
@@ -2021,9 +2021,8 @@
Arg::Gds(isc_tpb_reserv_virtualtbl) << Arg::Str(relation_name));
}
- // Reject explicit attempts to take locks on system tables, but RDB$ADMIN role
- // can do that for whatever is needed.
- if (relation->isSystem() && !tdbb->getAttachment()->locksmith())
+ // Reject explicit attempts to take locks on system tables.
+ if (relation->isSystem())
{
ERR_post(Arg::Gds(isc_bad_tpb_content) <<
Arg::Gds(isc_tpb_reserv_systbl) << Arg::Str(relation_name));
Modified: firebird/trunk/src/msgs/facilities2.sql
===================================================================
--- firebird/trunk/src/msgs/facilities2.sql 2014-03-28 16:55:52 UTC (rev 59329)
+++ firebird/trunk/src/msgs/facilities2.sql 2014-03-28 22:00:05 UTC (rev 59330)
@@ -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 (?, ?, ?, ?);
--
-('2013-12-26 14:52:00', 'JRD', 0, 753)
+('2014-03-26 22:42:01', 'JRD', 0, 756)
('2012-01-23 20:10:30', 'QLI', 1, 532)
('2013-11-13 15:59:10', 'GFIX', 3, 122)
('1996-11-07 13:39:40', 'GPRE', 4, 1)
Modified: firebird/trunk/src/msgs/messages2.sql
===================================================================
--- firebird/trunk/src/msgs/messages2.sql 2014-03-28 16:55:52 UTC (rev 59329)
+++ firebird/trunk/src/msgs/messages2.sql 2014-03-28 22:00:05 UTC (rev 59330)
@@ -860,6 +860,9 @@
('auth_datalength', NULL, NULL, NULL, 0, 750, NULL, 'Client authentication plugin expected @2 bytes of @3 from server, got @1', NULL, NULL);
('info_unprepared_stmt', NULL, NULL, NULL, 0, 751, NULL, 'Attempt to get information about an unprepared dynamic SQL statement.', NULL, NULL);
('idx_key_value', NULL, NULL, NULL, 0, 752, NULL, 'Problematic key value is @1', NULL, NULL);
+('forupdate_virtualtbl', 'PAR_rse', 'par.cpp', NULL, 0, 753, NULL, 'Cannot select virtual table @1 for update WITH LOCK', NULL, NULL)
+('forupdate_systbl', 'PAR_rse', 'par.cpp', NULL, 0, 754, NULL, 'Cannot select system table @1 for update WITH LOCK', NULL, NULL)
+('forupdate_temptbl', 'PAR_rse', 'par.cpp', NULL, 0, 755, NULL, 'Cannot select temporary table @1 for update WITH LOCK', 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);
Modified: firebird/trunk/src/msgs/system_errors2.sql
===================================================================
--- firebird/trunk/src/msgs/system_errors2.sql 2014-03-28 16:55:52 UTC (rev 59329)
+++ firebird/trunk/src/msgs/system_errors2.sql 2014-03-28 22:00:05 UTC (rev 59330)
@@ -759,6 +759,9 @@
(-902, '28', '000', 0, 750, 'auth_datalength', NULL, NULL);
(-901, 'HY', '007', 0, 751, 'info_unprepared_stmt', NULL, NULL)
(-901, 'HY', '007', 0, 752, 'idx_key_value', NULL, NULL)
+(-901, 'HY', '000', 0, 753, 'forupdate_virtualtbl', NULL, NULL)
+(-901, 'HY', '000', 0, 754, 'forupdate_systbl', NULL, NULL)
+(-901, 'HY', '000', 0, 755, 'forupdate_temptbl', NULL, NULL)
-- GFIX
(-901, '00', '000', 3, 1, 'gfix_db_name', NULL, NULL)
(-901, '00', '000', 3, 2, 'gfix_invalid_sw', NULL, NULL)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|