You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(24) |
Oct
(37) |
Nov
(42) |
Dec
(29) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(24) |
Feb
(24) |
Mar
(15) |
Apr
(55) |
May
(99) |
Jun
(70) |
Jul
(197) |
Aug
(329) |
Sep
(81) |
Oct
(141) |
Nov
(100) |
Dec
(157) |
2002 |
Jan
(96) |
Feb
(216) |
Mar
(78) |
Apr
(103) |
May
(29) |
Jun
(193) |
Jul
(130) |
Aug
(215) |
Sep
(262) |
Oct
(655) |
Nov
(1009) |
Dec
(655) |
2003 |
Jan
(413) |
Feb
(939) |
Mar
(527) |
Apr
(538) |
May
(439) |
Jun
(295) |
Jul
(681) |
Aug
(810) |
Sep
(835) |
Oct
(730) |
Nov
(988) |
Dec
(787) |
2004 |
Jan
(559) |
Feb
(480) |
Mar
(749) |
Apr
(565) |
May
(748) |
Jun
(529) |
Jul
(454) |
Aug
(714) |
Sep
(628) |
Oct
(857) |
Nov
(1153) |
Dec
(617) |
2005 |
Jan
(603) |
Feb
(444) |
Mar
(377) |
Apr
(579) |
May
(664) |
Jun
(407) |
Jul
(363) |
Aug
(326) |
Sep
(527) |
Oct
(522) |
Nov
(387) |
Dec
(540) |
2006 |
Jan
(355) |
Feb
(242) |
Mar
(563) |
Apr
(768) |
May
(482) |
Jun
(427) |
Jul
(440) |
Aug
(314) |
Sep
(299) |
Oct
(403) |
Nov
(333) |
Dec
(389) |
2007 |
Jan
(247) |
Feb
(335) |
Mar
(391) |
Apr
(562) |
May
(345) |
Jun
(202) |
Jul
(239) |
Aug
(288) |
Sep
(510) |
Oct
(320) |
Nov
(487) |
Dec
(387) |
2008 |
Jan
(575) |
Feb
(539) |
Mar
(762) |
Apr
(648) |
May
(625) |
Jun
(522) |
Jul
(382) |
Aug
(191) |
Sep
(426) |
Oct
(231) |
Nov
(305) |
Dec
(670) |
2009 |
Jan
(582) |
Feb
(595) |
Mar
(294) |
Apr
(461) |
May
(445) |
Jun
(597) |
Jul
(408) |
Aug
(542) |
Sep
(476) |
Oct
(437) |
Nov
(587) |
Dec
(722) |
2010 |
Jan
(456) |
Feb
(319) |
Mar
(437) |
Apr
(303) |
May
(276) |
Jun
(233) |
Jul
(155) |
Aug
(208) |
Sep
(136) |
Oct
(274) |
Nov
(241) |
Dec
(106) |
2011 |
Jan
(160) |
Feb
(244) |
Mar
(138) |
Apr
(235) |
May
(208) |
Jun
(196) |
Jul
(107) |
Aug
(77) |
Sep
(109) |
Oct
(165) |
Nov
(86) |
Dec
(211) |
2012 |
Jan
(188) |
Feb
(136) |
Mar
(273) |
Apr
(185) |
May
(149) |
Jun
(146) |
Jul
(73) |
Aug
(127) |
Sep
(103) |
Oct
(87) |
Nov
(159) |
Dec
(149) |
2013 |
Jan
(74) |
Feb
(112) |
Mar
(176) |
Apr
(139) |
May
(116) |
Jun
(160) |
Jul
(161) |
Aug
(124) |
Sep
(124) |
Oct
(82) |
Nov
(137) |
Dec
(128) |
2014 |
Jan
(116) |
Feb
(121) |
Mar
(134) |
Apr
(177) |
May
(146) |
Jun
(158) |
Jul
(154) |
Aug
(79) |
Sep
(60) |
Oct
(90) |
Nov
(184) |
Dec
(201) |
2015 |
Jan
(163) |
Feb
(263) |
Mar
(406) |
Apr
(291) |
May
(213) |
Jun
(229) |
Jul
(229) |
Aug
(111) |
Sep
(120) |
Oct
(234) |
Nov
(155) |
Dec
(153) |
2016 |
Jan
(147) |
Feb
(188) |
Mar
(363) |
Apr
(304) |
May
(199) |
Jun
(218) |
Jul
(136) |
Aug
(128) |
Sep
(120) |
Oct
(123) |
Nov
(102) |
Dec
(156) |
2017 |
Jan
(123) |
Feb
(114) |
Mar
(132) |
Apr
(44) |
May
(143) |
Jun
(83) |
Jul
(98) |
Aug
(59) |
Sep
(58) |
Oct
(12) |
Nov
(14) |
Dec
(16) |
2018 |
Jan
(18) |
Feb
(24) |
Mar
(41) |
Apr
(16) |
May
(19) |
Jun
(31) |
Jul
(3) |
Aug
(33) |
Sep
(11) |
Oct
(11) |
Nov
|
Dec
|
2019 |
Jan
(21) |
Feb
(66) |
Mar
(72) |
Apr
(69) |
May
(63) |
Jun
(49) |
Jul
(55) |
Aug
(38) |
Sep
(66) |
Oct
(51) |
Nov
(66) |
Dec
(97) |
2020 |
Jan
(98) |
Feb
(95) |
Mar
(83) |
Apr
(121) |
May
(91) |
Jun
(137) |
Jul
(94) |
Aug
(91) |
Sep
(60) |
Oct
(81) |
Nov
(82) |
Dec
(64) |
2021 |
Jan
(66) |
Feb
(50) |
Mar
(52) |
Apr
(110) |
May
(160) |
Jun
(94) |
Jul
(97) |
Aug
(99) |
Sep
(160) |
Oct
(118) |
Nov
(117) |
Dec
(119) |
2022 |
Jan
(90) |
Feb
(93) |
Mar
(75) |
Apr
(70) |
May
(61) |
Jun
(153) |
Jul
(82) |
Aug
(118) |
Sep
(127) |
Oct
(121) |
Nov
(78) |
Dec
(84) |
2023 |
Jan
(80) |
Feb
(75) |
Mar
(92) |
Apr
(103) |
May
(89) |
Jun
(89) |
Jul
(106) |
Aug
(87) |
Sep
(183) |
Oct
(128) |
Nov
(173) |
Dec
(116) |
2024 |
Jan
(144) |
Feb
(120) |
Mar
(113) |
Apr
(107) |
May
(84) |
Jun
(95) |
Jul
(100) |
Aug
(135) |
Sep
(119) |
Oct
(93) |
Nov
(91) |
Dec
(93) |
2025 |
Jan
(104) |
Feb
(165) |
Mar
(120) |
Apr
(124) |
May
(90) |
Jun
(95) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
1
(5) |
2
(7) |
3
(6) |
4
(5) |
5
(2) |
6
(8) |
7
(5) |
8
(3) |
9
(1) |
10
(4) |
11
(13) |
12
(8) |
13
(4) |
14
(3) |
15
(3) |
16
(3) |
17
(6) |
18
(6) |
19
(2) |
20
(4) |
21
(6) |
22
(3) |
23
(3) |
24
(3) |
25
(3) |
26
(3) |
27
(3) |
28
(9) |
29
(5) |
30
(7) |
31
(11) |
|
|
From: <sk...@us...> - 2014-07-31 21:15:36
|
Revision: 59946 http://sourceforge.net/p/firebird/code/59946 Author: skidder Date: 2014-07-31 21:15:33 +0000 (Thu, 31 Jul 2014) Log Message: ----------- Fix MSVC build errors and warnings Modified Paths: -------------- firebird/trunk/src/jrd/Monitoring.cpp firebird/trunk/src/jrd/Monitoring.h firebird/trunk/src/jrd/TempSpace.cpp Modified: firebird/trunk/src/jrd/Monitoring.cpp =================================================================== --- firebird/trunk/src/jrd/Monitoring.cpp 2014-07-31 16:30:12 UTC (rev 59945) +++ firebird/trunk/src/jrd/Monitoring.cpp 2014-07-31 21:15:33 UTC (rev 59946) @@ -50,6 +50,11 @@ #include "../jrd/Monitoring.h" #include "../jrd/Function.h" +#ifdef WIN_NT +#include <process.h> +#define getpid _getpid +#endif + const char* const SCRATCH = "fb_monitor_"; using namespace Firebird; @@ -487,7 +492,7 @@ while (dumpRecord.getField(dumpField)) { const USHORT fid = dumpField.id; - const size_t length = dumpField.length; + const FB_SIZE_T length = dumpField.length; const char* source = (const char*) dumpField.data; // All the strings that may require transliteration (i.e. the target charset is not NONE) @@ -541,7 +546,7 @@ void SnapshotData::clearSnapshot() { - for (size_t i = 0; i < m_snapshot.getCount(); i++) + for (FB_SIZE_T i = 0; i < m_snapshot.getCount(); i++) delete m_snapshot[i].data; m_snapshot.clear(); @@ -558,7 +563,7 @@ RecordBuffer* SnapshotData::getData(int id) const { - for (size_t i = 0; i < m_snapshot.getCount(); i++) + for (FB_SIZE_T i = 0; i < m_snapshot.getCount(); i++) { if (m_snapshot[i].rel_id == id) return m_snapshot[i].data; Modified: firebird/trunk/src/jrd/Monitoring.h =================================================================== --- firebird/trunk/src/jrd/Monitoring.h 2014-07-31 16:30:12 UTC (rev 59945) +++ firebird/trunk/src/jrd/Monitoring.h 2014-07-31 21:15:33 UTC (rev 59946) @@ -163,9 +163,9 @@ } private: - void storeField(int field_id, ValueType type, size_t length, const void* value) + void storeField(int field_id, ValueType type, FB_SIZE_T length, const void* value) { - const size_t delta = sizeof(UCHAR) + sizeof(UCHAR) + sizeof(USHORT) + length; + const FB_SIZE_T delta = sizeof(UCHAR) + sizeof(UCHAR) + sizeof(USHORT) + length; buffer.resize(offset + delta); UCHAR* ptr = buffer.begin() + offset; Modified: firebird/trunk/src/jrd/TempSpace.cpp =================================================================== --- firebird/trunk/src/jrd/TempSpace.cpp 2014-07-31 16:30:12 UTC (rev 59945) +++ firebird/trunk/src/jrd/TempSpace.cpp 2014-07-31 21:15:33 UTC (rev 59946) @@ -264,12 +264,12 @@ fb_assert(head == tail); delete head; head = tail = NULL; - size = FB_ALIGN(logicalSize, minBlockSize); + size = static_cast<FB_SIZE_T>(FB_ALIGN(logicalSize, minBlockSize)); physicalSize = size; } else { - size = FB_ALIGN(logicalSize - physicalSize, minBlockSize); + size = static_cast<FB_SIZE_T>(FB_ALIGN(logicalSize - physicalSize, minBlockSize)); physicalSize += size; } @@ -290,6 +290,10 @@ } } + + // NS 2014-07-31: FIXME: missing exception handling. + // error thrown in block of code below will leave TempSpace in inconsistent state: + // logical/physical size already increased while allocation has in fact failed. if (!block) { // allocate block in the temp file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2014-07-31 16:30:21
|
Revision: 59945 http://sourceforge.net/p/firebird/code/59945 Author: asfernandes Date: 2014-07-31 16:30:12 +0000 (Thu, 31 Jul 2014) Log Message: ----------- Improvement CORE-4487 - Maintain package body after ALTER/RECREATE PACKAGE. Modified Paths: -------------- firebird/trunk/src/burp/backup.epp firebird/trunk/src/burp/burp.h firebird/trunk/src/burp/restore.epp firebird/trunk/src/dsql/PackageNodes.epp firebird/trunk/src/include/gen/ids.h firebird/trunk/src/isql/extract.epp firebird/trunk/src/isql/show.epp firebird/trunk/src/jrd/names.h firebird/trunk/src/jrd/relations.h Modified: firebird/trunk/src/burp/backup.epp =================================================================== --- firebird/trunk/src/burp/backup.epp 2014-07-31 11:43:38 UTC (rev 59944) +++ firebird/trunk/src/burp/backup.epp 2014-07-31 16:30:12 UTC (rev 59945) @@ -3509,6 +3509,9 @@ X.RDB$PACKAGE_BODY_SOURCE); } + if (!X.RDB$VALID_BODY_FLAG.NULL) + put_int32(att_package_valid_body_flag, X.RDB$VALID_BODY_FLAG); + if (!X.RDB$SECURITY_CLASS.NULL) PUT_TEXT(att_package_security_class, X.RDB$SECURITY_CLASS); if (!X.RDB$OWNER_NAME.NULL) Modified: firebird/trunk/src/burp/burp.h =================================================================== --- firebird/trunk/src/burp/burp.h 2014-07-31 11:43:38 UTC (rev 59944) +++ firebird/trunk/src/burp/burp.h 2014-07-31 16:30:12 UTC (rev 59945) @@ -613,6 +613,7 @@ att_package_name = SERIES, att_package_header_source, att_package_body_source, + att_package_valid_body_flag, att_package_security_class, att_package_owner_name, att_package_description Modified: firebird/trunk/src/burp/restore.epp =================================================================== --- firebird/trunk/src/burp/restore.epp 2014-07-31 11:43:38 UTC (rev 59944) +++ firebird/trunk/src/burp/restore.epp 2014-07-31 16:30:12 UTC (rev 59945) @@ -6533,6 +6533,7 @@ { X.RDB$PACKAGE_HEADER_SOURCE.NULL = TRUE; X.RDB$PACKAGE_BODY_SOURCE.NULL = TRUE; + X.RDB$VALID_BODY_FLAG.NULL = TRUE; X.RDB$SECURITY_CLASS.NULL = TRUE; X.RDB$OWNER_NAME.NULL = TRUE; X.RDB$SYSTEM_FLAG = 0; @@ -6561,6 +6562,11 @@ X.RDB$PACKAGE_BODY_SOURCE.NULL = FALSE; break; + case att_package_valid_body_flag: + X.RDB$VALID_BODY_FLAG = (USHORT) get_int32(tdgbl); + X.RDB$VALID_BODY_FLAG.NULL = FALSE; + break; + case att_package_security_class: GET_TEXT(X.RDB$SECURITY_CLASS); if (strncmp(X.RDB$SECURITY_CLASS, SQL_SECCLASS_PREFIX, SQL_SECCLASS_PREFIX_LEN) != 0) Modified: firebird/trunk/src/dsql/PackageNodes.epp =================================================================== --- firebird/trunk/src/dsql/PackageNodes.epp 2014-07-31 11:43:38 UTC (rev 59944) +++ firebird/trunk/src/dsql/PackageNodes.epp 2014-07-31 16:30:12 UTC (rev 59945) @@ -606,7 +606,8 @@ attachment->storeMetaDataBlob(tdbb, transaction, &PKG.RDB$PACKAGE_HEADER_SOURCE, source); - PKG.RDB$PACKAGE_BODY_SOURCE.NULL = TRUE; + if (!PKG.RDB$VALID_BODY_FLAG.NULL) + PKG.RDB$VALID_BODY_FLAG = FALSE; END_MODIFY owner = PKG.RDB$OWNER_NAME; @@ -882,7 +883,7 @@ PKG IN RDB$PACKAGES WITH PKG.RDB$PACKAGE_NAME EQ name.c_str() { - if (!PKG.RDB$PACKAGE_BODY_SOURCE.NULL) + if (!PKG.RDB$VALID_BODY_FLAG.NULL && PKG.RDB$VALID_BODY_FLAG != 0) { status_exception::raise( Arg::Gds(isc_no_meta_update) << @@ -893,6 +894,9 @@ DDL_TRIGGER_CREATE_PACKAGE_BODY, name); MODIFY PKG + PKG.RDB$VALID_BODY_FLAG.NULL = FALSE; + PKG.RDB$VALID_BODY_FLAG = TRUE; + PKG.RDB$PACKAGE_BODY_SOURCE.NULL = FALSE; attachment->storeMetaDataBlob(tdbb, transaction, &PKG.RDB$PACKAGE_BODY_SOURCE, source); END_MODIFY @@ -1120,6 +1124,7 @@ DDL_TRIGGER_DROP_PACKAGE_BODY, name); MODIFY PKG + PKG.RDB$VALID_BODY_FLAG.NULL = TRUE; PKG.RDB$PACKAGE_BODY_SOURCE.NULL = TRUE; dsc desc; Modified: firebird/trunk/src/include/gen/ids.h =================================================================== --- firebird/trunk/src/include/gen/ids.h 2014-07-31 11:43:38 UTC (rev 59944) +++ firebird/trunk/src/include/gen/ids.h 2014-07-31 16:30:12 UTC (rev 59945) @@ -602,10 +602,11 @@ const USHORT f_pkg_name = 0; const USHORT f_pkg_header_source = 1; const USHORT f_pkg_body_source = 2; - const USHORT f_pkg_class = 3; - const USHORT f_pkg_owner = 4; - const USHORT f_pkg_sys_flag = 5; - const USHORT f_pkg_desc = 6; + const USHORT f_pkg_valid_body_flag = 3; + const USHORT f_pkg_class = 4; + const USHORT f_pkg_owner = 5; + const USHORT f_pkg_sys_flag = 6; + const USHORT f_pkg_desc = 7; // Relation 43 (SEC$USERS) Modified: firebird/trunk/src/isql/extract.epp =================================================================== --- firebird/trunk/src/isql/extract.epp 2014-07-31 11:43:38 UTC (rev 59944) +++ firebird/trunk/src/isql/extract.epp 2014-07-31 16:30:12 UTC (rev 59945) @@ -2998,17 +2998,20 @@ fb_utils::exact_name(PACK.RDB$OWNER_NAME); - isqlGlob.printf("%s/* Package body: %s, Owner: %s */%s", + isqlGlob.printf("%s/* Package body: %s, Owner: %s%s */%s", NEWLINE, PACK.RDB$PACKAGE_NAME, PACK.RDB$OWNER_NAME, + (!PACK.RDB$VALID_BODY_FLAG.NULL && PACK.RDB$VALID_BODY_FLAG != 0 ? "" : ", Invalid"), NEWLINE); - isqlGlob.printf("CREATE PACKAGE BODY %s AS%s", SQL_identifier, NEWLINE); - SHOW_print_metadata_text_blob(isqlGlob.Out, &PACK.RDB$PACKAGE_BODY_SOURCE); + if (!PACK.RDB$VALID_BODY_FLAG.NULL && PACK.RDB$VALID_BODY_FLAG != 0) + { + isqlGlob.printf("CREATE PACKAGE BODY %s AS%s", SQL_identifier, NEWLINE); + SHOW_print_metadata_text_blob(isqlGlob.Out, &PACK.RDB$PACKAGE_BODY_SOURCE); + isqlGlob.printf("%s%s", Procterm, NEWLINE); + } - isqlGlob.printf("%s%s", Procterm, NEWLINE); - END_FOR ON_ERROR ISQL_errmsg(fbStatus); Modified: firebird/trunk/src/isql/show.epp =================================================================== --- firebird/trunk/src/isql/show.epp 2014-07-31 11:43:38 UTC (rev 59944) +++ firebird/trunk/src/isql/show.epp 2014-07-31 16:30:12 UTC (rev 59945) @@ -4470,7 +4470,10 @@ if (!PACK.RDB$PACKAGE_BODY_SOURCE.NULL) { - isqlGlob.printf("%s%s", "Body source:", NEWLINE); + isqlGlob.printf("%s%s%s:%s", NEWLINE, "Body source", + (!PACK.RDB$VALID_BODY_FLAG.NULL && PACK.RDB$VALID_BODY_FLAG != 0 ? + "" : " (invalid)"), + NEWLINE); SHOW_print_metadata_text_blob (isqlGlob.Out, &PACK.RDB$PACKAGE_BODY_SOURCE); isqlGlob.printf(NEWLINE); } Modified: firebird/trunk/src/jrd/names.h =================================================================== --- firebird/trunk/src/jrd/names.h 2014-07-31 11:43:38 UTC (rev 59944) +++ firebird/trunk/src/jrd/names.h 2014-07-31 16:30:12 UTC (rev 59945) @@ -256,6 +256,7 @@ NAME("RDB$PACKAGE_NAME", nam_pkg_name) NAME("RDB$PACKAGE_HEADER_SOURCE", nam_pkg_header_source) NAME("RDB$PACKAGE_BODY_SOURCE", nam_pkg_body_source) +NAME("RDB$VALID_BODY_FLAG", nam_valid_body_flag) NAME("RDB$PRIVATE_FLAG", nam_private_flag) NAME("RDB$FUNCTION_BLR", nam_fun_blr) NAME("RDB$FUNCTION_SOURCE", nam_fun_source) Modified: firebird/trunk/src/jrd/relations.h =================================================================== --- firebird/trunk/src/jrd/relations.h 2014-07-31 11:43:38 UTC (rev 59944) +++ firebird/trunk/src/jrd/relations.h 2014-07-31 16:30:12 UTC (rev 59945) @@ -601,6 +601,7 @@ FIELD(f_pkg_name, nam_pkg_name, fld_pkg_name, 1, ODS_12_0) FIELD(f_pkg_header_source, nam_pkg_header_source, fld_source, 1, ODS_12_0) FIELD(f_pkg_body_source, nam_pkg_body_source, fld_source, 1, ODS_12_0) + FIELD(f_pkg_valid_body_flag, nam_valid_body_flag, fld_flag_nullable, 1, ODS_12_0) FIELD(f_pkg_class, nam_class, fld_class, 1, ODS_12_0) FIELD(f_pkg_owner, nam_owner, fld_user, 1, ODS_12_0) FIELD(f_pkg_sys_flag, nam_sys_flag, fld_flag, 1, ODS_12_0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Alexander P. <ale...@us...> - 2014-07-31 11:44:49
|
Update of /cvsroot/firebird/fbtcs/GTCS/tests In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv13727 Modified Files: FB_SQL_2.output FB_SQL_2.script Log Message: Enhanced test Index: FB_SQL_2.output =================================================================== RCS file: /cvsroot/firebird/fbtcs/GTCS/tests/FB_SQL_2.output,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FB_SQL_2.output 27 Dec 2009 16:51:22 -0000 1.1 +++ FB_SQL_2.output 31 Jul 2014 11:44:47 -0000 1.2 @@ -1,3 +1,5 @@ +Invalid cursor declaration +-Statement already has a cursor C1 assigned Original values: 1, 11 2, 22 @@ -7,3 +9,24 @@ 1, 22 2, 44 3, 66 + + +Original values: +1, 11 +2, 22 +3, 33 + +Next values: +1, 22 +2, 44 +3, 66 + +Next values: +1, 44 +2, 88 +3, 132 + +Final values: +1, 88 +2, 176 +3, 264 Index: FB_SQL_2.script =================================================================== RCS file: /cvsroot/firebird/fbtcs/GTCS/tests/FB_SQL_2.script,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FB_SQL_2.script 27 Dec 2009 16:51:23 -0000 1.1 +++ FB_SQL_2.script 31 Jul 2014 11:44:47 -0000 1.2 @@ -62,8 +62,6 @@ } if (isc_dsql_set_cursor_name(userStatus, &stmt1, "C1", 0)) isc_print_status(userStatus); - if (isc_dsql_execute(userStatus, &gds__trans, &stmt1, 1, NULL)) - isc_print_status(userStatus); stmt2 = 0; if (isc_dsql_allocate_statement(userStatus, &db, &stmt2)) @@ -74,6 +72,9 @@ isc_print_status(userStatus); } + if (isc_dsql_execute(userStatus, &gds__trans, &stmt1, 1, NULL)) + isc_print_status(userStatus); + printf("Original values:\n"); while (1) @@ -94,6 +95,16 @@ if (isc_dsql_free_statement(userStatus, &stmt1, DSQL_close)) isc_print_status(userStatus); + if (isc_dsql_set_cursor_name(userStatus, &stmt1, "C2", 0)) + isc_print_status(userStatus); + + if (isc_dsql_prepare(userStatus, &gds__trans, &stmt1, 0, + "select n1, n2 from t1 for update", 1, outsqlda)) + isc_print_status(userStatus); + + if (isc_dsql_set_cursor_name(userStatus, &stmt1, "C2", 0)) + isc_print_status(userStatus); + if (isc_dsql_execute(userStatus, &gds__trans, &stmt1, 1, NULL)) isc_print_status(userStatus); @@ -114,7 +125,7 @@ if (isc_dsql_free_statement(userStatus, &stmt1, DSQL_drop)) isc_print_status(userStatus); - if (isc_commit_transaction(userStatus, &gds__trans)) + if (isc_rollback_transaction(userStatus, &gds__trans)) isc_print_status(userStatus); if (isc_detach_database(userStatus, &db)) @@ -123,10 +134,168 @@ return 0; } +>> p2.cpp +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <ibase.h> +#include <firebird/Provider.h> + +using namespace Firebird; + +static IMaster* master = fb_get_master_interface(); + +static void check(IStatus* s, const char* text) +{ + if (!s->isSuccess()) + throw text; +} + +inline const int* get(const unsigned char* b, int off) +{ + return reinterpret_cast<const int*>(b + off); +} + +void scan2(IStatus* st, IResultSet* curs, ITransaction* tra, IStatement* stmt) +{ + IMessageMetadata* meta = curs->getMetadata(st); + check(st, "getMetadata"); + + unsigned l = meta->getMessageLength(st); + check(st, "getMessageLength"); + unsigned char* buffer = new unsigned char[l]; + + const int* n1 = get(buffer, meta->getOffset(st, 0)); + check(st, "getOffset"); + const int* n2 = get(buffer, meta->getOffset(st, 1)); + check(st, "getOffset-2"); + + meta->release(); + + while (curs->fetchNext(st, buffer)) + { + printf("%d, %d\n", *n1, *n2); + + if (stmt) + { + stmt->execute(st, tra, NULL, NULL, NULL, NULL); + check(st, "execute"); + } + } + check(st, "fetchNext"); + + delete[] buffer; +} + +void scan(IStatus* st, IStatement* s1, ITransaction* tra, IStatement* stmt) +{ + IResultSet* curs = s1->openCursor(st, tra, NULL, NULL, NULL); + check(st, "openCursor"); + + s1->setCursorName(st, "BadName"); + if (st->isSuccess()) + throw("setCursorName must fail"); + st->init(); + + scan2(st, curs, tra, stmt); + + curs->close(st); + check(st, "close cursor"); +} + +#define SELECT_SQL "select n1, n2 from t1 for update" +#define UPDATE_SQL "update t1 set n2 = n2 * 2 where current of " + +int main() +{ + int rc = 0; + + // declare pointers to required interfaces + IStatus* st = NULL; + IProvider* prov = NULL; + IAttachment* att = NULL; + ITransaction* tra = NULL; + IStatement* stmt1 = NULL; + IStatement* stmt2 = NULL; + + try + { + st = master->getStatus(); + prov = master->getDispatcher(); + + att = prov->attachDatabase(st, "WHERE_GDB:test2.gdb", 0, NULL); + check(st, "attachDatabase"); + + tra = att->startTransaction(st, 0, NULL); + check(st, "startTransaction"); + + stmt1 = att->prepare(st, tra, 0, SELECT_SQL, + 3, IStatement::PREPARE_PREFETCH_METADATA); + check(st, "prepare"); + + stmt1->setCursorName(st, "CCC"); + check(st, "setCursorName CCC"); + + stmt1->setCursorName(st, "C1"); + check(st, "setCursorName C1"); + + stmt2 = att->prepare(st, tra, 0, UPDATE_SQL "C1", + 3, IStatement::PREPARE_PREFETCH_METADATA); + check(st, "prepare 1"); + + printf("\n\nOriginal values:\n"); + scan(st, stmt1, tra, stmt2); + + stmt1->setCursorName(st, "C2"); + check(st, "setCursorName C2"); + + stmt2->release(); + stmt2 = att->prepare(st, tra, 0, UPDATE_SQL "C2", + 3, IStatement::PREPARE_PREFETCH_METADATA); + check(st, "prepare 2"); + + printf("\nNext values:\n"); + scan(st, stmt1, tra, stmt2); + + IResultSet* rs = att->openCursor(st, tra, 0, SELECT_SQL, 3, NULL, NULL, NULL, "C3"); + check(st, "openCursor C3"); + + stmt2->release(); + stmt2 = att->prepare(st, tra, 0, UPDATE_SQL "C3", + 3, IStatement::PREPARE_PREFETCH_METADATA); + check(st, "prepare 2"); + + printf("\nNext values:\n"); + scan2(st, rs, tra, stmt2); + + rs->release(); + + printf("\nFinal values:\n"); + scan(st, stmt1, tra, NULL); + + att->release(); + } + catch (const char* text) + { + // handle error + rc = 1; + printf("%s:\n", text); + if (st) + isc_print_status(st->get()); + } + + return rc; +} + + $ISQL -q -m -i init.sql $GPRE -m -e p1.e $CC FLAG_CC p1.c -$LINK FLAG_LINK p1 +$LINK FLAG_LINK p1 $RUN p1 -$DELETE -f p1* init.sql +$CXX FLAG_CXX p2.cpp +$LINK FLAG_LINK p2 +$RUN p2 +$DELETE -f p1* p2* init.sql $DROP WHERE_GDB:test2.gdb |
From: <ale...@us...> - 2014-07-31 11:43:42
|
Revision: 59944 http://sourceforge.net/p/firebird/code/59944 Author: alexpeshkoff Date: 2014-07-31 11:43:38 +0000 (Thu, 31 Jul 2014) Log Message: ----------- Fixed CORE-4505: Use of named cursor fails if statement was not executed. Should also fix CORE-4489, but I cannot check. Modified Paths: -------------- firebird/trunk/examples/interfaces/04.print_table.cpp firebird/trunk/src/auth/SecureRemotePassword/manage/SrpManagement.cpp firebird/trunk/src/dsql/dsql.cpp firebird/trunk/src/include/firebird/Provider.h firebird/trunk/src/jrd/EngineInterface.h firebird/trunk/src/jrd/Mapping.cpp firebird/trunk/src/jrd/jrd.cpp firebird/trunk/src/remote/client/interface.cpp firebird/trunk/src/remote/server/server.cpp firebird/trunk/src/yvalve/YObjects.h firebird/trunk/src/yvalve/why.cpp Modified: firebird/trunk/examples/interfaces/04.print_table.cpp =================================================================== --- firebird/trunk/examples/interfaces/04.print_table.cpp 2014-07-31 09:08:27 UTC (rev 59943) +++ firebird/trunk/examples/interfaces/04.print_table.cpp 2014-07-31 11:43:38 UTC (rev 59944) @@ -93,7 +93,7 @@ "or RDB$VIEW_SOURCE is not null"; // Do not use IStatement - just ask attachment to open cursor - curs = att->openCursor(st, tra, 0, sql, 3, NULL, NULL, NULL); + curs = att->openCursor(st, tra, 0, sql, 3, NULL, NULL, NULL, NULL); check(st, "openCursor"); meta = curs->getMetadata(st); Modified: firebird/trunk/src/auth/SecureRemotePassword/manage/SrpManagement.cpp =================================================================== --- firebird/trunk/src/auth/SecureRemotePassword/manage/SrpManagement.cpp 2014-07-31 09:08:27 UTC (rev 59943) +++ firebird/trunk/src/auth/SecureRemotePassword/manage/SrpManagement.cpp 2014-07-31 11:43:38 UTC (rev 59944) @@ -150,7 +150,7 @@ Message out; Field<Varying> grantor(out, MAX_SQL_IDENTIFIER_SIZE); Firebird::IResultSet* curs = att->openCursor(&s, tra, selGrantor.length(), - selGrantor.c_str(), SQL_DIALECT_V6, NULL, NULL, out.getMetadata()); + selGrantor.c_str(), SQL_DIALECT_V6, NULL, NULL, out.getMetadata(), NULL); check(&s); bool hasGrant = curs->fetchNext(&s, out.getBuffer()); Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2014-07-31 09:08:27 UTC (rev 59943) +++ firebird/trunk/src/dsql/dsql.cpp 2014-07-31 11:43:38 UTC (rev 59944) @@ -426,7 +426,7 @@ const size_t MAX_CURSOR_LENGTH = 132 - 1; string cursor = name; - if (cursor.hasData() && cursor[0] == '\"') + if (cursor[0] == '\"') { // Quoted cursor names eh? Strip'em. // Note that "" will be replaced with ". @@ -477,13 +477,16 @@ // If there already is a cursor and its name isn't the same, ditto. // We already know there is no cursor by this name in the hash table - if (req_cursor.isEmpty()) + if (req_cursor.isEmpty() || !(req_flags & dsql_req::FLAG_OPENED_CURSOR)) { + if (req_cursor.hasData()) + req_dbb->dbb_cursors.remove(req_cursor); req_cursor = cursor; req_dbb->dbb_cursors.put(cursor, this); } else { + fb_assert(!symbol); ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-502) << Arg::Gds(isc_dsql_decl_err) << Arg::Gds(isc_dsql_cursor_redefined) << req_cursor); Modified: firebird/trunk/src/include/firebird/Provider.h =================================================================== --- firebird/trunk/src/include/firebird/Provider.h 2014-07-31 09:08:27 UTC (rev 59943) +++ firebird/trunk/src/include/firebird/Provider.h 2014-07-31 11:43:38 UTC (rev 59944) @@ -141,7 +141,6 @@ virtual FB_BOOLEAN FB_CARG isEof(IStatus* status) = 0; virtual FB_BOOLEAN FB_CARG isBof(IStatus* status) = 0; virtual IMessageMetadata* FB_CARG getMetadata(IStatus* status) = 0; - virtual void FB_CARG setCursorName(IStatus* status, const char* name) = 0; virtual void FB_CARG close(IStatus* status) = 0; // This item is for ISC API emulation only @@ -149,7 +148,7 @@ // Please do not use it! virtual void FB_CARG setDelayedOutputFormat(IStatus* status, IMessageMetadata* format) = 0; }; -#define FB_RESULTSET_VERSION (FB_REFCOUNTED_VERSION + 12) +#define FB_RESULTSET_VERSION (FB_REFCOUNTED_VERSION + 11) class IStatement : public IRefCounted { @@ -186,10 +185,11 @@ IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata, void* outBuffer) = 0; virtual IResultSet* FB_CARG openCursor(IStatus* status, ITransaction* transaction, IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata) = 0; + virtual void FB_CARG setCursorName(IStatus* status, const char* name) = 0; virtual void FB_CARG free(IStatus* status) = 0; virtual unsigned FB_CARG getFlags(IStatus* status) = 0; }; -#define FB_STATEMENT_VERSION (FB_REFCOUNTED_VERSION + 10) +#define FB_STATEMENT_VERSION (FB_REFCOUNTED_VERSION + 11) class IRequest : public IRefCounted { @@ -253,7 +253,8 @@ IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata, void* outBuffer) = 0; virtual IResultSet* FB_CARG openCursor(IStatus* status, ITransaction* transaction, unsigned int stmtLength, const char* sqlStmt, unsigned dialect, - IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata) = 0; + IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata, + const char* cursorName) = 0; virtual IEvents* FB_CARG queEvents(IStatus* status, IEventCallback* callback, unsigned int length, const unsigned char* events) = 0; virtual void FB_CARG cancelOperation(IStatus* status, int option) = 0; Modified: firebird/trunk/src/jrd/EngineInterface.h =================================================================== --- firebird/trunk/src/jrd/EngineInterface.h 2014-07-31 09:08:27 UTC (rev 59943) +++ firebird/trunk/src/jrd/EngineInterface.h 2014-07-31 11:43:38 UTC (rev 59944) @@ -146,7 +146,6 @@ virtual FB_BOOLEAN FB_CARG isEof(Firebird::IStatus* status); virtual FB_BOOLEAN FB_CARG isBof(Firebird::IStatus* status); virtual Firebird::IMessageMetadata* FB_CARG getMetadata(Firebird::IStatus* status); - virtual void FB_CARG setCursorName(Firebird::IStatus* status, const char* name); virtual void FB_CARG close(Firebird::IStatus* status); virtual void FB_CARG setDelayedOutputFormat(Firebird::IStatus* status, Firebird::IMessageMetadata* format); @@ -190,6 +189,7 @@ virtual JResultSet* FB_CARG openCursor(Firebird::IStatus* status, Firebird::ITransaction* transaction, Firebird::IMessageMetadata* inMetadata, void* inBuffer, Firebird::IMessageMetadata* outMetadata); + virtual void FB_CARG setCursorName(Firebird::IStatus* status, const char* name); virtual unsigned FB_CARG getFlags(Firebird::IStatus* status); public: @@ -331,7 +331,7 @@ virtual Firebird::IResultSet* FB_CARG openCursor(Firebird::IStatus* status, Firebird::ITransaction* transaction, unsigned int stmtLength, const char* sqlStmt, unsigned int dialect, Firebird::IMessageMetadata* inMetadata, void* inBuffer, - Firebird::IMessageMetadata* outMetadata); + Firebird::IMessageMetadata* outMetadata, const char* cursorName); virtual JEvents* FB_CARG queEvents(Firebird::IStatus* status, Firebird::IEventCallback* callback, unsigned int length, const unsigned char* events); virtual void FB_CARG cancelOperation(Firebird::IStatus* status, int option); Modified: firebird/trunk/src/jrd/Mapping.cpp =================================================================== --- firebird/trunk/src/jrd/Mapping.cpp 2014-07-31 09:08:27 UTC (rev 59943) +++ firebird/trunk/src/jrd/Mapping.cpp 2014-07-31 11:43:38 UTC (rev 59944) @@ -278,7 +278,7 @@ "SELECT RDB$MAP_USING, RDB$MAP_PLUGIN, RDB$MAP_DB, RDB$MAP_FROM_TYPE, " " RDB$MAP_FROM, RDB$MAP_TO_TYPE, RDB$MAP_TO " "FROM RDB$AUTH_MAPPING", - 3, NULL, NULL, mMap.getMetadata()); + 3, NULL, NULL, mMap.getMetadata(), NULL); if (!st.isSuccess()) { if (fb_utils::containsErrorCode(st.get(), isc_dsql_relation_err)) @@ -1190,7 +1190,7 @@ "SELECT RDB$MAP_NAME, RDB$MAP_USING, RDB$MAP_PLUGIN, RDB$MAP_DB, " " RDB$MAP_FROM_TYPE, RDB$MAP_FROM, RDB$MAP_TO_TYPE, RDB$MAP_TO " "FROM RDB$AUTH_MAPPING", - 3, NULL, NULL, mMap.getMetadata()); + 3, NULL, NULL, mMap.getMetadata(), NULL); if (!st.isSuccess()) { if (!fb_utils::containsErrorCode(st.get(), isc_dsql_relation_err)) Modified: firebird/trunk/src/jrd/jrd.cpp =================================================================== --- firebird/trunk/src/jrd/jrd.cpp 2014-07-31 09:08:27 UTC (rev 59943) +++ firebird/trunk/src/jrd/jrd.cpp 2014-07-31 11:43:38 UTC (rev 59944) @@ -4474,7 +4474,8 @@ IResultSet* JAttachment::openCursor(IStatus* user_status, ITransaction* apiTra, unsigned int length, const char* string, unsigned int dialect, - IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata) + IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata, + const char* cursorName) { IStatement* tmpStatement = prepare(user_status, apiTra, length, string, dialect, (outMetadata ? 0 : IStatement::PREPARE_PREFETCH_OUTPUT_PARAMETERS)); @@ -4483,6 +4484,16 @@ return NULL; } + if (cursorName) + { + tmpStatement->setCursorName(user_status, cursorName); + if (!user_status->isSuccess()) + { + tmpStatement->release(); + return NULL; + } + } + IResultSet* rs = tmpStatement->openCursor(user_status, apiTra, inMetadata, inBuffer, outMetadata); @@ -5035,7 +5046,7 @@ } -void JResultSet::setCursorName(IStatus* user_status, const char* cursor) +void JStatement::setCursorName(IStatus* user_status, const char* cursor) { try { @@ -5044,9 +5055,7 @@ try { - dsql_req* req = getStatement()->getHandle(); - fb_assert(req); - req->setCursor(tdbb, cursor); + getHandle()->setCursor(tdbb, cursor); } catch (const Exception& ex) { Modified: firebird/trunk/src/remote/client/interface.cpp =================================================================== --- firebird/trunk/src/remote/client/interface.cpp 2014-07-31 09:08:27 UTC (rev 59943) +++ firebird/trunk/src/remote/client/interface.cpp 2014-07-31 11:43:38 UTC (rev 59944) @@ -253,7 +253,6 @@ virtual FB_BOOLEAN FB_CARG isEof(IStatus* status); virtual FB_BOOLEAN FB_CARG isBof(IStatus* status); virtual IMessageMetadata* FB_CARG getMetadata(IStatus* status); - virtual void FB_CARG setCursorName(IStatus* status, const char* name); virtual void FB_CARG close(IStatus* status); virtual void FB_CARG setDelayedOutputFormat(IStatus* status, IMessageMetadata* format); @@ -308,6 +307,7 @@ IMessageMetadata* outMetadata, void* outBuffer); virtual ResultSet* FB_CARG openCursor(IStatus* status, ITransaction* tra, IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outFormat); + virtual void FB_CARG setCursorName(IStatus* status, const char* name); virtual void FB_CARG free(IStatus* status); virtual unsigned FB_CARG getFlags(IStatus* status); @@ -475,7 +475,8 @@ IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata, void* outBuffer); virtual Firebird::IResultSet* FB_CARG openCursor(IStatus* status, ITransaction* transaction, unsigned int stmtLength, const char* sqlStmt, unsigned dialect, - IMessageMetadata* inMetadata, void* inBuffer, Firebird::IMessageMetadata* outMetadata); + IMessageMetadata* inMetadata, void* inBuffer, Firebird::IMessageMetadata* outMetadata, + const char* cursorName); virtual Firebird::IEvents* FB_CARG queEvents(IStatus* status, Firebird::IEventCallback* callback, unsigned int length, const unsigned char* events); virtual void FB_CARG cancelOperation(IStatus* status, int option); @@ -1986,7 +1987,8 @@ IResultSet* FB_CARG Attachment::openCursor(IStatus* status, ITransaction* transaction, unsigned int stmtLength, const char* sqlStmt, unsigned dialect, - IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata) + IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata, + const char* cursorName) { Statement* stmt = prepare(status, transaction, stmtLength, sqlStmt, dialect, (outMetadata ? 0 : IStatement::PREPARE_PREFETCH_OUTPUT_PARAMETERS)); @@ -2002,6 +2004,17 @@ return NULL; } + if (cursorName) + { + stmt->setCursorName(status, cursorName); + if (!status->isSuccess()) + { + rc->release(); + stmt->release(); + return NULL; + } + } + rc->tmpStatement = true; return rc; } @@ -3070,7 +3083,7 @@ } -void ResultSet::setCursorName(IStatus* status, const char* cursor) +void Statement::setCursorName(IStatus* status, const char* cursor) { /***************************************** * @@ -3101,16 +3114,9 @@ // Check and validate handles, etc. - if (!stmt) - { - (Arg::Gds(isc_dsql_cursor_err) << Arg::Gds(isc_bad_req_handle)).raise(); - } - Rsr* statement = stmt->getStatement(); + Rsr* statement = getStatement(); CHECK_HANDLE(statement, isc_bad_req_handle); - Rdb* rdb = statement->rsr_rdb; - CHECK_HANDLE(rdb, isc_bad_db_handle); - rem_port* port = rdb->rdb_port; RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION); Modified: firebird/trunk/src/remote/server/server.cpp =================================================================== --- firebird/trunk/src/remote/server/server.cpp 2014-07-31 09:08:27 UTC (rev 59943) +++ firebird/trunk/src/remote/server/server.cpp 2014-07-31 11:43:38 UTC (rev 59944) @@ -2898,7 +2898,6 @@ return this->send_response(sendL, 0, 0, &status_vector, true); } statement->rsr_cursor = NULL; - statement->rsr_cursor_name = ""; fb_assert(statement->rsr_rtr); FB_SIZE_T pos; if (!statement->rsr_rtr->rtr_cursors.find(statement, pos)) @@ -3230,14 +3229,6 @@ { transaction->rtr_cursors.add(statement); statement->rsr_delayed_format = !out_blr_length; - - if (statement->rsr_cursor_name.hasData()) - { - statement->rsr_cursor->setCursorName(&status_vector, statement->rsr_cursor_name.c_str()); - - if (status_vector.isSuccess()) - statement->rsr_cursor_name = ""; - } } } else @@ -4051,6 +4042,13 @@ if (!status_vector.isSuccess()) return this->send_response(sendL, 0, 0, &status_vector, false); + if (statement->rsr_cursor_name.hasData()) + { + statement->rsr_iface->setCursorName(&status_vector, statement->rsr_cursor_name.c_str()); + if (!status_vector.isSuccess()) + return this->send_response(sendL, 0, 0, &status_vector, false); + } + LocalStatus s2; statement->rsr_iface->getInfo(&s2, infoLength, info, prepareL->p_sqlst_buffer_length, buffer); if (!s2.isSuccess()) @@ -4999,7 +4997,6 @@ Rsr* const statement = transaction->rtr_cursors.pop(); fb_assert(statement->rsr_cursor); statement->rsr_cursor = NULL; - statement->rsr_cursor_name = ""; } for (Rtr** p = &rdb->rdb_transactions; *p; p = &(*p)->rtr_next) @@ -5405,20 +5402,18 @@ getHandle(statement, sqlcur->p_sqlcur_statement); - - if (statement->rsr_cursor) - statement->rsr_cursor->setCursorName(&status_vector, name); - else + if (port_protocol < PROTOCOL_VERSION13 && statement->rsr_cursor_name.hasData() && + statement->rsr_cursor_name != name) { - if (statement->rsr_cursor_name.hasData() && statement->rsr_cursor_name != name) - { - status_vector.set((Arg::Gds(isc_dsql_decl_err) << - Arg::Gds(isc_dsql_cursor_redefined) << statement->rsr_cursor_name).value()); - } - else - statement->rsr_cursor_name = name; + status_vector.set((Arg::Gds(isc_dsql_decl_err) << + Arg::Gds(isc_dsql_cursor_redefined) << statement->rsr_cursor_name).value()); } + else + statement->rsr_cursor_name = name; + if (statement->rsr_iface) + statement->rsr_iface->setCursorName(&status_vector, name); + return this->send_response(sendL, 0, 0, &status_vector, false); } Modified: firebird/trunk/src/yvalve/YObjects.h =================================================================== --- firebird/trunk/src/yvalve/YObjects.h 2014-07-31 09:08:27 UTC (rev 59943) +++ firebird/trunk/src/yvalve/YObjects.h 2014-07-31 11:43:38 UTC (rev 59944) @@ -310,7 +310,6 @@ virtual FB_BOOLEAN FB_CARG isEof(Firebird::IStatus* status); virtual FB_BOOLEAN FB_CARG isBof(Firebird::IStatus* status); virtual Firebird::IMessageMetadata* FB_CARG getMetadata(Firebird::IStatus* status); - virtual void FB_CARG setCursorName(Firebird::IStatus* status, const char* name); virtual void FB_CARG close(Firebird::IStatus* status); virtual void FB_CARG setDelayedOutputFormat(Firebird::IStatus* status, Firebird::IMessageMetadata* format); @@ -358,6 +357,7 @@ Firebird::IMessageMetadata* outMetadata, void* outBuffer); virtual Firebird::IResultSet* FB_CARG openCursor(Firebird::IStatus* status, Firebird::ITransaction* transaction, Firebird::IMessageMetadata* inMetadata, void* inBuffer, Firebird::IMessageMetadata* outMetadata); + virtual void FB_CARG setCursorName(Firebird::IStatus* status, const char* name); virtual void FB_CARG free(Firebird::IStatus* status); virtual unsigned FB_CARG getFlags(Firebird::IStatus* status); @@ -433,7 +433,8 @@ Firebird::IMessageMetadata* outMetadata, void* outBuffer); virtual Firebird::IResultSet* FB_CARG openCursor(Firebird::IStatus* status, Firebird::ITransaction* transaction, unsigned int stmtLength, const char* sqlStmt, unsigned int dialect, - Firebird::IMessageMetadata* inMetadata, void* inBuffer, Firebird::IMessageMetadata* outMetadata); + Firebird::IMessageMetadata* inMetadata, void* inBuffer, Firebird::IMessageMetadata* outMetadata, + const char* cursorName); virtual YEvents* FB_CARG queEvents(Firebird::IStatus* status, Firebird::IEventCallback* callback, unsigned int length, const unsigned char* eventsData); virtual void FB_CARG cancelOperation(Firebird::IStatus* status, int option); Modified: firebird/trunk/src/yvalve/why.cpp =================================================================== --- firebird/trunk/src/yvalve/why.cpp 2014-07-31 09:08:27 UTC (rev 59943) +++ firebird/trunk/src/yvalve/why.cpp 2014-07-31 11:43:38 UTC (rev 59944) @@ -1370,14 +1370,6 @@ fb_assert(statement->cursor); - if (cursorName.hasData()) - { - statement->cursor->setCursorName(status, cursorName.c_str()); - - if (status->isSuccess()) - cursorName = ""; - } - delayedFormat = (outMetadata == DELAYED_OUT_FORMAT); } @@ -1408,7 +1400,6 @@ Arg::StatusVector(status->get()).raise(); statement = NULL; - cursorName = ""; } } @@ -2345,13 +2336,6 @@ } fb_assert(statement->statement->cursor); - - if (statement->cursorName.hasData()) - { - statement->statement->cursor->setCursorName(&status, statement->cursorName.c_str()); - if (status.isSuccess()) - statement->cursorName = ""; - } } else { @@ -2798,18 +2782,15 @@ { RefPtr<IscStatement> statement(translateHandle(statements, stmtHandle)); - if (statement->statement && statement->statement->cursor) - statement->statement->cursor->setCursorName(&status, cursorName); - else + if (statement->cursorName.hasData() && statement->cursorName != cursorName) { - if (statement->cursorName.hasData() && statement->cursorName != cursorName) - { - (Arg::Gds(isc_dsql_decl_err) << - Arg::Gds(isc_dsql_cursor_redefined) << statement->cursorName).raise(); - } + (Arg::Gds(isc_dsql_decl_err) << + Arg::Gds(isc_dsql_cursor_redefined) << statement->cursorName).raise(); + } - statement->cursorName = cursorName; - } + statement->cursorName = cursorName; + if (statement->statement) + statement->statement->setCursorName(&status, cursorName); } catch (const Exception& e) { @@ -4444,11 +4425,11 @@ destroy2(dstrFlags); } -void YResultSet::setCursorName(IStatus* status, const char* name) +void YStatement::setCursorName(IStatus* status, const char* name) { try { - YEntry<YResultSet> entry(status, this); + YEntry<YStatement> entry(status, this); entry.next()->setCursorName(status, name); } @@ -5173,7 +5154,8 @@ IResultSet* YAttachment::openCursor(IStatus* status, ITransaction* transaction, unsigned int length, const char* string, unsigned int dialect, - IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata) + IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata, + const char* cursorName) { IResultSet* rs = NULL; try @@ -5185,7 +5167,7 @@ getNextTransaction(status, transaction, trans); rs = entry.next()->openCursor(status, trans, length, string, dialect, - inMetadata, inBuffer, outMetadata); + inMetadata, inBuffer, outMetadata, cursorName); if (!status->isSuccess()) { return NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2014-07-31 09:08:30
|
Revision: 59943 http://sourceforge.net/p/firebird/code/59943 Author: dimitr Date: 2014-07-31 09:08:27 +0000 (Thu, 31 Jul 2014) Log Message: ----------- Commented out the annoying (thus supposedly wrong?) assertion. Modified Paths: -------------- firebird/trunk/src/yvalve/why.cpp Modified: firebird/trunk/src/yvalve/why.cpp =================================================================== --- firebird/trunk/src/yvalve/why.cpp 2014-07-31 09:07:51 UTC (rev 59942) +++ firebird/trunk/src/yvalve/why.cpp 2014-07-31 09:08:27 UTC (rev 59943) @@ -533,7 +533,7 @@ void SQLDAMetadata::scatterData(DataBuffer& from) { fb_assert(sqlda); - fb_assert(offsets); // Not reliable, but still check that input buffer can come from this metadata +// fb_assert(offsets); // Not reliable, but still check that input buffer can come from this metadata if (speedHackEnabled) return; // Data is already in user's buffer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2014-07-31 09:07:53
|
Revision: 59942 http://sourceforge.net/p/firebird/code/59942 Author: dimitr Date: 2014-07-31 09:07:51 +0000 (Thu, 31 Jul 2014) Log Message: ----------- Follow-up. Modified Paths: -------------- firebird/trunk/src/msgs/messages2.sql Modified: firebird/trunk/src/msgs/messages2.sql =================================================================== --- firebird/trunk/src/msgs/messages2.sql 2014-07-31 09:01:38 UTC (rev 59941) +++ firebird/trunk/src/msgs/messages2.sql 2014-07-31 09:07:51 UTC (rev 59942) @@ -713,7 +713,7 @@ ('eds_output_prm_mismatch', NULL, 'ExtDS.cpp', NULL, 0, 608, NULL, 'Output parameters mismatch', NULL, NULL) ('eds_input_prm_not_set', NULL, 'ExtDS.cpp', NULL, 0, 609, NULL, 'Input parameter ''@1'' have no value set', NULL, NULL) ('too_big_blr', 'end_blr', 'ddl.cpp', NULL, 0, 610, NULL, 'BLR stream length @1 exceeds implementation limit @2', NULL, NULL) -('montabexh', 'acquire', 'DatabaseSnapshot.cpp', NULL, 0, 611, NULL, 'Monitoring table space exhausted', NULL, NULL) +('montabexh', 'acquire', 'Monitoring.cpp', NULL, 0, 611, NULL, 'Monitoring table space exhausted', NULL, NULL) ('modnotfound', 'par_function', 'par.cpp', NULL, 0, 612, NULL, 'module name or entrypoint could not be found', NULL, NULL) ('nothing_to_cancel', 'FB_CANCEL_OPERATION', 'why.cpp', NULL, 0, 613, NULL, 'nothing to cancel', NULL, NULL) ('ibutil_not_loaded', NULL, NULL, NULL, 0, 614, NULL, 'ib_util library has not been loaded to deallocate memory returned by FREE_IT function', NULL, NULL) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2014-07-31 09:01:41
|
Revision: 59941 http://sourceforge.net/p/firebird/code/59941 Author: dimitr Date: 2014-07-31 09:01:38 +0000 (Thu, 31 Jul 2014) Log Message: ----------- Fixed Windows builds. Modified Paths: -------------- firebird/trunk/builds/win32/msvc10/engine.vcxproj firebird/trunk/builds/win32/msvc10/engine.vcxproj.filters firebird/trunk/builds/win32/msvc8/engine.vcproj firebird/trunk/builds/win32/msvc9/engine.vcproj Modified: firebird/trunk/builds/win32/msvc10/engine.vcxproj =================================================================== --- firebird/trunk/builds/win32/msvc10/engine.vcxproj 2014-07-31 08:56:53 UTC (rev 59940) +++ firebird/trunk/builds/win32/msvc10/engine.vcxproj 2014-07-31 09:01:38 UTC (rev 59941) @@ -64,7 +64,6 @@ <ClCompile Include="..\..\..\src\jrd\cvt.cpp" /> <ClCompile Include="..\..\..\src\jrd\cvt2.cpp" /> <ClCompile Include="..\..\..\src\jrd\Database.cpp" /> - <ClCompile Include="..\..\..\src\jrd\DatabaseSnapshot.cpp" /> <ClCompile Include="..\..\..\src\jrd\DataTypeUtil.cpp" /> <ClCompile Include="..\..\..\src\jrd\DebugInterface.cpp" /> <ClCompile Include="..\..\..\src\jrd\err.cpp" /> @@ -89,6 +88,7 @@ <ClCompile Include="..\..\..\src\jrd\JrdStatement.cpp" /> <ClCompile Include="..\..\..\src\jrd\lck.cpp" /> <ClCompile Include="..\..\..\src\jrd\Mapping.cpp" /> + <ClCompile Include="..\..\..\src\jrd\Monitoring.cpp" /> <ClCompile Include="..\..\..\src\jrd\mov.cpp" /> <ClCompile Include="..\..\..\src\jrd\nbak.cpp" /> <ClCompile Include="..\..\..\src\jrd\nodebug.cpp" /> @@ -209,7 +209,6 @@ <ClInclude Include="..\..\..\src\jrd\cvt2_proto.h" /> <ClInclude Include="..\..\..\src\jrd\cvt_proto.h" /> <ClInclude Include="..\..\..\src\jrd\Database.h" /> - <ClInclude Include="..\..\..\src\jrd\DatabaseSnapshot.h" /> <ClInclude Include="..\..\..\src\jrd\DataTypeUtil.h" /> <ClInclude Include="..\..\..\src\jrd\DebugInterface.h" /> <ClInclude Include="..\..\..\src\jrd\dflt.h" /> @@ -264,6 +263,7 @@ <ClInclude Include="..\..\..\src\jrd\license.h" /> <ClInclude Include="..\..\..\src\jrd\lls.h" /> <ClInclude Include="..\..\..\src\jrd\Mapping.h" /> + <ClInclude Include="..\..\..\src\jrd\Monitoring.h" /> <ClInclude Include="..\..\..\src\jrd\met.h" /> <ClInclude Include="..\..\..\src\jrd\met_proto.h" /> <ClInclude Include="..\..\..\src\jrd\mov_proto.h" /> Modified: firebird/trunk/builds/win32/msvc10/engine.vcxproj.filters =================================================================== --- firebird/trunk/builds/win32/msvc10/engine.vcxproj.filters 2014-07-31 08:56:53 UTC (rev 59940) +++ firebird/trunk/builds/win32/msvc10/engine.vcxproj.filters 2014-07-31 09:01:38 UTC (rev 59941) @@ -228,9 +228,6 @@ <ClCompile Include="..\..\..\src\jrd\Database.cpp"> <Filter>JRD files</Filter> </ClCompile> - <ClCompile Include="..\..\..\src\jrd\DatabaseSnapshot.cpp"> - <Filter>JRD files</Filter> - </ClCompile> <ClCompile Include="..\..\..\src\jrd\DataTypeUtil.cpp"> <Filter>JRD files</Filter> </ClCompile> @@ -288,6 +285,9 @@ <ClCompile Include="..\..\..\src\jrd\lck.cpp"> <Filter>JRD files</Filter> </ClCompile> + <ClCompile Include="..\..\..\src\jrd\Monitoring.cpp"> + <Filter>JRD files</Filter> + </ClCompile> <ClCompile Include="..\..\..\src\jrd\mov.cpp"> <Filter>JRD files</Filter> </ClCompile> @@ -644,9 +644,6 @@ <ClInclude Include="..\..\..\src\jrd\Database.h"> <Filter>Header files</Filter> </ClInclude> - <ClInclude Include="..\..\..\src\jrd\DatabaseSnapshot.h"> - <Filter>Header files</Filter> - </ClInclude> <ClInclude Include="..\..\..\src\jrd\DataTypeUtil.h"> <Filter>Header files</Filter> </ClInclude> Modified: firebird/trunk/builds/win32/msvc8/engine.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc8/engine.vcproj 2014-07-31 08:56:53 UTC (rev 59940) +++ firebird/trunk/builds/win32/msvc8/engine.vcproj 2014-07-31 09:01:38 UTC (rev 59941) @@ -376,10 +376,6 @@ > </File> <File - RelativePath="..\..\..\src\jrd\DatabaseSnapshot.cpp" - > - </File> - <File RelativePath="..\..\..\src\jrd\DataTypeUtil.cpp" > </File> @@ -468,6 +464,10 @@ > </File> <File + RelativePath="..\..\..\src\jrd\Monitoring.cpp" + > + </File> + <File RelativePath="..\..\..\src\jrd\nbak.cpp" > </File> @@ -948,10 +948,6 @@ > </File> <File - RelativePath="..\..\..\src\jrd\DatabaseSnapshot.h" - > - </File> - <File RelativePath="..\..\..\src\jrd\DataTypeUtil.h" > </File> Modified: firebird/trunk/builds/win32/msvc9/engine.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/engine.vcproj 2014-07-31 08:56:53 UTC (rev 59940) +++ firebird/trunk/builds/win32/msvc9/engine.vcproj 2014-07-31 09:01:38 UTC (rev 59941) @@ -376,10 +376,6 @@ > </File> <File - RelativePath="..\..\..\src\jrd\DatabaseSnapshot.cpp" - > - </File> - <File RelativePath="..\..\..\src\jrd\DataTypeUtil.cpp" > </File> @@ -468,6 +464,10 @@ > </File> <File + RelativePath="..\..\..\src\jrd\Monitoring.cpp" + > + </File> + <File RelativePath="..\..\..\src\jrd\nbak.cpp" > </File> @@ -948,10 +948,6 @@ > </File> <File - RelativePath="..\..\..\src\jrd\DatabaseSnapshot.h" - > - </File> - <File RelativePath="..\..\..\src\jrd\DataTypeUtil.h" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2014-07-31 08:56:58
|
Revision: 59940 http://sourceforge.net/p/firebird/code/59940 Author: dimitr Date: 2014-07-31 08:56:53 +0000 (Thu, 31 Jul 2014) Log Message: ----------- Refactored database monitoring, made its handling attachment bound. This should make deadlocks impossible, as well as avoid blocking worker connections while the monitoring request is processed. Modified Paths: -------------- firebird/trunk/src/jrd/Attachment.cpp firebird/trunk/src/jrd/Attachment.h firebird/trunk/src/jrd/Database.h firebird/trunk/src/jrd/Mapping.cpp firebird/trunk/src/jrd/Mapping.h firebird/trunk/src/jrd/UserManagement.cpp firebird/trunk/src/jrd/UserManagement.h firebird/trunk/src/jrd/VirtualTable.cpp firebird/trunk/src/jrd/cch.cpp firebird/trunk/src/jrd/jrd.cpp firebird/trunk/src/jrd/lck.cpp firebird/trunk/src/jrd/opt.cpp firebird/trunk/src/jrd/pag.cpp firebird/trunk/src/jrd/sdw.cpp firebird/trunk/src/jrd/tra.cpp firebird/trunk/src/jrd/tra.h firebird/trunk/src/jrd/vio.cpp Added Paths: ----------- firebird/trunk/src/jrd/Monitoring.cpp firebird/trunk/src/jrd/Monitoring.h Removed Paths: ------------- firebird/trunk/src/jrd/DatabaseSnapshot.cpp firebird/trunk/src/jrd/DatabaseSnapshot.h Modified: firebird/trunk/src/jrd/Attachment.cpp =================================================================== --- firebird/trunk/src/jrd/Attachment.cpp 2014-07-31 08:29:57 UTC (rev 59939) +++ firebird/trunk/src/jrd/Attachment.cpp 2014-07-31 08:56:53 UTC (rev 59940) @@ -42,6 +42,7 @@ #include "../common/classes/fb_string.h" #include "../common/classes/MetaName.h" #include "../common/StatusArg.h" +#include "../common/isc_proto.h" using namespace Jrd; @@ -217,10 +218,10 @@ // For normal attachments that happens in release_attachment(), // but for special ones like GC should be done also in dtor - // they do not (and should not) call release_attachment(). - // It's no danger calling detachLocksFromAttachment() + // It's no danger calling detachLocks() // once more here because it nulls att_long_locks. // AP 2007 - detachLocksFromAttachment(); + detachLocks(); } @@ -378,34 +379,6 @@ } -void Jrd::Attachment::detachLocksFromAttachment() -{ -/************************************** - * - * d e t a c h L o c k s F r o m A t t a c h m e n t - * - ************************************** - * - * Functional description - * Bug #7781, need to null out the attachment pointer of all locks which - * were hung off this attachment block, to ensure that the attachment - * block doesn't get dereferenced after it is released - * - **************************************/ - if (!att_long_locks) - return; - - Sync lckSync(&att_database->dbb_lck_sync, "Attachment::detachLocksFromAttachment"); - lckSync.lock(SYNC_EXCLUSIVE); - - Lock* long_lock = att_long_locks; - while (long_lock) - { - long_lock = long_lock->detach(); - } - att_long_locks = NULL; -} - // Find an inactive incarnation of a system request. If necessary, clone it. jrd_req* Jrd::Attachment::findSystemRequest(thread_db* tdbb, USHORT id, USHORT which) { @@ -443,6 +416,37 @@ } } +void Jrd::Attachment::initLocks(thread_db* tdbb) +{ + // Take out lock on attachment id + + const lock_ast_t ast = (att_flags & ATT_system) ? NULL : blockingAstShutdown; + + Lock* lock = FB_NEW_RPT(*att_pool, sizeof(SLONG)) + Lock(tdbb, sizeof(SLONG), LCK_attachment, this, ast); + att_id_lock = lock; + lock->lck_key.lck_long = lock->lck_data = att_attachment_id; + LCK_lock(tdbb, lock, LCK_EX, LCK_WAIT); + + // Allocate and take the monitoring lock + + lock = FB_NEW_RPT(*att_pool, sizeof(SLONG)) + Lock(tdbb, sizeof(SLONG), LCK_monitor, this, blockingAstMonitor); + att_monitor_lock = lock; + lock->lck_key.lck_long = att_attachment_id; + LCK_lock(tdbb, lock, LCK_SR, LCK_WAIT); + + // Unless we're a system attachment, allocate the cancellation lock + + if (!(att_flags & ATT_system)) + { + lock = FB_NEW_RPT(*att_pool, sizeof(SLONG)) + Lock(tdbb, sizeof(SLONG), LCK_cancel, this, blockingAstCancel); + att_cancel_lock = lock; + lock->lck_key.lck_long = att_attachment_id; + } +} + void Jrd::Attachment::releaseLocks(thread_db* tdbb) { // Go through relations and indices and release @@ -532,9 +536,7 @@ DSqlCache::Accessor accessor(&att_dsql_cache); for (bool getResult = accessor.getFirst(); getResult; getResult = accessor.getNext()) - { LCK_release(tdbb, accessor.current()->second.lock); - } // Release the remaining locks @@ -544,6 +546,9 @@ if (att_cancel_lock) LCK_release(tdbb, att_cancel_lock); + if (att_monitor_lock) + LCK_release(tdbb, att_monitor_lock); + if (att_temp_pg_lock) LCK_release(tdbb, att_temp_pg_lock); @@ -562,6 +567,101 @@ } } +void Jrd::Attachment::detachLocks() +{ +/************************************** + * + * d e t a c h L o c k s + * + ************************************** + * + * Functional description + * Bug #7781, need to null out the attachment pointer of all locks which + * were hung off this attachment block, to ensure that the attachment + * block doesn't get dereferenced after it is released + * + **************************************/ + if (!att_long_locks) + return; + + Sync lckSync(&att_database->dbb_lck_sync, "Attachment::detachLocks"); + lckSync.lock(SYNC_EXCLUSIVE); + + Lock* long_lock = att_long_locks; + while (long_lock) + long_lock = long_lock->detach(); + + att_long_locks = NULL; +} + +int Jrd::Attachment::blockingAstShutdown(void* ast_object) +{ + Jrd::Attachment* const attachment = static_cast<Jrd::Attachment*>(ast_object); + + try + { + Database* const dbb = attachment->att_database; + + AsyncContextHolder tdbb(dbb, FB_FUNCTION, attachment->att_id_lock); + + attachment->signalShutdown(); + + JRD_shutdown_attachments(dbb); + } + catch (const Exception&) + {} // no-op + + return 0; +} + +int Jrd::Attachment::blockingAstCancel(void* ast_object) +{ + Jrd::Attachment* const attachment = static_cast<Jrd::Attachment*>(ast_object); + + try + { + Database* const dbb = attachment->att_database; + + AsyncContextHolder tdbb(dbb, FB_FUNCTION, attachment->att_cancel_lock); + + attachment->signalCancel(); + + LCK_release(tdbb, attachment->att_cancel_lock); + } + catch (const Exception&) + {} // no-op + + return 0; +} + +int Jrd::Attachment::blockingAstMonitor(void* ast_object) +{ + Jrd::Attachment* const attachment = static_cast<Jrd::Attachment*>(ast_object); + + try + { + Database* const dbb = attachment->att_database; + + AsyncContextHolder tdbb(dbb, FB_FUNCTION, attachment->att_monitor_lock); + + try + { + Monitoring::dumpAttachment(tdbb, attachment, true); + } + catch (const Exception& ex) + { + iscLogException("Cannot dump the monitoring data", ex); + } + + LCK_release(tdbb, attachment->att_monitor_lock); + attachment->att_flags |= ATT_monitor_off; + } + catch (const Exception&) + {} // no-op + + return 0; +} + void Jrd::Attachment::SyncGuard::init(const char* f, bool #ifdef DEV_BUILD optional Modified: firebird/trunk/src/jrd/Attachment.h =================================================================== --- firebird/trunk/src/jrd/Attachment.h 2014-07-31 08:29:57 UTC (rev 59939) +++ firebird/trunk/src/jrd/Attachment.h 2014-07-31 08:56:53 UTC (rev 59940) @@ -328,6 +328,7 @@ Lock* att_id_lock; // Attachment lock (if any) SLONG att_attachment_id; // Attachment ID Lock* att_cancel_lock; // Lock to cancel the active request + Lock* att_monitor_lock; // Lock for monitoring purposes const ULONG att_lock_owner_id; // ID for the lock manager SLONG att_lock_owner_handle; // Handle for the lock manager ULONG att_backup_state_counter; // Counter of backup state locks for attachment @@ -392,8 +393,14 @@ void releaseIntlObjects(thread_db* tdbb); // defined in intl.cpp void destroyIntlObjects(thread_db* tdbb); // defined in intl.cpp + void initLocks(thread_db* tdbb); void releaseLocks(thread_db* tdbb); + void detachLocks(); + static int blockingAstShutdown(void*); + static int blockingAstCancel(void*); + static int blockingAstMonitor(void*); + Firebird::Array<MemoryPool*> att_pools; // pools MemoryPool* createPool(); @@ -431,8 +438,6 @@ void signalCancel(); void signalShutdown(); - void detachLocksFromAttachment(); - bool backupStateWriteLock(thread_db* tdbb, SSHORT wait); void backupStateWriteUnLock(thread_db* tdbb); bool backupStateReadLock(thread_db* tdbb, SSHORT wait); @@ -474,6 +479,7 @@ const ULONG ATT_purge_started = 0x02000L; // Purge already started - avoid 2 purges at once const ULONG ATT_system = 0x04000L; // Special system attachment const ULONG ATT_creator = 0x08000L; // This attachment created the DB. +const ULONG ATT_monitor_off = 0x10000L; // Monitoring lock is released const ULONG ATT_NO_CLEANUP = (ATT_no_cleanup | ATT_notify_gc); Modified: firebird/trunk/src/jrd/Database.h =================================================================== --- firebird/trunk/src/jrd/Database.h 2014-07-31 08:29:57 UTC (rev 59939) +++ firebird/trunk/src/jrd/Database.h 2014-07-31 08:56:53 UTC (rev 59940) @@ -228,7 +228,6 @@ const ULONG DBB_shut_force = 0x40L; // forced shutdown in progress const ULONG DBB_shutdown_full = 0x80L; // Database fully shut down const ULONG DBB_shutdown_single = 0x100L; // Database is in single-user maintenance mode -const ULONG DBB_monitor_off = 0x200L; // Database has the monitoring lock released class Database : public pool_alloc<type_dbb> { @@ -370,7 +369,6 @@ Attachment* dbb_attachments; // Active attachments Attachment* dbb_sys_attachments; // System attachments BufferControl* dbb_bcb; // Buffer control block - int dbb_monitoring_id; // dbb monitoring identifier Lock* dbb_lock; // database lock Lock* dbb_sweep_lock; // sweep lock @@ -381,13 +379,11 @@ Lock* dbb_shadow_lock; // lock for synchronizing addition of shadows Lock* dbb_retaining_lock; // lock for preserving commit retaining snapshot - Lock* dbb_monitor_lock; // lock for monitoring purposes PageManager dbb_page_manager; vcl* dbb_t_pages; // pages number for transactions vcl* dbb_gen_id_pages; // known pages for gen_id BlobFilter* dbb_blob_filters; // known blob filters - Firebird::SyncObject dbb_mon_sync; // synchronize operations with dbb_monitor_lock MonitoringData* dbb_monitoring_data; // monitoring data DatabaseModules dbb_modules; // external function/filter modules Deleted: firebird/trunk/src/jrd/DatabaseSnapshot.cpp =================================================================== --- firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2014-07-31 08:29:57 UTC (rev 59939) +++ firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2014-07-31 08:56:53 UTC (rev 59940) @@ -1,1360 +0,0 @@ -/* - * The contents of this file are subject to the Initial - * Developer's Public License Version 1.0 (the "License"); - * you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl. - * - * Software distributed under the License is distributed AS IS, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. - * See the License for the specific language governing rights - * and limitations under the License. - * - * The Original Code was created by Dmitry Yemanov - * for the Firebird Open Source RDBMS project. - * - * Copyright (c) 2006 Dmitry Yemanov <di...@us...> - * and all contributors signed below. - * - * All Rights Reserved. - * Contributor(s): ______________________________________. - */ - -#include "firebird.h" -#include "ids.h" - -#include "../common/classes/auto.h" -#include "../common/classes/locks.h" -#include "../common/classes/fb_string.h" - -#include "../common/gdsassert.h" -#include "../jrd/jrd.h" -#include "../jrd/cch.h" -#include "../jrd/ini.h" -#include "../jrd/nbak.h" -#include "../common/os/guid.h" -#include "../jrd/os/pio.h" -#include "../jrd/req.h" -#include "../jrd/tra.h" -#include "../jrd/blb_proto.h" -#include "../common/isc_proto.h" -#include "../common/isc_f_proto.h" -#include "../common/isc_s_proto.h" -#include "../jrd/lck_proto.h" -#include "../jrd/met_proto.h" -#include "../jrd/mov_proto.h" -#include "../jrd/opt_proto.h" -#include "../jrd/os/pio_proto.h" -#include "../jrd/pag_proto.h" -#include "../jrd/thread_proto.h" -#include "../jrd/CryptoManager.h" - -#include "../jrd/Relation.h" -#include "../jrd/RecordBuffer.h" -#include "../jrd/DatabaseSnapshot.h" -#include "../jrd/Function.h" - -#include "../common/utils_proto.h" - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -#ifdef UNIX -#include <signal.h> -#endif - -#ifdef WIN_NT -#include <process.h> -#include <windows.h> -#endif - - -using namespace Firebird; -using namespace Jrd; - - -const Format* MonitoringTableScan::getFormat(thread_db* tdbb, jrd_rel* relation) const -{ - DatabaseSnapshot* const snapshot = DatabaseSnapshot::create(tdbb); - return snapshot->getData(relation)->getFormat(); -} - - -bool MonitoringTableScan::retrieveRecord(thread_db* tdbb, jrd_rel* relation, - FB_UINT64 position, Record* record) const -{ - DatabaseSnapshot* const snapshot = DatabaseSnapshot::create(tdbb); - return snapshot->getData(relation)->fetch(position, record); -} - - -// MonitoringData class - -MonitoringData::MonitoringData(const Database* dbb) - : process_id(getpid()), local_id(dbb->dbb_monitoring_id) -{ - string name; - name.printf(MONITOR_FILE, dbb->getUniqueFileId().c_str()); - - Arg::StatusVector statusVector; - try - { - shared_memory.reset(FB_NEW(*dbb->dbb_permanent) SharedMemory<MonitoringHeader>( - name.c_str(), DEFAULT_SIZE, this)); - } - catch (const Exception& ex) - { - iscLogException("MonitoringData: Cannot initialize the shared memory region", ex); - throw; - } - - fb_assert(shared_memory->getHeader()->mhb_version == MONITOR_VERSION); -} - - -MonitoringData::~MonitoringData() -{ - Guard guard(this); - cleanup(); - - if (shared_memory->getHeader()->used == sizeof(Header)) - shared_memory->removeMapFile(); -} - - -void MonitoringData::acquire() -{ - shared_memory->mutexLock(); - - if (shared_memory->getHeader()->allocated > shared_memory->sh_mem_length_mapped) - { -#ifdef HAVE_OBJECT_MAP - Arg::StatusVector statusVector; - shared_memory->remapFile(statusVector, shared_memory->getHeader()->allocated, false); - if (!shared_memory->remapFile(statusVector, shared_memory->getHeader()->allocated, false)) - { - status_exception::raise(statusVector); - } -#else - status_exception::raise(Arg::Gds(isc_montabexh)); -#endif - } -} - - -void MonitoringData::release() -{ - shared_memory->mutexUnlock(); -} - - -UCHAR* MonitoringData::read(MemoryPool& pool, ULONG& resultSize) -{ - ULONG self_dbb_offset = 0; - - // Garbage collect elements belonging to dead processes. - // This is done in two passes. First, we compact the data - // and calculate the total size of the resulting data. - // Second, we create a resulting buffer of the necessary size - // and copy the data there, starting with our own dbb. - - // First pass - for (ULONG offset = alignOffset(sizeof(Header)); offset < shared_memory->getHeader()->used;) - { - UCHAR* const ptr = (UCHAR*) shared_memory->getHeader() + offset; - const Element* const element = (Element*) ptr; - const ULONG length = alignOffset(sizeof(Element) + element->length); - - if (element->processId == process_id && element->localId == local_id) - { - self_dbb_offset = offset; - } - - if (ISC_check_process_existence(element->processId)) - { - resultSize += element->length; - offset += length; - } - else - { - fb_assert(shared_memory->getHeader()->used >= offset + length); - memmove(ptr, ptr + length, shared_memory->getHeader()->used - offset - length); - shared_memory->getHeader()->used -= length; - } - } - - // Second pass - UCHAR* const buffer = FB_NEW(pool) UCHAR[resultSize]; - UCHAR* bufferPtr(buffer); - - fb_assert(self_dbb_offset); - - UCHAR* const ptr = (UCHAR*) shared_memory->getHeader() + self_dbb_offset; - const Element* const element = (Element*) ptr; - memcpy(bufferPtr, ptr + sizeof(Element), element->length); - bufferPtr += element->length; - - for (ULONG offset = alignOffset(sizeof(Header)); offset < shared_memory->getHeader()->used;) - { - UCHAR* const ptr = (UCHAR*) shared_memory->getHeader() + offset; - const Element* const element = (Element*) ptr; - const ULONG length = alignOffset(sizeof(Element) + element->length); - - if (offset != self_dbb_offset) - { - memcpy(bufferPtr, ptr + sizeof(Element), element->length); - bufferPtr += element->length; - } - - offset += length; - } - - fb_assert(buffer + resultSize == bufferPtr); - return buffer; -} - - -ULONG MonitoringData::setup() -{ - ensureSpace(sizeof(Element)); - - // Put an up-to-date element at the tail - const ULONG offset = shared_memory->getHeader()->used; - UCHAR* const ptr = (UCHAR*) shared_memory->getHeader() + offset; - Element* const element = (Element*) ptr; - element->processId = process_id; - element->localId = local_id; - element->length = 0; - shared_memory->getHeader()->used += alignOffset(sizeof(Element)); - return offset; -} - - -void MonitoringData::write(ULONG offset, ULONG length, const void* buffer) -{ - ensureSpace(length); - - // Put an up-to-date element at the tail - UCHAR* const ptr = (UCHAR*) shared_memory->getHeader() + offset; - Element* const element = (Element*) ptr; - memcpy(ptr + sizeof(Element) + element->length, buffer, length); - ULONG previous = alignOffset(sizeof(Element) + element->length); - element->length += length; - ULONG current = alignOffset(sizeof(Element) + element->length); - shared_memory->getHeader()->used += (current - previous); -} - - -void MonitoringData::cleanup() -{ - // Remove information about our dbb - for (ULONG offset = alignOffset(sizeof(Header)); offset < shared_memory->getHeader()->used;) - { - UCHAR* const ptr = (UCHAR*) shared_memory->getHeader() + offset; - const Element* const element = (Element*) ptr; - const ULONG length = alignOffset(sizeof(Element) + element->length); - - if (element->processId == process_id && element->localId == local_id) - { - fb_assert(shared_memory->getHeader()->used >= offset + length); - memmove(ptr, ptr + length, shared_memory->getHeader()->used - offset - length); - shared_memory->getHeader()->used -= length; - } - else - { - offset += length; - } - } -} - - -void MonitoringData::ensureSpace(ULONG length) -{ - ULONG newSize = shared_memory->getHeader()->used + length; - - if (newSize > shared_memory->getHeader()->allocated) - { - newSize = FB_ALIGN(newSize, DEFAULT_SIZE); - -#ifdef HAVE_OBJECT_MAP - Arg::StatusVector statusVector; - if (!shared_memory->remapFile(statusVector, newSize, true)) - { - status_exception::raise(statusVector); - } - shared_memory->getHeader()->allocated = shared_memory->sh_mem_length_mapped; -#else - status_exception::raise(Arg::Gds(isc_montabexh)); -#endif - } -} - - -void MonitoringData::mutexBug(int osErrorCode, const char* s) -{ - string msg; - msg.printf("MONITOR: mutex %s error, status = %d", s, osErrorCode); - fb_utils::logAndDie(msg.c_str()); -} - - -bool MonitoringData::initialize(SharedMemoryBase* sm, bool initialize) -{ - if (initialize) - { - MonitoringHeader* header = reinterpret_cast<MonitoringHeader*>(sm->sh_mem_header); - - // Initialize the shared data header - header->mhb_type = SharedMemoryBase::SRAM_DATABASE_SNAPSHOT; - header->mhb_version = MONITOR_VERSION; - header->mhb_timestamp = TimeStamp::getCurrentTimeStamp().value(); - - header->used = alignOffset(sizeof(Header)); - header->allocated = sm->sh_mem_length_mapped; - } - - return true; -} - - -ULONG MonitoringData::alignOffset(ULONG unaligned) -{ - return (ULONG) Firebird::MEM_ALIGN(unaligned); -} - - -// DatabaseSnapshot class - - -DatabaseSnapshot* DatabaseSnapshot::create(thread_db* tdbb) -{ - SET_TDBB(tdbb); - - jrd_tra* transaction = tdbb->getTransaction(); - fb_assert(transaction); - - if (!transaction->tra_db_snapshot) - { - // Create a database snapshot and store it - // in the transaction block - MemoryPool& pool = *transaction->tra_pool; - transaction->tra_db_snapshot = FB_NEW(pool) DatabaseSnapshot(tdbb, pool); - } - - return transaction->tra_db_snapshot; -} - - -int DatabaseSnapshot::blockingAst(void* ast_object) -{ - Database* dbb = static_cast<Database*>(ast_object); - - try - { - Lock* const lock = dbb->dbb_monitor_lock; - - if (!(dbb->dbb_ast_flags & DBB_monitor_off)) - { - SyncLockGuard monGuard(&dbb->dbb_mon_sync, SYNC_EXCLUSIVE, FB_FUNCTION); - - if (!(dbb->dbb_ast_flags & DBB_monitor_off)) - { - AsyncContextHolder tdbb(dbb, FB_FUNCTION); - - // Write the data to the shared memory - try - { - dumpData(tdbb, backup_state_unknown); - } - catch (const Exception& ex) - { - iscLogException("Cannot dump the monitoring data", ex); - } - - // Release the lock and mark dbb as requesting a new one - LCK_release(tdbb, lock); - dbb->dbb_ast_flags |= DBB_monitor_off; - } - } - } - catch (const Exception&) - {} // no-op - - return 0; -} - - -void DatabaseSnapshot::initialize(thread_db* tdbb) -{ - SET_TDBB(tdbb); - Database* const dbb = tdbb->getDatabase(); - fb_assert(dbb); - - if (!dbb->dbb_monitor_lock) - { - dbb->dbb_monitor_lock = FB_NEW_RPT(*dbb->dbb_permanent, 0) - Lock(tdbb, 0, LCK_monitor, dbb, DatabaseSnapshot::blockingAst); - LCK_lock(tdbb, dbb->dbb_monitor_lock, LCK_SR, LCK_WAIT); - } -} - - -void DatabaseSnapshot::shutdown(thread_db* tdbb) -{ - SET_TDBB(tdbb); - Database* const dbb = tdbb->getDatabase(); - fb_assert(dbb); - - if (dbb->dbb_monitor_lock) - LCK_release(tdbb, dbb->dbb_monitor_lock); -} - - -void DatabaseSnapshot::activate(thread_db* tdbb) -{ - SET_TDBB(tdbb); - Database* const dbb = tdbb->getDatabase(); - fb_assert(dbb); - Jrd::Attachment* const attachment = tdbb->getAttachment(); - fb_assert(attachment); - - if (dbb->dbb_ast_flags & DBB_monitor_off) - { - // Enable signal handler for the monitoring stuff - - Attachment::CheckoutSyncGuard monGuard(attachment, dbb->dbb_mon_sync, - SYNC_EXCLUSIVE, FB_FUNCTION); - - if (dbb->dbb_ast_flags & DBB_monitor_off) - { - dbb->dbb_ast_flags &= ~DBB_monitor_off; - LCK_lock(tdbb, dbb->dbb_monitor_lock, LCK_SR, LCK_WAIT); - - fb_assert(!(dbb->dbb_ast_flags & DBB_monitor_off)); - - // While waiting for return from LCK_lock call above, the blocking AST (see - // DatabaseSnapshot::blockingAst) was called and set DBB_monitor_off flag - // again. But it do not released lock as lck_id was unknown at that moment. - // Do it now to not block another process waiting for a monitoring lock. - - if (dbb->dbb_ast_flags & DBB_monitor_off) - LCK_release(tdbb, dbb->dbb_monitor_lock); - } - } -} - - -DatabaseSnapshot::DatabaseSnapshot(thread_db* tdbb, MemoryPool& pool) - : DataDump(pool) -{ - SET_TDBB(tdbb); - - PAG_header(tdbb, true); - - Database* const dbb = tdbb->getDatabase(); - fb_assert(dbb); - - Attachment* const attachment = tdbb->getAttachment(); - fb_assert(attachment); - - // Initialize record buffers - RecordBuffer* const dbb_buffer = allocBuffer(tdbb, pool, rel_mon_database); - RecordBuffer* const att_buffer = allocBuffer(tdbb, pool, rel_mon_attachments); - RecordBuffer* const tra_buffer = allocBuffer(tdbb, pool, rel_mon_transactions); - RecordBuffer* const stmt_buffer = allocBuffer(tdbb, pool, rel_mon_statements); - RecordBuffer* const call_buffer = allocBuffer(tdbb, pool, rel_mon_calls); - RecordBuffer* const io_stat_buffer = allocBuffer(tdbb, pool, rel_mon_io_stats); - RecordBuffer* const rec_stat_buffer = allocBuffer(tdbb, pool, rel_mon_rec_stats); - RecordBuffer* const ctx_var_buffer = allocBuffer(tdbb, pool, rel_mon_ctx_vars); - RecordBuffer* const mem_usage_buffer = allocBuffer(tdbb, pool, rel_mon_mem_usage); - - // Determine the backup state - int backup_state = backup_state_unknown; - - BackupManager* const bm = dbb->dbb_backup_manager; - if (bm && !bm->isShutDown()) - { - BackupManager::StateReadGuard holder(tdbb); - - switch (bm->getState()) - { - case nbak_state_normal: - backup_state = backup_state_normal; - break; - case nbak_state_stalled: - backup_state = backup_state_stalled; - break; - case nbak_state_merge: - backup_state = backup_state_merge; - break; - } - } - - try - { - Attachment::Checkout cout(attachment, FB_FUNCTION); - SyncLockGuard monGuard(&dbb->dbb_mon_sync, SYNC_EXCLUSIVE, FB_FUNCTION); - - // Release our own lock - LCK_release(tdbb, dbb->dbb_monitor_lock); - dbb->dbb_ast_flags &= ~DBB_monitor_off; - - // Dump our own data - dumpData(tdbb, backup_state); - } - // Restore attachment in tdbb, probably changed inside dumpData - catch (const Exception&) - { - tdbb->setAttachment(attachment); - throw; - } - tdbb->setAttachment(attachment); - - // Signal other processes to dump their data - Lock temp_lock(tdbb, 0, LCK_monitor), *lock = &temp_lock; - - if (LCK_lock(tdbb, lock, LCK_EX, LCK_WAIT)) - LCK_release(tdbb, lock); - - { // scope - Attachment::CheckoutSyncGuard monGuard(attachment, dbb->dbb_mon_sync, - SYNC_EXCLUSIVE, FB_FUNCTION); - // Mark dbb as requesting a new lock - dbb->dbb_ast_flags |= DBB_monitor_off; - } - - // Read the shared memory - ULONG dataSize = 0; - UCHAR* dataPtr = NULL; - - { // scope - fb_assert(dbb->dbb_monitoring_data); - MonitoringData::Guard guard(dbb->dbb_monitoring_data); - dataPtr = dbb->dbb_monitoring_data->read(pool, dataSize); - } - - fb_assert(dataSize && dataPtr); - AutoPtr<UCHAR, ArrayDelete<UCHAR> > data(dataPtr); - - Reader reader(dataSize, data); - - string databaseName(dbb->dbb_database_name.c_str()); - ISC_systemToUtf8(databaseName); - - const string& userName = attachment->att_user->usr_user_name; - const bool locksmith = attachment->locksmith(); - - // Parse the dump - RecordBuffer* buffer = NULL; - Record* record = NULL; - - bool dbb_processed = false, fields_processed = false; - bool dbb_allowed = false, att_allowed = false; - - DumpRecord dumpRecord(*tdbb->getDefaultPool()); - while (reader.getRecord(dumpRecord)) - { - const int rid = dumpRecord.getRelationId(); - - switch (rid) - { - case rel_mon_database: - buffer = dbb_buffer; - break; - case rel_mon_attachments: - buffer = att_buffer; - break; - case rel_mon_transactions: - buffer = tra_buffer; - break; - case rel_mon_statements: - buffer = stmt_buffer; - break; - case rel_mon_calls: - buffer = call_buffer; - break; - case rel_mon_io_stats: - buffer = io_stat_buffer; - break; - case rel_mon_rec_stats: - buffer = rec_stat_buffer; - break; - case rel_mon_ctx_vars: - buffer = ctx_var_buffer; - break; - case rel_mon_mem_usage: - buffer = mem_usage_buffer; - break; - default: - fb_assert(false); - } - - if (buffer) - { - record = buffer->getTempRecord(); - record->nullify(); - } - else - { - record = NULL; - } - - DumpField dumpField; - while (dumpRecord.getField(dumpField)) - { - const USHORT fid = dumpField.id; - const FB_SIZE_T length = dumpField.length; - const char* source = (const char*) dumpField.data; - - // All the strings that may require transliteration (i.e. the target charset is not NONE) - // are known to be in the metadata charset or ASCII (which is binary compatible). - const int charset = ttype_metadata; - - // special case for MON$DATABASE - if (rid == rel_mon_database) - { - if (fid == f_mon_db_name) - dbb_allowed = !databaseName.compare(source, length); - - if (record && dbb_allowed && !dbb_processed) - { - putField(tdbb, record, dumpField, charset); - fields_processed = true; - } - - att_allowed = (dbb_allowed && !dbb_processed); - } - // special case for MON$ATTACHMENTS - else if (rid == rel_mon_attachments) - { - if (fid == f_mon_att_user) - att_allowed = locksmith || !userName.compare(source, length); - - if (record && dbb_allowed && att_allowed) - { - putField(tdbb, record, dumpField, charset); - fields_processed = true; - dbb_processed = true; - } - } - // generic logic that covers all other relations - else if (record && dbb_allowed && att_allowed) - { - putField(tdbb, record, dumpField, charset); - fields_processed = true; - dbb_processed = true; - } - } - - if (fields_processed) - { - buffer->store(record); - fields_processed = false; - } - } -} - - -void DataDump::clearSnapshot() -{ - for (FB_SIZE_T i = 0; i < snapshot.getCount(); i++) - delete snapshot[i].data; - snapshot.clear(); -} - - -RecordBuffer* DataDump::getData(const jrd_rel* relation) const -{ - fb_assert(relation); - - return getData(relation->rel_id); -} - - -RecordBuffer* DataDump::getData(int id) const -{ - for (FB_SIZE_T i = 0; i < snapshot.getCount(); i++) - { - if (snapshot[i].rel_id == id) - return snapshot[i].data; - } - - return NULL; -} - - -RecordBuffer* DataDump::allocBuffer(thread_db* tdbb, MemoryPool& pool, int rel_id) -{ - jrd_rel* const relation = MET_lookup_relation_id(tdbb, rel_id, false); - fb_assert(relation); - MET_scan_relation(tdbb, relation); - fb_assert(relation->isVirtual()); - - const Format* const format = MET_current(tdbb, relation); - fb_assert(format); - - RecordBuffer* const buffer = FB_NEW(pool) RecordBuffer(pool, format); - RelationData data = {relation->rel_id, buffer}; - snapshot.add(data); - - return buffer; -} - - -void DataDump::putField(thread_db* tdbb, Record* record, const DumpField& field, int charset) -{ - fb_assert(record); - - const Format* const format = record->rec_format; - fb_assert(format); - - dsc to_desc; - - if (field.id < format->fmt_count) - to_desc = format->fmt_desc[field.id]; - - if (to_desc.isUnknown()) - return; - - to_desc.dsc_address += (IPTR) record->rec_data; - - if (field.type == VALUE_GLOBAL_ID) - { - // special case: translate 64-bit global ID into 32-bit local ID - fb_assert(field.length == sizeof(SINT64)); - SINT64 global_id; - memcpy(&global_id, field.data, field.length); - SLONG local_id; - if (!idMap.get(global_id, local_id)) - { - local_id = ++idCounter; - idMap.put(global_id, local_id); - } - dsc from_desc; - from_desc.makeLong(0, &local_id); - MOV_move(tdbb, &from_desc, &to_desc); - } - else if (field.type == VALUE_INTEGER) - { - fb_assert(field.length == sizeof(SINT64)); - SINT64 value; - memcpy(&value, field.data, field.length); - dsc from_desc; - from_desc.makeInt64(0, &value); - MOV_move(tdbb, &from_desc, &to_desc); - } - else if (field.type == VALUE_TIMESTAMP) - { - fb_assert(field.length == sizeof(ISC_TIMESTAMP)); - ISC_TIMESTAMP value; - memcpy(&value, field.data, field.length); - dsc from_desc; - from_desc.makeTimestamp(&value); - MOV_move(tdbb, &from_desc, &to_desc); - } - else if (field.type == VALUE_STRING) - { - dsc from_desc; - MoveBuffer buffer; - - if (charset == CS_NONE && to_desc.getCharSet() == CS_METADATA) - { - // ASF: If an attachment using NONE charset has a string using non-ASCII characters, - // nobody will be able to select them in a system field. So we change these characters to - // question marks here - CORE-2602. - - UCHAR* p = buffer.getBuffer(field.length); - const UCHAR* s = (const UCHAR*) field.data; - - for (const UCHAR* end = buffer.end(); p < end; ++p, ++s) - *p = (*s > 0x7F ? '?' : *s); - - from_desc.makeText(field.length, CS_ASCII, buffer.begin()); - } - else - from_desc.makeText(field.length, charset, (UCHAR*) field.data); - - MOV_move(tdbb, &from_desc, &to_desc); - } - else if (field.type == VALUE_BOOLEAN) - { - fb_assert(field.length == sizeof(UCHAR)); - UCHAR value; - memcpy(&value, field.data, field.length); - dsc from_desc; - from_desc.makeBoolean(&value); - MOV_move(tdbb, &from_desc, &to_desc); - } - else - { - fb_assert(false); - } - - // hvlad: detach just created temporary blob from request to bound its - // lifetime to transaction. This is necessary as this blob belongs to - // the MON$ table and must be accessible until transaction ends. - if (to_desc.isBlob()) - { - bid* blob_id = reinterpret_cast<bid*>(to_desc.dsc_address); - jrd_tra* tran = tdbb->getTransaction(); - - if (!tran->tra_blobs->locate(blob_id->bid_temp_id())) - fb_assert(false); - - BlobIndex& blobIdx = tran->tra_blobs->current(); - fb_assert(!blobIdx.bli_materialized); - - if (blobIdx.bli_request) - { - if (!blobIdx.bli_request->req_blobs.locate(blobIdx.bli_temp_id)) - fb_assert(false); - - blobIdx.bli_request->req_blobs.fastRemove(); - blobIdx.bli_request = NULL; - } - } - - record->clearNull(field.id); -} - - -void DatabaseSnapshot::dumpData(thread_db* tdbb, int backup_state) -{ - Database* const dbb = tdbb->getDatabase(); - MemoryPool& pool = *dbb->dbb_permanent; - - if (!dbb->dbb_monitoring_data) - dbb->dbb_monitoring_data = FB_NEW(pool) MonitoringData(dbb); - - MonitoringData::Guard guard(dbb->dbb_monitoring_data); - dbb->dbb_monitoring_data->cleanup(); - - Writer writer(dbb->dbb_monitoring_data); - DumpRecord record(pool); - - // Database information - - putDatabase(record, dbb, writer, fb_utils::genUniqueId(), backup_state); - - // Attachment information - - AttachmentsRefHolder attachments(pool); - - { // scope - SyncLockGuard attGuard(&dbb->dbb_sync, SYNC_SHARED, FB_FUNCTION); - - for (Attachment* attachment = dbb->dbb_attachments; attachment; - attachment = attachment->att_next) - { - attachments.add(attachment->getStable()); - } - } - - { // scope - SyncLockGuard sysAttGuard(&dbb->dbb_sys_attach, SYNC_SHARED, FB_FUNCTION); - - for (Attachment* attachment = dbb->dbb_sys_attachments; attachment; - attachment = attachment->att_next) - { - attachments.add(attachment->getStable()); - } - } - - for (AttachmentsRefHolder::Iterator iter(attachments); *iter; ) - { - { // scope - StableAttachmentPart* const jAtt = *iter; - MutexLockGuard guard(*jAtt->getMutex(), FB_FUNCTION); - - Attachment* const attachment = jAtt->getHandle(); - - if (attachment && attachment->att_user) - { - tdbb->setAttachment(attachment); - dumpAttachment(tdbb, record, attachment, writer); - } - } - - iter.remove(); - } -} - -void DatabaseSnapshot::dumpAttachment(thread_db* tdbb, DumpRecord& record, - const Attachment* attachment, - Writer& writer) -{ - putAttachment(record, attachment, writer, fb_utils::genUniqueId()); - - jrd_tra* transaction = NULL; - - // Transaction information - - for (transaction = attachment->att_transactions; transaction; - transaction = transaction->tra_next) - { - putTransaction(record, transaction, writer, fb_utils::genUniqueId()); - } - - // Call stack information - - for (transaction = attachment->att_transactions; transaction; - transaction = transaction->tra_next) - { - for (jrd_req* request = transaction->tra_requests; - request && (request->req_flags & req_active); - request = request->req_caller) - { - request->adjustCallerStats(); - - if (!(request->getStatement()->flags & - (JrdStatement::FLAG_INTERNAL | JrdStatement::FLAG_SYS_TRIGGER)) && - request->req_caller) - { - putCall(record, request, writer, fb_utils::genUniqueId()); - } - } - } - - // Request information - - for (const jrd_req* const* i = attachment->att_requests.begin(); - i != attachment->att_requests.end(); - ++i) - { - const jrd_req* const request = *i; - - if (!(request->getStatement()->flags & - (JrdStatement::FLAG_INTERNAL | JrdStatement::FLAG_SYS_TRIGGER))) - { - const string plan = OPT_get_plan(tdbb, request, true); - putRequest(record, request, writer, fb_utils::genUniqueId(), plan); - } - } -} - - -SINT64 DatabaseSnapshot::getGlobalId(int value) -{ - return ((SINT64) getpid() << BITS_PER_LONG) + value; -} - - -void DatabaseSnapshot::putDatabase(DumpRecord& record, const Database* database, - Writer& writer, int stat_id, int backup_state) -{ - fb_assert(database); - - record.reset(rel_mon_database); - - PathName databaseName(database->dbb_database_name); - ISC_systemToUtf8(databaseName); - - // database name or alias (MUST BE ALWAYS THE FIRST ITEM PASSED!) - record.storeString(f_mon_db_name, databaseName); - // page size - record.storeInteger(f_mon_db_page_size, database->dbb_page_size); - // major ODS version - record.storeInteger(f_mon_db_ods_major, database->dbb_ods_version); - // minor ODS version - record.storeInteger(f_mon_db_ods_minor, database->dbb_minor_version); - // oldest interesting transaction - record.storeInteger(f_mon_db_oit, database->dbb_oldest_transaction); - // oldest active transaction - record.storeInteger(f_mon_db_oat, database->dbb_oldest_active); - // oldest snapshot transaction - record.storeInteger(f_mon_db_ost, database->dbb_oldest_snapshot); - // next transaction - record.storeInteger(f_mon_db_nt, database->dbb_next_transaction); - // number of page buffers - record.storeInteger(f_mon_db_page_bufs, database->dbb_bcb->bcb_count); - - int temp; - - // SQL dialect - temp = (database->dbb_flags & DBB_DB_SQL_dialect_3) ? 3 : 1; - record.storeInteger(f_mon_db_dialect, temp); - - // shutdown mode - if (database->dbb_ast_flags & DBB_shutdown_full) - temp = shut_mode_full; - else if (database->dbb_ast_flags & DBB_shutdown_single) - temp = shut_mode_single; - else if (database->dbb_ast_flags & DBB_shutdown) - temp = shut_mode_multi; - else - temp = shut_mode_online; - record.storeInteger(f_mon_db_shut_mode, temp); - - // sweep interval - record.storeInteger(f_mon_db_sweep_int, database->dbb_sweep_interval); - // read only flag - temp = database->readOnly() ? 1 : 0; - record.storeInteger(f_mon_db_read_only, temp); - // forced writes flag - temp = (database->dbb_flags & DBB_force_write) ? 1 : 0; - record.storeInteger(f_mon_db_forced_writes, temp); - // reserve space flag - temp = (database->dbb_flags & DBB_no_reserve) ? 0 : 1; - record.storeInteger(f_mon_db_res_space, temp); - // creation date - record.storeTimestamp(f_mon_db_created, database->dbb_creation_date); - // database size - record.storeInteger(f_mon_db_pages, PageSpace::actAlloc(database)); - // database backup state - record.storeInteger(f_mon_db_backup_state, backup_state); - - // crypt thread status - if (database->dbb_crypto_manager) - record.storeInteger(f_mon_db_crypt_page, database->dbb_crypto_manager->getCurrentPage()); - - // database owner - record.storeString(f_mon_db_owner, database->dbb_owner); - - // statistics - record.storeGlobalId(f_mon_db_stat_id, getGlobalId(stat_id)); - writer.putRecord(record); - - if (Config::getSharedCache()) - { - putStatistics(record, database->dbb_stats, writer, stat_id, stat_database); - putMemoryUsage(record, database->dbb_memory_stats, writer, stat_id, stat_database); - } - else - { - RuntimeStatistics zero_rt_stats; - MemoryStats zero_mem_stats; - putStatistics(record, zero_rt_stats, writer, stat_id, stat_database); - putMemoryUsage(record, zero_mem_stats, writer, stat_id, stat_database); - } -} - - -void DatabaseSnapshot::putAttachment(DumpRecord& record, const Jrd::Attachment* attachment, - Writer& writer, int stat_id) -{ - fb_assert(attachment && attachment->att_user); - - record.reset(rel_mon_attachments); - - int temp = mon_state_idle; - - for (const jrd_tra* transaction_itr = attachment->att_transactions; - transaction_itr; transaction_itr = transaction_itr->tra_next) - { - if (transaction_itr->tra_requests) - { - temp = mon_state_active; - break; - } - } - - PathName attName(attachment->att_filename); - ISC_systemToUtf8(attName); - - // user (MUST BE ALWAYS THE FIRST ITEM PASSED!) - record.storeString(f_mon_att_user, attachment->att_user->usr_user_name); - // attachment id - record.storeInteger(f_mon_att_id, attachment->att_attachment_id); - // process id - record.storeInteger(f_mon_att_server_pid, getpid()); - // state - record.storeInteger(f_mon_att_state, temp); - // attachment name - record.storeString(f_mon_att_name, attName); - // role - record.storeString(f_mon_att_role, attachment->att_user->usr_sql_role_name); - // remote protocol - record.storeString(f_mon_att_remote_proto, attachment->att_network_protocol); - // remote address - record.storeString(f_mon_att_remote_addr, attachment->att_remote_address); - // remote process id - if (attachment->att_remote_pid) - { - record.storeInteger(f_mon_att_remote_pid, attachment->att_remote_pid); - } - // remote process name - record.storeString(f_mon_att_remote_process, attachment->att_remote_process); - // charset - record.storeInteger(f_mon_att_charset_id, attachment->att_charset); - // timestamp - record.storeTimestamp(f_mon_att_timestamp, attachment->att_timestamp); - // garbage collection flag - temp = (attachment->att_flags & ATT_no_cleanup) ? 0 : 1; - record.storeInteger(f_mon_att_gc, temp); - // client library version - record.storeString(f_mon_att_client_version, attachment->att_client_version); - // remote protocol version - record.storeString(f_mon_att_remote_version, attachment->att_remote_protocol); - // remote host name - record.storeString(f_mon_att_remote_host, attachment->att_remote_host); - // OS user name - record.storeString(f_mon_att_remote_os_user, attachment->att_remote_os_user); - // authentication method - record.storeString(f_mon_att_auth_method, attachment->att_user->usr_auth_method); - // statistics - record.storeGlobalId(f_mon_att_stat_id, getGlobalId(stat_id)); - // system flag - temp = (attachment->att_flags & ATT_system) ? 1 : 0; - record.storeInteger(f_mon_att_sys_flag, temp); - - writer.putRecord(record); - - if (Config::getSharedCache()) - { - putStatistics(record, attachment->att_stats, writer, stat_id, stat_attachment); - putMemoryUsage(record, attachment->att_memory_stats, writer, stat_id, stat_attachment); - } - else - { - putStatistics(record, attachment->att_database->dbb_stats, writer, stat_id, stat_attachment); - putMemoryUsage(record, attachment->att_database->dbb_memory_stats, writer, stat_id, stat_attachment); - } - - // context vars - putContextVars(record, attachment->att_context_vars, writer, attachment->att_attachment_id, true); -} - - -void DatabaseSnapshot::putTransaction(DumpRecord& record, const jrd_tra* transaction, - Writer& writer, int stat_id) -{ - fb_assert(transaction); - - record.reset(rel_mon_transactions); - - int temp; - - // transaction id - record.storeInteger(f_mon_tra_id, transaction->tra_number); - // attachment id - record.storeInteger(f_mon_tra_att_id, transaction->tra_attachment->att_attachment_id); - // state - temp = transaction->tra_requests ? mon_state_active : mon_state_idle; - record.storeInteger(f_mon_tra_state, temp); - // timestamp - record.storeTimestamp(f_mon_tra_timestamp, transaction->tra_timestamp); - // top transaction - record.storeInteger(f_mon_tra_top, transaction->tra_top); - // oldest transaction - record.storeInteger(f_mon_tra_oit, transaction->tra_oldest); - // oldest active transaction - record.storeInteger(f_mon_tra_oat, transaction->tra_oldest_active); - // isolation mode - if (transaction->tra_flags & TRA_degree3) - { - temp = iso_mode_consistency; - } - else if (transaction->tra_flags & TRA_read_committed) - { - temp = (transaction->tra_flags & TRA_rec_version) ? - iso_mode_rc_version : iso_mode_rc_no_version; - } - else - { - temp = iso_mode_concurrency; - } - record.storeInteger(f_mon_tra_iso_mode, temp); - // lock timeout - record.storeInteger(f_mon_tra_lock_timeout, transaction->tra_lock_timeout); - // read only flag - temp = (transaction->tra_flags & TRA_readonly) ? 1 : 0; - record.storeInteger(f_mon_tra_read_only, temp); - // autocommit flag - temp = (transaction->tra_flags & TRA_autocommit) ? 1 : 0; - record.storeInteger(f_mon_tra_auto_commit, temp); - // auto undo flag - temp = (transaction->tra_flags & TRA_no_auto_undo) ? 0 : 1; - record.storeInteger(f_mon_tra_auto_undo, temp); - - // statistics - record.storeGlobalId(f_mon_tra_stat_id, getGlobalId(stat_id)); - writer.putRecord(record); - putStatistics(record, transaction->tra_stats, writer, stat_id, stat_transaction); - putMemoryUsage(record, transaction->tra_memory_stats, writer, stat_id, stat_transaction); - - // context vars - putContextVars(record, transaction->tra_context_vars, writer, transaction->tra_number, false); -} - - -void DatabaseSnapshot::putRequest(DumpRecord& record, const jrd_req* request, - Writer& writer, int stat_id, const string& plan) -{ - fb_assert(request); - - record.reset(rel_mon_statements); - - // request id - record.storeInteger(f_mon_stmt_id, request->req_id); - // attachment id - if (request->req_attachment) - { - record.storeInteger(f_mon_stmt_att_id, request->req_attachment->att_attachment_id); - } - // state, transaction ID, timestamp - if (request->req_flags & req_active) - { - const bool is_stalled = (request->req_flags & req_stall); - record.storeInteger(f_mon_stmt_state, is_stalled ? mon_state_stalled : mon_state_active); - if (request->req_transaction) - { - record.storeInteger(f_mon_stmt_tra_id, request->req_transaction->tra_number); - } - record.storeTimestamp(f_mon_stmt_timestamp, request->req_timestamp); - } - else - { - record.storeInteger(f_mon_stmt_state, mon_state_idle); - } - - const JrdStatement* const statement = request->getStatement(); - - // sql text - if (statement->sqlText) - record.storeString(f_mon_stmt_sql_text, *statement->sqlText); - - // explained plan - if (plan.hasData()) - record.storeString(f_mon_stmt_expl_plan, plan); - - // statistics - record.storeGlobalId(f_mon_stmt_stat_id, getGlobalId(stat_id)); - writer.putRecord(record); - putStatistics(record, request->req_stats, writer, stat_id, stat_statement); - putMemoryUsage(record, request->req_memory_stats, writer, stat_id, stat_statement); -} - - -void DatabaseSnapshot::putCall(DumpRecord& record, const jrd_req* request, - Writer& writer, int stat_id) -{ - fb_assert(request); - - const jrd_req* initialRequest = request->req_caller; - while (initialRequest->req_caller) - { - initialRequest = initialRequest->req_caller; - } - fb_assert(initialRequest); - - record.reset(rel_mon_calls); - - // call id - record.storeInteger(f_mon_call_id, request->req_id); - // statement id - record.storeInteger(f_mon_call_stmt_id, initialRequest->req_id); - // caller id - if (initialRequest != request->req_caller) - { - record.storeInteger(f_mon_call_caller_id, request->req_caller->req_id); - } - - const JrdStatement* statement = request->getStatement(); - const Routine* routine = statement->getRoutine(); - - // object name/type - if (routine) - { - if (routine->getName().package.hasData()) - record.storeString(f_mon_call_pkg_name, routine->getName().package); - - record.storeString(f_mon_call_name, routine->getName().identifier); - record.storeInteger(f_mon_call_type, routine->getObjectType()); - } - else if (!statement->triggerName.isEmpty()) - { - record.storeString(f_mon_call_name, statement->triggerName); - record.storeInteger(f_mon_call_type, obj_trigger); - } - else - { - // we should never be here... - fb_assert(false); - } - - // timestamp - record.storeTimestamp(f_mon_call_timestamp, request->req_timestamp); - // source line/column - if (request->req_src_line) - { - record.storeInteger(f_mon_call_src_line, request->req_src_line); - record.storeInteger(f_mon_call_src_column, request->req_src_column); - } - - // statistics - record.storeGlobalId(f_mon_call_stat_id, getGlobalId(stat_id)); - writer.putRecord(record); - putStatistics(record, request->req_stats, writer, stat_id, stat_call); - putMemoryUsage(record, request->req_memory_stats, writer, stat_id, stat_call); -} - -void DatabaseSnapshot::putStatistics(DumpRecord& record, const RuntimeStatistics& statistics, - Writer& writer, int stat_id, int stat_group) -{ - // statistics id - const SINT64 id = getGlobalId(stat_id); - - // physical I/O statistics - record.reset(rel_mon_io_stats); - record.storeGlobalId(f_mon_io_stat_id, id); - record.storeInteger(f_mon_io_stat_group, stat_group); - record.storeInteger(f_mon_io_page_reads, statistics.getValue(RuntimeStatistics::PAGE_READS)); - record.storeInteger(f_mon_io_page_writes, statistics.getValue(RuntimeStatistics::PAGE_WRITES)); - record.storeInteger(f_mon_io_page_fetches, statistics.getValue(RuntimeStatistics::PAGE_FETCHES)); - record.storeInteger(f_mon_io_page_marks, statistics.getValue(RuntimeStatistics::PAGE_MARKS)); - writer.putRecord(record); - - // logical I/O statistics - record.reset(rel_mon_rec_stats); - record.storeGlobalId(f_mon_rec_stat_id, id); - record.storeInteger(f_mon_rec_stat_group, stat_group); - record.storeInteger(f_mon_rec_seq_reads, statistics.getValue(RuntimeStatistics::RECORD_SEQ_READS)); - record.storeInteger(f_mon_rec_idx_reads, statistics.getValue(RuntimeStatistics::RECORD_IDX_READS)); - record.storeInteger(f_mon_rec_inserts, statistics.getValue(RuntimeStatistics::RECORD_INSERTS)); - record.storeInteger(f_mon_rec_updates, statistics.getValue(RuntimeStatistics::RECORD_UPDATES)); - record.storeInteger(f_mon_rec_deletes, statistics.getValue(RuntimeStatistics::RECORD_DELETES)); - record.storeInteger(f_mon_rec_backouts, statistics.getValue(RuntimeStatistics::RECORD_BACKOUTS)); - record.storeInteger(f_mon_rec_purges, statistics.getValue(RuntimeStatistics::RECORD_PURGES)); - record.storeInteger(f_mon_rec_expunges, statistics.getValue(RuntimeStatistics::RECORD_EXPUNGES)); - writer.putRecord(record); -} - -void DatabaseSnapshot::putContextVars(DumpRecord& record, const StringMap& variables, - Writer& writer, int object_id, bool is_attachment) -{ - StringMap::ConstAccessor accessor(&variables); - - for (bool found = accessor.getFirst(); found; found = accessor.getNext()) - { - record.reset(rel_mon_ctx_vars); - - if (is_attachment) - record.storeInteger(f_mon_ctx_var_att_id, object_id); - else - record.storeInteger(f_mon_ctx_var_tra_id, object_id); - - record.storeString(f_mon_ctx_var_name, accessor.current()->first); - record.storeString(f_mon_ctx_var_value, accessor.current()->second); - - writer.putRecord(record); - } -} - -void DatabaseSnapshot::putMemoryUsage(DumpRecord& record, const MemoryStats& stats, - Writer& writer, int stat_id, int stat_group) -{ - // statistics id - const SINT64 id = getGlobalId(stat_id); - - // memory usage - record.reset(rel_mon_mem_usage); - record.storeGlobalId(f_mon_mem_stat_id, id); - record.storeInteger(f_mon_mem_stat_group, stat_group); - record.storeInteger(f_mon_mem_cur_used, stats.getCurrentUsage()); - record.storeInteger(f_mon_mem_cur_alloc, stats.getCurrentMapping()); - record.storeInteger(f_mon_mem_max_used, stats.getMaximumUsage()); - record.storeInteger(f_mon_mem_max_alloc, stats.getMaximumMapping()); - - writer.putRecord(record); -} Deleted: firebird/trunk/src/jrd/DatabaseSnapshot.h =================================================================== --- firebird/trunk/src/jrd/DatabaseSnapshot.h 2014-07-31 08:29:57 UTC (rev 59939) +++ firebird/trunk/src/jrd/DatabaseSnapshot.h 2014-07-31 08:56:53 UTC (rev 59940) @@ -1,374 +0,0 @@ -/* - * The contents of this file are subject to the Initial - * Developer's Public License Version 1.0 (the "License"); - * you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl. - * - * Software distributed under the License is distributed AS IS, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. - * See the License for the specific language governing rights - * and limitations under the License. - * - * The Original Code was created by Dmitry Yemanov - * for the Firebird Open Source RDBMS project. - * - * Copyright (c) 2006 Dmitry Yemanov <di...@us...> - * and all contributors signed below. - * - * All Rights Reserved. - * Contributor(s): ______________________________________. - * Alex Peshkoff, 2010 - divided into class DataDump and the remaining part of DatabaseSnapshot - */ - -#ifndef JRD_DATABASE_SNAPSHOT_H -#define JRD_DATABASE_SNAPSHOT_H - -#include "../common/classes/array.h" -#include "../common/classes/init.h" -#include "../common/isc_s_proto.h" -#include "../common/classes/timestamp.h" -#include "../jrd/val.h" -#include "../jrd/recsrc/RecordSource.h" - -namespace Jrd { - -// forward declarations -class jrd_rel; -class Record; -class RecordBuffer; -class RuntimeStatistics; - -class DataDump -{ -public: - struct RelationData - { - int rel_id; - RecordBuffer* data; - }; - typedef Firebird::Array<RelationData> Snapshot; - - enum ValueType {VALUE_GLOBAL_ID, VALUE_INTEGER, VALUE_TIMESTAMP, VALUE_STRING, VALUE_BOOLEAN}; - - explicit DataDump(MemoryPool& pool) - : idMap(pool), snapshot(pool), idCounter(0) { } - ~DataDump() - { - clearSnapshot(); - } - - struct DumpField - { - DumpField(USHORT p_id, ValueType p_type, USHORT p_length, const void* p_data) - : id(p_id), type(p_type), length(p_length), data(p_data) { } - DumpField() - : id(0), type(VALUE_GLOBAL_ID), length(0), data(NULL) { } - - USHORT id; - ValueType type; - USHORT length; - const void* data; - }; - - class DumpRecord - { - public: - explicit DumpRecord(MemoryPool& pool) - : buffer(pool), offset(0) - {} - - DumpRecord(MemoryPool& pool, int rel_id) - : buffer(pool), offset(1) - { - buffer.add(rel_id); - } - - void reset(int rel_id) - { - offset = 1; - buffer.clear(); - buffer.add(rel_id); - } - - void assign(ULONG length, const UCHAR* ptr) - { - offset = 0; - buffer.assign(ptr, length); - } - - ULONG getLength() const - { - return offset; - } - - const UCHAR* getData() const - { - return buffer.begin(); - } - - void storeGlobalId(int field_id, SINT64 value) - { - storeField(field_id, VALUE_GLOBAL_ID, sizeof(SINT64), &value); - } - - void storeInteger(int field_id, SINT64 value) - { - storeField(field_id, VALUE_INTEGER, sizeof(SINT64), &value); - } - - void storeTimestamp(int field_id, const Firebird::TimeStamp& value) - { - if (!value.isEmpty()) - storeField(field_id, VALUE_TIMESTAMP, sizeof(ISC_TIMESTAMP), &value.value()); - } - - void storeString(int field_id, const Firebird::string& value) - { - if (value.length()) - storeField(field_id, VALUE_STRING, value.length(), value.c_str()); - } - - void storeString(int field_id, const Firebird::PathName& value) - { - if (value.length()) - storeField(field_id, VALUE_STRING, value.length(), value.c_str()); - } - - void storeString(int field_id, const Firebird::MetaName& value) - { - if (value.length()) - storeField(field_id, VALUE_STRING, value.length(), value.c_str()); - } - - int getRelationId() - { - fb_assert(!offset); - return (ULONG) buffer[offset++]; - } - - bool getField(DumpField& field) - { - fb_assert(offset); - - if (offset < buffer.getCount()) - { - field.id = (USHORT) buffer[offset++]; - field.type = (ValueType) buffer[offset++]; - fb_assert(field.type >= VALUE_GLOBAL_ID && field.type <= VALUE_STRING); - memcpy(&field.length, &buffer[offset], sizeof(USHORT)); - offset += sizeof(USHORT); - field.data = &buffer[offset]; - offset += field.length; - return true; - } - - return false; - } - - private: - void storeField(int field_id, ValueType type, FB_SIZE_T length, const void* value) - { - const FB_SIZE_T delta = sizeof(UCHAR) + sizeof(UCHAR) + sizeof(USHORT) + length; - buffer.resize(offset + delta); - - UCHAR* ptr = buffer.begin() + offset; - fb_assert(field_id <= int(MAX_UCHAR)); - *ptr++ = (UCHAR) field_id; - *ptr++ = (UCHAR) type; - const USHORT adjusted_length = (USHORT) length; - memcpy(ptr, &adjusted_length, sizeof(adjusted_length)); - ptr += sizeof(USHORT); - memcpy(ptr, value, length); - offset += (ULONG) delta; - } - - Firebird::HalfStaticArray<UCHAR, 1024> buffer; - ULONG offset; - }; - - void putField(thread_db*, Record*, const DumpField&, int); - - RecordBuffer* allocBuffer(thread_db*, MemoryPool&, int); - RecordBuffer* getData(const jrd_rel*) const; - RecordBuffer* getData(int) const; - void clearSnapshot(); - -private: - Firebird::GenericMap<Firebird::Pair<Firebird::NonPooled<SINT64, SLONG> > > idMap; - Snapshot snapshot; - int idCounter; -}; - - -class MonitoringHeader : public Firebird::MemoryHeader -{ -public: - ULONG used; - ULONG allocated; -}; - -class MonitoringData FB_FINAL : public Firebird::IpcObject -{ - static const ULONG MONITOR_VERSION = 3; - static const ULONG DEFAULT_SIZE = 1048576; - - typedef MonitoringHeader Header; - - struct Element - { - SLONG processId; - SLONG localId; - ULONG length; - }; - - static ULONG alignOffset(ULONG absoluteOffset); - -public: - class Guard - { - public: - explicit Guard(MonitoringData* ptr) - : data(ptr) - { - data->acquire(); - } - - ~Guard() - { - data->release(); - } - - private: - Guard(const Guard&); - Guard& operator=(const Guard&); - - MonitoringData* const data; - }; - - explicit MonitoringData(const Database*); - ~MonitoringData(); - - bool initialize(Firebird::SharedMemoryBase*, bool); - void mutexBug(int osErrorCode, const char* text); - - void acquire(); - void release(); - - UCHAR* read(MemoryPool&, ULONG&); - ULONG setup(); - void write(ULONG, ULONG, const void*); - - void cleanup(); - -private: - // copying is prohibited - MonitoringData(const MonitoringData&); - MonitoringData& operator =(const MonitoringData&); - - void ensureSpace(ULONG); - - Firebird::AutoPtr<Firebird::SharedMemory<MonitoringHeader> > shared_memory; - const SLONG process_id; - const SLONG local_id; -}; - - -class MonitoringTableScan: public VirtualTableScan -{ -public: - MonitoringTableScan(CompilerScratch* csb, const Firebird::string& alias, - StreamType stream, jrd_rel* relation) - : VirtualTableScan(csb, alias, stream, relation) - {} - -protected: - const Format* getFormat(thread_db* tdbb, jrd_rel* relation) const; - bool retrieveRecord(thread_db* tdbb, jrd_rel* relation, FB_UINT64 position, Record* record) const; -}; - - -class DatabaseSnapshot : public DataDump -{ -private: - class Writer - { - public: - explicit Writer(MonitoringData* data) - : dump(data) - { - fb_assert(dump); - offset = dump->setup(); - fb_assert(offset); - } - - void putRecord(const DumpRecord& record) - { - const ULONG length = record.getLength(); - dump->write(offset, sizeof(ULONG), &length); - dump->write(offset, length, record.getData()); - } - - private: - MonitoringData* dump; - ULONG offset; - }; - - class Reader - { - public: - Reader(ULONG length, UCHAR* ptr) - : sizeLimit(length), buffer(ptr), offset(0) - {} - - bool getRecord(DumpRecord& record) - { - if (offset < sizeLimit) - { - ULONG length; - memcpy(&length, buffer + offset, sizeof(ULONG)); - offset += sizeof(ULONG); - record.assign(length, buffer + offset); - offset += length; - return true; - } - - return false; - } - - private: - ULONG sizeLimit; - const UCHAR* buffer; - ULONG offset; - }; - -public: - static DatabaseSnapshot* create(thread_db*); - static int blockingAst(void*); - static void initialize(thread_db*); - static void shutdown(thread_db*); - static void activate(thread_db*); - static bool getRecord(thread_db* tdbb, jrd_rel* relation, FB_UINT64 position, Record* record); - -protected: - DatabaseSnapshot(thread_db*, MemoryPool&); - -private: - static void dumpData(thread_db*, int); - static void dumpAttachment(thread_db*, DumpRecord&, const Attachment*, Writer&); - - static SINT64 getGlobalId(int); - - static void putDatabase(DumpRecord&, const Database*, Writer&, int, int); - static void putAttachment(DumpRecord&, const Attachment*, Writer&, int); - static void putTransaction(DumpRecord&, const jrd_tra*, Writer&, int); - static void putRequest(DumpRecord&, const jrd_req*, Writer&, int, const Firebird::string&); - static void putCall(DumpRecord&, const jrd_req*, Writer&, int); - static void putStatistics(DumpRecord&, const RuntimeStatistics&, Writer&, int, int); - static void putContextVars(DumpRecord&, const Firebird::StringMap&, Writer&, int, bool); - static void putMemoryUsage(DumpRecord&, const Firebird::MemoryStats&, Writer&, int, int); -}; - -} // namespace - -#endif // JRD_DATABASE_SNAPSHOT_H Modified: firebird/trunk/src/jrd/Mapping.cpp =================================================================== --- firebird/trunk/src/jrd/Mapping.cpp 2014-07-31 08:29:57 UTC (rev 59939) +++ firebird/trunk/src/jrd/Mapping.cpp 2014-07-31 08:56:53 UTC (rev 59940) @@ -678,7 +678,7 @@ } catch (const Exception& ex) { - iscLogException("MonitoringData: Cannot initialize the shared memory region", ex); + i... [truncated message content] |
From: <rom...@us...> - 2014-07-31 08:30:05
|
Revision: 59939 http://sourceforge.net/p/firebird/code/59939 Author: roman-simakov Date: 2014-07-31 08:29:57 +0000 (Thu, 31 Jul 2014) Log Message: ----------- DDL permission check for COMMENT ON Modified Paths: -------------- firebird/trunk/src/dsql/DdlNodes.epp Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2014-07-31 07:54:38 UTC (rev 59938) +++ firebird/trunk/src/dsql/DdlNodes.epp 2014-07-31 08:29:57 UTC (rev 59939) @@ -489,6 +489,23 @@ return ""; // silence warning } +// Get relation name of an trigger. +static MetaName getTriggerRelationName(thread_db* tdbb, jrd_tra* transaction, + const MetaName& triggerName) +{ + AutoCacheRequest request(tdbb, drq_l_trigger_relname, DYN_REQUESTS); + + FOR (REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + X IN RDB$TRIGGERS + WITH X.RDB$TRIGGER_NAME EQ triggerName.c_str() + { + return X.RDB$RELATION_NAME; + } + END_FOR + + return ""; +} + // Get relation type name static const char* getRelationScopeName(const rel_t type) { @@ -1059,24 +1076,8 @@ bool CommentOnNode::checkPermission(thread_db* tdbb, jrd_tra* transaction) { - //DDL_TODO - // Probably requires migration code from execute with caching some query results for reuse in execute later. - return false; -} - -// select rdb$relation_name from rdb$relation_fields where rdb$field_name = 'RDB$DESCRIPTION'; -// gives the list of objects that accept descriptions. At FB2 time, the only -// subobjects with descriptions are relation's fields and procedure's parameters. -// In FB3 we added function's arguments. -void CommentOnNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, - jrd_tra* transaction) -{ Attachment* const attachment = transaction->tra_attachment; - const char* tableClause = NULL; - const char* columnClause = NULL; - const char* subColumnClause = NULL; - const char* addWhereClause = NULL; Arg::StatusVector status; string objNameStr = objName.toString(); @@ -1127,9 +1128,112 @@ } } + dsc dscName; + MetaName relationName; switch (objType) { + case obj_schema: case obj_database: + SCL_check_database(tdbb, SCL_alter); + break; + + case obj_field: + SCL_check_domain(tdbb, objName.identifier, SCL_alter); + break; + + case obj_relation: + dscName.makeText(objNameStr.length(), CS_METADATA, (UCHAR*) objName.identifier.c_str()); + SCL_check_relation(tdbb, &dscName, SCL_alter); + break; + + case obj_view: + dscName.makeText(objNameStr.length(), CS_METADATA, (UCHAR*) objName.identifier.c_str()); + SCL_check_view(tdbb, &dscName, SCL_alter); + break; + + case obj_procedure: + dscName.makeText(objNameStr.length(), CS_METADATA, (UCHAR*) objName.identifier.c_str()); + SCL_check_procedure(tdbb, &dscName, SCL_alter); + break; + + case obj_trigger: + relationName = getTriggerRelationName(tdbb, transaction, objName.identifier); + if (relationName.isEmpty()) + SCL_check_database(tdbb, SCL_alter); + else + { + dscName.makeText(relationName.length(), CS_METADATA, (UCHAR*) relationName.c_str()); + SCL_check_relation(tdbb, &dscName, SCL_alter); + } + break; + + case obj_udf: + dscName.makeText(objName.identifier.length(), CS_METADATA, (UCHAR*) objName.identifier.c_str()); + SCL_check_function(tdbb, &dscName, SCL_alter); + break; + + case obj_blob_filter: + SCL_check_filter(tdbb, objName.identifier, SCL_alter); + break; + + case obj_exception: + SCL_check_exception(tdbb, objName.identifier, SCL_alter); + break; + + case obj_generator: + SCL_check_generator(tdbb, objName.identifier, SCL_alter); + break; + + case obj_index: + relationName = getIndexRelationName(tdbb, transaction, objName.identifier); + dscName.makeText(relationName.length(), CS_METADATA, (UCHAR*) relationName.c_str()); + SCL_check_relation(tdbb, &dscName, SCL_alter); + break; + + case obj_sql_role: + SCL_check_role(tdbb, objName.identifier, SCL_alter); + break; + + case obj_charset: + SCL_check_charset(tdbb, objName.identifier, SCL_alter); + break; + + case obj_collation: + SCL_check_collation(tdbb, objName.identifier, SCL_alter); + break; + + case obj_package_header: + dscName.makeText(objName.identifier.length(), CS_METADATA, (UCHAR*) objName.identifier.c_str()); + SCL_check_package(tdbb, &dscName, SCL_alter); + break; + + default: + fb_assert(false); + } + return true; +} + +// select rdb$relation_name from rdb$relation_fields where rdb$field_name = 'RDB$DESCRIPTION'; +// gives the list of objects that accept descriptions. At FB2 time, the only +// subobjects with descriptions are relation's fields and procedure's parameters. +// In FB3 we added function's arguments. +void CommentOnNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, + jrd_tra* transaction) +{ + Attachment* const attachment = transaction->tra_attachment; + + const char* tableClause = NULL; + const char* columnClause = NULL; + const char* subColumnClause = NULL; + const char* addWhereClause = NULL; + Arg::StatusVector status; + string objNameStr = objName.toString(); + + fb_assert(objType != obj_parameter); + + switch (objType) + { + case obj_database: tableClause = "rdb$database"; break; @@ -3340,18 +3444,8 @@ bool DropTriggerNode::checkPermission(thread_db* tdbb, jrd_tra* transaction) { - MetaName relationName; + MetaName relationName = getTriggerRelationName(tdbb, transaction, name); - AutoCacheRequest request(tdbb, drq_l_trigger_relname, DYN_REQUESTS); - - FOR (REQUEST_HANDLE request TRANSACTION_HANDLE transaction) - X IN RDB$TRIGGERS - WITH X.RDB$TRIGGER_NAME EQ name.c_str() - { - relationName = X.RDB$RELATION_NAME; - } - END_FOR - if (relationName.isEmpty()) SCL_check_database(tdbb, SCL_alter); else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hv...@us...> - 2014-07-31 07:54:46
|
Revision: 59938 http://sourceforge.net/p/firebird/code/59938 Author: hvlad Date: 2014-07-31 07:54:38 +0000 (Thu, 31 Jul 2014) Log Message: ----------- While i don't see how we can have positive scale, wrong code should be fixed anyway Modified Paths: -------------- firebird/trunk/src/jrd/btr.cpp Modified: firebird/trunk/src/jrd/btr.cpp =================================================================== --- firebird/trunk/src/jrd/btr.cpp 2014-07-31 00:33:23 UTC (rev 59937) +++ firebird/trunk/src/jrd/btr.cpp 2014-07-31 07:54:38 UTC (rev 59938) @@ -112,7 +112,7 @@ 1.e30, 1.e31, 1.e32, 1.e33, 1.e34, 1.e35, 1.e36 }; -#define powerof10(s) ((s) <= 0 ? pow10_table[-(s)] : 1. / pow10_table[-(s)]) +#define powerof10(s) ((s) <= 0 ? pow10_table[-(s)] : 1. / pow10_table[(s)]) static const struct // Used in make_int64_key() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fir...@us...> - 2014-07-31 00:33:27
|
Revision: 59937 http://sourceforge.net/p/firebird/code/59937 Author: firebirds Date: 2014-07-31 00:33:23 +0000 (Thu, 31 Jul 2014) Log Message: ----------- nightly update Modified Paths: -------------- firebird/trunk/ChangeLog firebird/trunk/src/jrd/build_no.h firebird/trunk/src/misc/writeBuildNum.sh Modified: firebird/trunk/ChangeLog =================================================================== --- firebird/trunk/ChangeLog 2014-07-30 13:14:31 UTC (rev 59936) +++ firebird/trunk/ChangeLog 2014-07-31 00:33:23 UTC (rev 59937) @@ -1,3 +1,27 @@ + 2014-07-30 13:14 alexpeshkoff + M src/common/isc_sync.cpp +Fixed parameters when using ITimer interface for SYSV-semaphores build + + 2014-07-30 09:54 dimitr + M src/jrd/idx.cpp +Avoid metadata lookups while retrieving the plan (especially important in ASTs). + + 2014-07-30 09:50 dimitr + M src/jrd/Optimizer.cpp + M src/jrd/Optimizer.h + M src/jrd/RecordSourceNodes.h + M src/jrd/btr.h + M src/jrd/recsrc/RecordSource.cpp +Avoid metadata lookups while retrieving the plan (especially important in ASTs). + + 2014-07-30 09:29 dimitr + M src/jrd/btr.cpp +Misc. + + 2014-07-30 09:27 dimitr + M src/jrd/recsrc/RecordSource.h +Misc. + 2014-07-29 08:15 hvlad M src/jrd/GarbageCollector.cpp M src/jrd/GarbageCollector.h Modified: firebird/trunk/src/jrd/build_no.h =================================================================== --- firebird/trunk/src/jrd/build_no.h 2014-07-30 13:14:31 UTC (rev 59936) +++ firebird/trunk/src/jrd/build_no.h 2014-07-31 00:33:23 UTC (rev 59937) @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:31258 + FORMAL BUILD NUMBER:31263 */ -#define PRODUCT_VER_STRING "3.0.0.31258" -#define FILE_VER_STRING "WI-T3.0.0.31258" -#define LICENSE_VER_STRING "WI-T3.0.0.31258" -#define FILE_VER_NUMBER 3, 0, 0, 31258 +#define PRODUCT_VER_STRING "3.0.0.31263" +#define FILE_VER_STRING "WI-T3.0.0.31263" +#define LICENSE_VER_STRING "WI-T3.0.0.31263" +#define FILE_VER_NUMBER 3, 0, 0, 31263 #define FB_MAJOR_VER "3" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "31258" +#define FB_BUILD_NO "31263" #define FB_BUILD_TYPE "T" #define FB_BUILD_SUFFIX "Firebird 3.0 Alpha 2" Modified: firebird/trunk/src/misc/writeBuildNum.sh =================================================================== --- firebird/trunk/src/misc/writeBuildNum.sh 2014-07-30 13:14:31 UTC (rev 59936) +++ firebird/trunk/src/misc/writeBuildNum.sh 2014-07-31 00:33:23 UTC (rev 59937) @@ -9,7 +9,7 @@ MajorVer=3 MinorVer=0 RevNo=0 -BuildNum=31258 +BuildNum=31263 NowAt=`pwd` cd `dirname $0` This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2014-07-30 13:14:39
|
Revision: 59936 http://sourceforge.net/p/firebird/code/59936 Author: alexpeshkoff Date: 2014-07-30 13:14:31 +0000 (Wed, 30 Jul 2014) Log Message: ----------- Fixed parameters when using ITimer interface for SYSV-semaphores build Modified Paths: -------------- firebird/trunk/src/common/isc_sync.cpp Modified: firebird/trunk/src/common/isc_sync.cpp =================================================================== --- firebird/trunk/src/common/isc_sync.cpp 2014-07-30 09:54:45 UTC (rev 59935) +++ firebird/trunk/src/common/isc_sync.cpp 2014-07-30 13:14:31 UTC (rev 59936) @@ -66,6 +66,7 @@ #include "../common/classes/GenericMap.h" #include "../common/classes/RefMutex.h" #include "../common/classes/array.h" +#include "../common/StatusHolder.h" static int process_id; @@ -951,7 +952,7 @@ namespace { -class TimerEntry : public Firebird::RefCntIface<Firebird::ITimer, FB_TIMER_VERSION> +class TimerEntry FB_FINAL : public Firebird::RefCntIface<Firebird::ITimer, FB_TIMER_VERSION> { public: TimerEntry(int id, USHORT num) @@ -1007,7 +1008,10 @@ MutexLockGuard guard(timerAccess, FB_FUNCTION); timerQueue->push(newTimer); } - TimerInterfacePtr()->start(newTimer, microSeconds); + + LocalStatus st; + TimerInterfacePtr()->start(&st, newTimer, microSeconds); + check(&st); } void delTimer(Sys5Semaphore* sem) @@ -1031,7 +1035,9 @@ if (found) { - TimerInterfacePtr()->stop(*t); + LocalStatus st; + TimerInterfacePtr()->stop(&st, *t); + check(&st); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2014-07-30 09:54:52
|
Revision: 59935 http://sourceforge.net/p/firebird/code/59935 Author: dimitr Date: 2014-07-30 09:54:45 +0000 (Wed, 30 Jul 2014) Log Message: ----------- Avoid metadata lookups while retrieving the plan (especially important in ASTs). Modified Paths: -------------- firebird/trunk/src/jrd/idx.cpp Modified: firebird/trunk/src/jrd/idx.cpp =================================================================== --- firebird/trunk/src/jrd/idx.cpp 2014-07-30 09:50:33 UTC (rev 59934) +++ firebird/trunk/src/jrd/idx.cpp 2014-07-30 09:54:45 UTC (rev 59935) @@ -1289,26 +1289,17 @@ // fill out a retrieval block for the purpose of // generating a bitmap of duplicate records - IndexRetrieval retrieval; - MOVE_CLEAR(&retrieval, sizeof(IndexRetrieval)); - //retrieval.blk_type = type_irb; - retrieval.irb_index = partner_idx.idx_id; - memcpy(&retrieval.irb_desc, &partner_idx, sizeof(retrieval.irb_desc)); + IndexRetrieval retrieval(partner_relation, &partner_idx, segment, &key); retrieval.irb_generic = irb_equality | (starting ? irb_starting : 0); - retrieval.irb_relation = partner_relation; - retrieval.irb_key = &key; - retrieval.irb_upper_count = retrieval.irb_lower_count = segment; if (starting && segment < partner_idx.idx_count) retrieval.irb_generic |= irb_partial; - if (partner_idx.idx_flags & idx_descending) { + if (partner_idx.idx_flags & idx_descending) retrieval.irb_generic |= irb_descending; - } + if ((idx->idx_flags & idx_descending) != (partner_idx.idx_flags & idx_descending)) - { BTR_complement_key(&key); - } RecordBitmap* bitmap = NULL; BTR_evaluate(tdbb, &retrieval, &bitmap, NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2014-07-30 09:50:43
|
Revision: 59934 http://sourceforge.net/p/firebird/code/59934 Author: dimitr Date: 2014-07-30 09:50:33 +0000 (Wed, 30 Jul 2014) Log Message: ----------- Avoid metadata lookups while retrieving the plan (especially important in ASTs). Modified Paths: -------------- firebird/trunk/src/jrd/Optimizer.cpp firebird/trunk/src/jrd/Optimizer.h firebird/trunk/src/jrd/RecordSourceNodes.h firebird/trunk/src/jrd/btr.h firebird/trunk/src/jrd/recsrc/RecordSource.cpp Modified: firebird/trunk/src/jrd/Optimizer.cpp =================================================================== --- firebird/trunk/src/jrd/Optimizer.cpp 2014-07-30 09:29:44 UTC (rev 59933) +++ firebird/trunk/src/jrd/Optimizer.cpp 2014-07-30 09:50:33 UTC (rev 59934) @@ -1073,21 +1073,25 @@ } -InversionNode* OptimizerRetrieval::makeIndexNode(const index_desc* idx) const +InversionNode* OptimizerRetrieval::makeIndexScanNode(IndexScratch* indexScratch) const { /************************************** * - * m a k e I n d e x N o d e + * m a k e I n d e x S c a n N o d e * ************************************** * * Functional description - * Make an index node and an index retrieval block. + * Build node for index scan. * **************************************/ - // check whether this is during a compile or during - // a SET INDEX operation + if (!createIndexScanNodes) + return NULL; + + index_desc* const idx = indexScratch->idx; + + // Check whether this is during a compile or during a SET INDEX operation if (csb) CMP_post_resource(&csb->csb_resources, relation, Resource::rsc_index, idx->idx_id); else @@ -1096,40 +1100,14 @@ Resource::rsc_index, idx->idx_id); } - IndexRetrieval* retrieval = FB_NEW_RPT(pool, idx->idx_count * 2) IndexRetrieval(); - retrieval->irb_index = idx->idx_id; - memcpy(&retrieval->irb_desc, idx, sizeof(retrieval->irb_desc)); + // For external requests, determine index name (to be reported in plans) + MetaName indexName; + if (!(csb->csb_g_flags & csb_internal)) + MET_lookup_index(tdbb, indexName, relation->rel_name, idx->idx_id + 1); - InversionNode* node = FB_NEW(pool) InversionNode(retrieval); + IndexRetrieval* const retrieval = + FB_NEW(pool) IndexRetrieval(pool, relation, idx, indexName); - if (csb) - node->impure = CMP_impure(csb, sizeof(impure_inversion)); - - return node; -} - -InversionNode* OptimizerRetrieval::makeIndexScanNode(IndexScratch* indexScratch) const -{ -/************************************** - * - * m a k e I n d e x S c a n N o d e - * - ************************************** - * - * Functional description - * Build node for index scan. - * - **************************************/ - - if (!createIndexScanNodes) - return NULL; - - // Allocate both a index retrieval node and block. - index_desc* idx = indexScratch->idx; - InversionNode* node = makeIndexNode(idx); - IndexRetrieval* retrieval = node->retrieval; - retrieval->irb_relation = relation; - // Pick up lower bound segment values ValueExprNode** lower = retrieval->irb_value; ValueExprNode** upper = retrieval->irb_value + idx->idx_count; @@ -1225,7 +1203,8 @@ // mark the index as utilized for the purposes of this compile idx->idx_runtime_flags |= idx_used; - return node; + const ULONG impure = csb ? CMP_impure(csb, sizeof(impure_inversion)) : 0; + return FB_NEW(pool) InversionNode(retrieval, impure); } InversionCandidate* OptimizerRetrieval::makeInversion(InversionCandidateList* inversions) const Modified: firebird/trunk/src/jrd/Optimizer.h =================================================================== --- firebird/trunk/src/jrd/Optimizer.h 2014-07-30 09:29:44 UTC (rev 59933) +++ firebird/trunk/src/jrd/Optimizer.h 2014-07-30 09:50:33 UTC (rev 59934) @@ -187,7 +187,6 @@ InversionCandidate* generateInversion(); void getInversionCandidates(InversionCandidateList* inversions, IndexScratchList* indexScratches, USHORT scope) const; - InversionNode* makeIndexNode(const index_desc* idx) const; InversionNode* makeIndexScanNode(IndexScratch* indexScratch) const; InversionCandidate* makeInversion(InversionCandidateList* inversions) const; bool matchBoolean(IndexScratch* indexScratch, BoolExprNode* boolean, USHORT scope) const; Modified: firebird/trunk/src/jrd/RecordSourceNodes.h =================================================================== --- firebird/trunk/src/jrd/RecordSourceNodes.h 2014-07-30 09:29:44 UTC (rev 59933) +++ firebird/trunk/src/jrd/RecordSourceNodes.h 2014-07-30 09:50:33 UTC (rev 59934) @@ -188,9 +188,9 @@ { } - explicit InversionNode(IndexRetrieval* aRetrieval) + InversionNode(IndexRetrieval* aRetrieval, ULONG anImpure) : type(TYPE_INDEX), - impure(0), + impure(anImpure), retrieval(aRetrieval), node1(NULL), node2(NULL), Modified: firebird/trunk/src/jrd/btr.h =================================================================== --- firebird/trunk/src/jrd/btr.h 2014-07-30 09:29:44 UTC (rev 59933) +++ firebird/trunk/src/jrd/btr.h 2014-07-30 09:50:33 UTC (rev 59934) @@ -175,17 +175,42 @@ // Index retrieval block -- hold stuff for index retrieval -class IndexRetrieval : public pool_alloc_rpt<ValueExprNode*, type_irb> +class IndexRetrieval { public: - index_desc irb_desc; // Index descriptor - USHORT irb_index; // Index id - USHORT irb_generic; // Flags for generic search - jrd_rel* irb_relation; // Relation for retrieval - USHORT irb_lower_count; // Number of segments for retrieval - USHORT irb_upper_count; // Number of segments for retrieval - temporary_key* irb_key; // key for equality retrieval - ValueExprNode* irb_value[1]; + IndexRetrieval(jrd_rel* relation, const index_desc* idx, USHORT count, temporary_key* key) + : irb_relation(relation), irb_index(idx->idx_id), + irb_generic(0), irb_lower_count(count), irb_upper_count(count), irb_key(key), + irb_name(NULL), irb_value(NULL) + { + memcpy(&irb_desc, idx, sizeof(irb_desc)); + } + + IndexRetrieval(MemoryPool& pool, jrd_rel* relation, const index_desc* idx, + const Firebird::MetaName& name) + : irb_relation(relation), irb_index(idx->idx_id), + irb_generic(0), irb_lower_count(0), irb_upper_count(0), irb_key(NULL), + irb_name(FB_NEW(pool) Firebird::MetaName(name)), + irb_value(FB_NEW(pool) ValueExprNode*[idx->idx_count * 2]) + { + memcpy(&irb_desc, idx, sizeof(irb_desc)); + } + + ~IndexRetrieval() + { + delete irb_name; + delete[] irb_value; + } + + index_desc irb_desc; // Index descriptor + jrd_rel* irb_relation; // Relation for retrieval + USHORT irb_index; // Index id + USHORT irb_generic; // Flags for generic search + USHORT irb_lower_count; // Number of segments for retrieval + USHORT irb_upper_count; // Number of segments for retrieval + temporary_key* irb_key; // Key for equality retrieval + Firebird::MetaName* irb_name; // Index name + ValueExprNode** irb_value; }; // Flag values for irb_generic Modified: firebird/trunk/src/jrd/recsrc/RecordSource.cpp =================================================================== --- firebird/trunk/src/jrd/recsrc/RecordSource.cpp 2014-07-30 09:29:44 UTC (rev 59933) +++ firebird/trunk/src/jrd/recsrc/RecordSource.cpp 2014-07-30 09:50:33 UTC (rev 59934) @@ -122,8 +122,10 @@ const jrd_rel* const relation = retrieval->irb_relation; MetaName indexName; - MET_lookup_index(tdbb, indexName, relation->rel_name, - (USHORT) (retrieval->irb_index + 1)); + if (retrieval->irb_name && retrieval->irb_name->hasData()) + indexName = *retrieval->irb_name; + else + indexName.printf("<index id %d>", retrieval->irb_index + 1); if (detailed) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2014-07-30 09:29:49
|
Revision: 59933 http://sourceforge.net/p/firebird/code/59933 Author: dimitr Date: 2014-07-30 09:29:44 +0000 (Wed, 30 Jul 2014) Log Message: ----------- Misc. Modified Paths: -------------- firebird/trunk/src/jrd/btr.cpp Modified: firebird/trunk/src/jrd/btr.cpp =================================================================== --- firebird/trunk/src/jrd/btr.cpp 2014-07-30 09:27:43 UTC (rev 59932) +++ firebird/trunk/src/jrd/btr.cpp 2014-07-30 09:29:44 UTC (rev 59933) @@ -475,19 +475,15 @@ * Index id's must fit in a short - formerly a UCHAR. * **************************************/ - SET_TDBB(tdbb); - //const Database* dbb = tdbb->getDatabase(); - if (id >= root->irt_count) { + if (id >= root->irt_count) return false; - } const index_root_page::irt_repeat* irt_desc = &root->irt_rpt[id]; - if (irt_desc->irt_root == 0) { + if (irt_desc->irt_root == 0) return false; - } idx->idx_id = id; idx->idx_root = irt_desc->irt_root; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2014-07-30 09:27:51
|
Revision: 59932 http://sourceforge.net/p/firebird/code/59932 Author: dimitr Date: 2014-07-30 09:27:43 +0000 (Wed, 30 Jul 2014) Log Message: ----------- Misc. Modified Paths: -------------- firebird/trunk/src/jrd/recsrc/RecordSource.h Modified: firebird/trunk/src/jrd/recsrc/RecordSource.h =================================================================== --- firebird/trunk/src/jrd/recsrc/RecordSource.h 2014-07-30 00:31:28 UTC (rev 59931) +++ firebird/trunk/src/jrd/recsrc/RecordSource.h 2014-07-30 09:27:43 UTC (rev 59932) @@ -105,7 +105,8 @@ static Firebird::string printIndent(unsigned level); static void printInversion(thread_db* tdbb, const InversionNode* inversion, - Firebird::string& plan, bool detailed, unsigned level, bool navigation = false); + Firebird::string& plan, bool detailed, + unsigned level, bool navigation = false); static void saveRecord(thread_db* tdbb, record_param* rpb); static void restoreRecord(thread_db* tdbb, record_param* rpb); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fir...@us...> - 2014-07-30 00:31:30
|
Revision: 59931 http://sourceforge.net/p/firebird/code/59931 Author: firebirds Date: 2014-07-30 00:31:28 +0000 (Wed, 30 Jul 2014) Log Message: ----------- nightly update Modified Paths: -------------- firebird/branches/B2_5_Release/ChangeLog firebird/branches/B2_5_Release/src/jrd/build_no.h firebird/branches/B2_5_Release/src/misc/writeBuildNum.sh Modified: firebird/branches/B2_5_Release/ChangeLog =================================================================== --- firebird/branches/B2_5_Release/ChangeLog 2014-07-30 00:21:11 UTC (rev 59930) +++ firebird/branches/B2_5_Release/ChangeLog 2014-07-30 00:31:28 UTC (rev 59931) @@ -1,3 +1,7 @@ + 2014-07-29 05:35 dimitr + M src/lock/lock.cpp +Trivial fix for CORE-4500: Firebird crashes after unsuccessful remapping of the lock table's shared memory. + 2014-07-11 11:31 dimitr M builds/win32/msvc10/gpre_embed.vcxproj M builds/win32/msvc8/gpre_embed.vcproj Modified: firebird/branches/B2_5_Release/src/jrd/build_no.h =================================================================== --- firebird/branches/B2_5_Release/src/jrd/build_no.h 2014-07-30 00:21:11 UTC (rev 59930) +++ firebird/branches/B2_5_Release/src/jrd/build_no.h 2014-07-30 00:31:28 UTC (rev 59931) @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:26788 + FORMAL BUILD NUMBER:26789 */ -#define PRODUCT_VER_STRING "2.5.3.26788" -#define FILE_VER_STRING "WI-V2.5.3.26788" -#define LICENSE_VER_STRING "WI-V2.5.3.26788" -#define FILE_VER_NUMBER 2, 5, 3, 26788 +#define PRODUCT_VER_STRING "2.5.3.26789" +#define FILE_VER_STRING "WI-V2.5.3.26789" +#define LICENSE_VER_STRING "WI-V2.5.3.26789" +#define FILE_VER_NUMBER 2, 5, 3, 26789 #define FB_MAJOR_VER "2" #define FB_MINOR_VER "5" #define FB_REV_NO "3" -#define FB_BUILD_NO "26788" +#define FB_BUILD_NO "26789" #define FB_BUILD_TYPE "V" #define FB_BUILD_SUFFIX "Firebird 2.5" Modified: firebird/branches/B2_5_Release/src/misc/writeBuildNum.sh =================================================================== --- firebird/branches/B2_5_Release/src/misc/writeBuildNum.sh 2014-07-30 00:21:11 UTC (rev 59930) +++ firebird/branches/B2_5_Release/src/misc/writeBuildNum.sh 2014-07-30 00:31:28 UTC (rev 59931) @@ -9,7 +9,7 @@ MajorVer=2 MinorVer=5 RevNo=3 -BuildNum=26788 +BuildNum=26789 if [ "$SPECIAL_BUILD_SUFFIX" = "" ]; then # Normal builds This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fir...@us...> - 2014-07-30 00:21:16
|
Revision: 59930 http://sourceforge.net/p/firebird/code/59930 Author: firebirds Date: 2014-07-30 00:21:11 +0000 (Wed, 30 Jul 2014) Log Message: ----------- nightly update Modified Paths: -------------- firebird/trunk/ChangeLog firebird/trunk/src/jrd/build_no.h firebird/trunk/src/misc/writeBuildNum.sh Modified: firebird/trunk/ChangeLog =================================================================== --- firebird/trunk/ChangeLog 2014-07-29 08:15:29 UTC (rev 59929) +++ firebird/trunk/ChangeLog 2014-07-30 00:21:11 UTC (rev 59930) @@ -1,3 +1,17 @@ + 2014-07-29 08:15 hvlad + M src/jrd/GarbageCollector.cpp + M src/jrd/GarbageCollector.h + M src/jrd/vio.cpp +Cleanup and optimize locking a bit (as suggested by Dmitry) + + 2014-07-29 05:51 dimitr + M src/lock/lock.cpp +Follow-up. + + 2014-07-29 05:50 dimitr + M src/lock/lock.cpp +Trivial fix for CORE-4500: Firebird crashes after unsuccessful remapping of the lock table's shared memory. + 2014-07-28 14:50 asfernandes M doc/sql.extensions/README.ddl.txt Adjustments as Simonov Denis comments in fb-devel. Modified: firebird/trunk/src/jrd/build_no.h =================================================================== --- firebird/trunk/src/jrd/build_no.h 2014-07-29 08:15:29 UTC (rev 59929) +++ firebird/trunk/src/jrd/build_no.h 2014-07-30 00:21:11 UTC (rev 59930) @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:31255 + FORMAL BUILD NUMBER:31258 */ -#define PRODUCT_VER_STRING "3.0.0.31255" -#define FILE_VER_STRING "WI-T3.0.0.31255" -#define LICENSE_VER_STRING "WI-T3.0.0.31255" -#define FILE_VER_NUMBER 3, 0, 0, 31255 +#define PRODUCT_VER_STRING "3.0.0.31258" +#define FILE_VER_STRING "WI-T3.0.0.31258" +#define LICENSE_VER_STRING "WI-T3.0.0.31258" +#define FILE_VER_NUMBER 3, 0, 0, 31258 #define FB_MAJOR_VER "3" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "31255" +#define FB_BUILD_NO "31258" #define FB_BUILD_TYPE "T" #define FB_BUILD_SUFFIX "Firebird 3.0 Alpha 2" Modified: firebird/trunk/src/misc/writeBuildNum.sh =================================================================== --- firebird/trunk/src/misc/writeBuildNum.sh 2014-07-29 08:15:29 UTC (rev 59929) +++ firebird/trunk/src/misc/writeBuildNum.sh 2014-07-30 00:21:11 UTC (rev 59930) @@ -9,7 +9,7 @@ MajorVer=3 MinorVer=0 RevNo=0 -BuildNum=31255 +BuildNum=31258 NowAt=`pwd` cd `dirname $0` This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hv...@us...> - 2014-07-29 08:15:38
|
Revision: 59929 http://sourceforge.net/p/firebird/code/59929 Author: hvlad Date: 2014-07-29 08:15:29 +0000 (Tue, 29 Jul 2014) Log Message: ----------- Cleanup and optimize locking a bit (as suggested by Dmitry) Modified Paths: -------------- firebird/trunk/src/jrd/GarbageCollector.cpp firebird/trunk/src/jrd/GarbageCollector.h firebird/trunk/src/jrd/vio.cpp Modified: firebird/trunk/src/jrd/GarbageCollector.cpp =================================================================== --- firebird/trunk/src/jrd/GarbageCollector.cpp 2014-07-29 05:51:56 UTC (rev 59928) +++ firebird/trunk/src/jrd/GarbageCollector.cpp 2014-07-29 08:15:29 UTC (rev 59929) @@ -45,19 +45,23 @@ } -void GarbageCollector::RelationData::addPage(const ULONG pageno, const TraNumber tranid) +TraNumber GarbageCollector::RelationData::addPage(const ULONG pageno, const TraNumber tranid) { + TraNumber minTraID = MAX_TRA_NUMBER; + TranData::ConstAccessor accessor(&m_tranData); + if (accessor.getFirst()) + minTraID = accessor.current()->first; + // look if given page number is already set at given tx bitmap PageBitmap* bm = NULL; const bool bmExists = m_tranData.get(tranid, bm); if (bm && bm->test(pageno)) - return; + return minTraID; // search for given page at other transactions bitmaps // if found at older tx - we are done, just return // if found at younger tx - clear it as page should be set at oldest tx (our) - TranData::ConstAccessor accessor(&m_tranData); - if (accessor.getFirst()) + if (minTraID != MAX_TRA_NUMBER) { do { @@ -65,7 +69,7 @@ if (item->first <= tranid) { if (item->second->test(pageno)) - return; + return minTraID; } else { @@ -79,7 +83,13 @@ PBM_SET(&m_pool, &bm, pageno); if (!bmExists) + { m_tranData.put(tranid, bm); + if (minTraID > tranid) + minTraID = tranid; + } + + return minTraID; } @@ -142,17 +152,21 @@ for (FB_SIZE_T pos = 0; pos < m_relations.getCount(); pos++) { - Sync sync(&m_relations[pos]->m_sync, "GarbageCollector::~GarbageCollector"); + RelationData* relData = m_relations[pos]; + + Sync sync(&relData->m_sync, "GarbageCollector::~GarbageCollector"); sync.lock(SYNC_EXCLUSIVE); + + m_relations.remove(pos); sync.unlock(); - delete m_relations[pos]; + delete relData; } m_relations.clear(); } -void GarbageCollector::addPage(const USHORT relID, const ULONG pageno, const TraNumber tranid) +TraNumber GarbageCollector::addPage(const USHORT relID, const ULONG pageno, const TraNumber tranid) { Sync syncGC(&m_sync, "GarbageCollector::addPage"); RelationData* relData = getRelData(syncGC, relID, true); @@ -160,7 +174,7 @@ SyncLockGuard syncData(&relData->m_sync, SYNC_EXCLUSIVE, "GarbageCollector::addPage"); syncGC.unlock(); - relData->addPage(pageno, tranid); + return relData->addPage(pageno, tranid); } @@ -268,7 +282,6 @@ if (!m_relations.find(relID, pos)) { m_relations.insert(pos, FB_NEW(m_pool) RelationData(m_pool, relID)); - sync.downgrade(SYNC_SHARED); } } Modified: firebird/trunk/src/jrd/GarbageCollector.h =================================================================== --- firebird/trunk/src/jrd/GarbageCollector.h 2014-07-29 05:51:56 UTC (rev 59928) +++ firebird/trunk/src/jrd/GarbageCollector.h 2014-07-29 08:15:29 UTC (rev 59929) @@ -44,7 +44,7 @@ ~GarbageCollector(); - void addPage(const USHORT relID, const ULONG pageno, const TraNumber tranid); + TraNumber addPage(const USHORT relID, const ULONG pageno, const TraNumber tranid); bool getPageBitmap(const TraNumber oldest_snapshot, USHORT &relID, PageBitmap** sbm); void removeRelation(const USHORT relID); void sweptRelation(const TraNumber oldest_snapshot, const USHORT relID); @@ -67,7 +67,7 @@ clear(); } - void addPage(const ULONG pageno, const TraNumber tranid); + TraNumber addPage(const ULONG pageno, const TraNumber tranid); void getPageBitmap(const TraNumber oldest_snapshot, PageBitmap** sbm); void swept(const TraNumber oldest_snapshot); TraNumber minTranID() const; Modified: firebird/trunk/src/jrd/vio.cpp =================================================================== --- firebird/trunk/src/jrd/vio.cpp 2014-07-29 05:51:56 UTC (rev 59928) +++ firebird/trunk/src/jrd/vio.cpp 2014-07-29 08:15:29 UTC (rev 59929) @@ -5043,9 +5043,7 @@ const ULONG dp_sequence = rpb->rpb_number.getValue() / dbb->dbb_max_records; - gc->addPage(relation->rel_id, dp_sequence, tranid); - - const TraNumber minTranId = gc->minTranID(relation->rel_id); + const TraNumber minTranId = gc->addPage(relation->rel_id, dp_sequence, tranid); if (tranid > minTranId) tranid = minTranId; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2014-07-29 05:51:59
|
Revision: 59928 http://sourceforge.net/p/firebird/code/59928 Author: dimitr Date: 2014-07-29 05:51:56 +0000 (Tue, 29 Jul 2014) Log Message: ----------- Follow-up. Modified Paths: -------------- firebird/trunk/src/lock/lock.cpp Modified: firebird/trunk/src/lock/lock.cpp =================================================================== --- firebird/trunk/src/lock/lock.cpp 2014-07-29 05:50:16 UTC (rev 59927) +++ firebird/trunk/src/lock/lock.cpp 2014-07-29 05:51:56 UTC (rev 59928) @@ -1631,10 +1631,10 @@ if (header->lhb_active_owner > 0) { - const own* const owner = (own*) SRQ_ABS_PTR(m_sharedMemory->getHeader()->lhb_active_owner); + const own* const owner = (own*) SRQ_ABS_PTR(header->lhb_active_owner); const prc* const process = (prc*) SRQ_ABS_PTR(owner->own_process); if (process->prc_process_id == PID) - release_shmem(m_sharedMemory->getHeader()->lhb_active_owner); + release_shmem(header->lhb_active_owner); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2014-07-29 05:50:20
|
Revision: 59927 http://sourceforge.net/p/firebird/code/59927 Author: dimitr Date: 2014-07-29 05:50:16 +0000 (Tue, 29 Jul 2014) Log Message: ----------- Trivial fix for CORE-4500: Firebird crashes after unsuccessful remapping of the lock table's shared memory. Modified Paths: -------------- firebird/trunk/src/lock/lock.cpp Modified: firebird/trunk/src/lock/lock.cpp =================================================================== --- firebird/trunk/src/lock/lock.cpp 2014-07-29 05:35:49 UTC (rev 59926) +++ firebird/trunk/src/lock/lock.cpp 2014-07-29 05:50:16 UTC (rev 59927) @@ -1611,26 +1611,31 @@ { m_bugcheck = true; - // The lock table has some problem - copy it for later analysis + const lhb* const header = m_sharedMemory->getHeader(); - TEXT buffer[MAXPATHLEN]; - gds__prefix_lock(buffer, "fb_lock_table.dump"); - const TEXT* const lock_file = buffer; - FILE* const fd = fopen(lock_file, "wb"); - if (fd) + if (header) { - FB_UNUSED(fwrite(m_sharedMemory->getHeader(), 1, m_sharedMemory->getHeader()->lhb_used, fd)); - fclose(fd); - } + // The lock table has some problem - copy it for later analysis - // If the current mutex acquirer is in the same process, release the mutex + TEXT buffer[MAXPATHLEN]; + gds__prefix_lock(buffer, "fb_lock_table.dump"); + const TEXT* const lock_file = buffer; + FILE* const fd = fopen(lock_file, "wb"); + if (fd) + { + FB_UNUSED(fwrite(header, 1, header->lhb_used, fd)); + fclose(fd); + } - if (m_sharedMemory->getHeader() && (m_sharedMemory->getHeader()->lhb_active_owner > 0)) - { - const own* const owner = (own*) SRQ_ABS_PTR(m_sharedMemory->getHeader()->lhb_active_owner); - const prc* const process = (prc*) SRQ_ABS_PTR(owner->own_process); - if (process->prc_process_id == PID) - release_shmem(m_sharedMemory->getHeader()->lhb_active_owner); + // If the current mutex acquirer is in the same process, release the mutex + + if (header->lhb_active_owner > 0) + { + const own* const owner = (own*) SRQ_ABS_PTR(m_sharedMemory->getHeader()->lhb_active_owner); + const prc* const process = (prc*) SRQ_ABS_PTR(owner->own_process); + if (process->prc_process_id == PID) + release_shmem(m_sharedMemory->getHeader()->lhb_active_owner); + } } if (statusVector) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2014-07-29 05:35:52
|
Revision: 59926 http://sourceforge.net/p/firebird/code/59926 Author: dimitr Date: 2014-07-29 05:35:49 +0000 (Tue, 29 Jul 2014) Log Message: ----------- Trivial fix for CORE-4500: Firebird crashes after unsuccessful remapping of the lock table's shared memory. Modified Paths: -------------- firebird/branches/B2_5_Release/src/lock/lock.cpp Modified: firebird/branches/B2_5_Release/src/lock/lock.cpp =================================================================== --- firebird/branches/B2_5_Release/src/lock/lock.cpp 2014-07-29 00:34:20 UTC (rev 59925) +++ firebird/branches/B2_5_Release/src/lock/lock.cpp 2014-07-29 05:35:49 UTC (rev 59926) @@ -1655,26 +1655,29 @@ { m_bugcheck = true; - // The lock table has some problem - copy it for later analysis - - TEXT buffer[MAXPATHLEN]; - gds__prefix_lock(buffer, "fb_lock_table.dump"); - const TEXT* const lock_file = buffer; - FILE* const fd = fopen(lock_file, "wb"); - if (fd) + if (m_header) { - fwrite(m_header, 1, m_header->lhb_used, fd); - fclose(fd); - } + // The lock table has some problem - copy it for later analysis - // If the current mutex acquirer is in the same process, release the mutex + TEXT buffer[MAXPATHLEN]; + gds__prefix_lock(buffer, "fb_lock_table.dump"); + const TEXT* const lock_file = buffer; + FILE* const fd = fopen(lock_file, "wb"); + if (fd) + { + fwrite(m_header, 1, m_header->lhb_used, fd); + fclose(fd); + } - if (m_header && (m_header->lhb_active_owner > 0)) - { - const own* const owner = (own*) SRQ_ABS_PTR(m_header->lhb_active_owner); - const prc* const process = (prc*) SRQ_ABS_PTR(owner->own_process); - if (process->prc_process_id == PID) - release_shmem(m_header->lhb_active_owner); + // If the current mutex acquirer is in the same process, release the mutex + + if (m_header->lhb_active_owner > 0) + { + const own* const owner = (own*) SRQ_ABS_PTR(m_header->lhb_active_owner); + const prc* const process = (prc*) SRQ_ABS_PTR(owner->own_process); + if (process->prc_process_id == PID) + release_shmem(m_header->lhb_active_owner); + } } if (status_vector) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fir...@us...> - 2014-07-29 00:34:23
|
Revision: 59925 http://sourceforge.net/p/firebird/code/59925 Author: firebirds Date: 2014-07-29 00:34:20 +0000 (Tue, 29 Jul 2014) Log Message: ----------- nightly update Modified Paths: -------------- firebird/trunk/ChangeLog firebird/trunk/src/jrd/build_no.h firebird/trunk/src/misc/writeBuildNum.sh Modified: firebird/trunk/ChangeLog =================================================================== --- firebird/trunk/ChangeLog 2014-07-28 14:50:14 UTC (rev 59924) +++ firebird/trunk/ChangeLog 2014-07-29 00:34:20 UTC (rev 59925) @@ -1,3 +1,62 @@ + 2014-07-28 14:50 asfernandes + M doc/sql.extensions/README.ddl.txt +Adjustments as Simonov Denis comments in fb-devel. + + 2014-07-28 13:01 alexpeshkoff + M src/burp/backup.epp + M src/burp/canonical.cpp + M src/burp/restore.epp + M src/common/classes/AlignedBuffer.h + M src/common/classes/File.h + M src/common/classes/alloc.cpp + M src/common/classes/alloc.h + M src/common/classes/init.cpp + M src/common/classes/init.h + M src/common/isc_sync.cpp + M src/common/utils.cpp + M src/dsql/ExprNodes.cpp + M src/dsql/StmtNodes.cpp + M src/dsql/dsql.cpp + M src/dsql/gen.cpp + M src/gpre/msc.cpp + M src/include/fb_types.h + M src/include/types_pub.h + M src/jrd/CryptoManager.h + M src/jrd/DatabaseSnapshot.cpp + M src/jrd/Function.epp + M src/jrd/RecordSourceNodes.cpp + M src/jrd/Routine.cpp + M src/jrd/SimilarToMatcher.h + M src/jrd/TempSpace.cpp + M src/jrd/blb.cpp + M src/jrd/cch.cpp + M src/jrd/cmp.cpp + M src/jrd/event.cpp + M src/jrd/extds/IscDS.cpp + M src/jrd/fun.epp + M src/jrd/idx.cpp + M src/jrd/jrd.cpp + M src/jrd/met.epp + M src/jrd/nbak.cpp + M src/jrd/ods.cpp + M src/jrd/opt.cpp + M src/jrd/pag.cpp + M src/jrd/recsrc/BufferedStream.cpp + M src/jrd/recsrc/IndexTableScan.cpp + M src/lock/lock.cpp + M src/qli/all.cpp + M src/qli/compile.cpp + M src/qli/gener.cpp + M src/remote/client/BlrFromMessage.cpp + M src/remote/parser.cpp + M src/utilities/nbackup/nbackup.cpp + M src/yvalve/msg.h +Renamed as suggested by Nickolay and Dmitry + + 2014-07-28 11:03 alexpeshkoff + D src/misc/align.cpp +Cleanup + 2014-07-27 23:33 asfernandes M src/common/isc_file.cpp M src/jrd/recsrc/HashJoin.cpp Modified: firebird/trunk/src/jrd/build_no.h =================================================================== --- firebird/trunk/src/jrd/build_no.h 2014-07-28 14:50:14 UTC (rev 59924) +++ firebird/trunk/src/jrd/build_no.h 2014-07-29 00:34:20 UTC (rev 59925) @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:31252 + FORMAL BUILD NUMBER:31255 */ -#define PRODUCT_VER_STRING "3.0.0.31252" -#define FILE_VER_STRING "WI-T3.0.0.31252" -#define LICENSE_VER_STRING "WI-T3.0.0.31252" -#define FILE_VER_NUMBER 3, 0, 0, 31252 +#define PRODUCT_VER_STRING "3.0.0.31255" +#define FILE_VER_STRING "WI-T3.0.0.31255" +#define LICENSE_VER_STRING "WI-T3.0.0.31255" +#define FILE_VER_NUMBER 3, 0, 0, 31255 #define FB_MAJOR_VER "3" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "31252" +#define FB_BUILD_NO "31255" #define FB_BUILD_TYPE "T" #define FB_BUILD_SUFFIX "Firebird 3.0 Alpha 2" Modified: firebird/trunk/src/misc/writeBuildNum.sh =================================================================== --- firebird/trunk/src/misc/writeBuildNum.sh 2014-07-28 14:50:14 UTC (rev 59924) +++ firebird/trunk/src/misc/writeBuildNum.sh 2014-07-29 00:34:20 UTC (rev 59925) @@ -9,7 +9,7 @@ MajorVer=3 MinorVer=0 RevNo=0 -BuildNum=31252 +BuildNum=31255 NowAt=`pwd` cd `dirname $0` This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2014-07-28 14:50:21
|
Revision: 59924 http://sourceforge.net/p/firebird/code/59924 Author: asfernandes Date: 2014-07-28 14:50:14 +0000 (Mon, 28 Jul 2014) Log Message: ----------- Adjustments as Simonov Denis comments in fb-devel. Modified Paths: -------------- firebird/trunk/doc/sql.extensions/README.ddl.txt Modified: firebird/trunk/doc/sql.extensions/README.ddl.txt =================================================================== --- firebird/trunk/doc/sql.extensions/README.ddl.txt 2014-07-28 13:01:10 UTC (rev 59923) +++ firebird/trunk/doc/sql.extensions/README.ddl.txt 2014-07-28 14:50:14 UTC (rev 59924) @@ -148,7 +148,7 @@ - VIEW - PROCEDURE - TRIGGER -- EXTERNAL FUNCTION +- [EXTERNAL] FUNCTION - FILTER - EXCEPTION - GENERATOR @@ -157,6 +157,7 @@ - ROLE - CHARACTER SET - COLLATION +- PACKAGE - USER (ability to store comment depends upon user management plugin) - SECURITY CLASS (not implemented because Borland hid them). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2014-07-28 13:01:19
|
Revision: 59923 http://sourceforge.net/p/firebird/code/59923 Author: alexpeshkoff Date: 2014-07-28 13:01:10 +0000 (Mon, 28 Jul 2014) Log Message: ----------- Renamed as suggested by Nickolay and Dmitry Modified Paths: -------------- firebird/trunk/src/burp/backup.epp firebird/trunk/src/burp/canonical.cpp firebird/trunk/src/burp/restore.epp firebird/trunk/src/common/classes/AlignedBuffer.h firebird/trunk/src/common/classes/File.h firebird/trunk/src/common/classes/alloc.cpp firebird/trunk/src/common/classes/alloc.h firebird/trunk/src/common/classes/init.cpp firebird/trunk/src/common/classes/init.h firebird/trunk/src/common/isc_sync.cpp firebird/trunk/src/common/utils.cpp firebird/trunk/src/dsql/ExprNodes.cpp firebird/trunk/src/dsql/StmtNodes.cpp firebird/trunk/src/dsql/dsql.cpp firebird/trunk/src/dsql/gen.cpp firebird/trunk/src/gpre/msc.cpp firebird/trunk/src/include/fb_types.h firebird/trunk/src/include/types_pub.h firebird/trunk/src/jrd/CryptoManager.h firebird/trunk/src/jrd/DatabaseSnapshot.cpp firebird/trunk/src/jrd/Function.epp firebird/trunk/src/jrd/RecordSourceNodes.cpp firebird/trunk/src/jrd/Routine.cpp firebird/trunk/src/jrd/SimilarToMatcher.h firebird/trunk/src/jrd/TempSpace.cpp firebird/trunk/src/jrd/blb.cpp firebird/trunk/src/jrd/cch.cpp firebird/trunk/src/jrd/cmp.cpp firebird/trunk/src/jrd/event.cpp firebird/trunk/src/jrd/extds/IscDS.cpp firebird/trunk/src/jrd/fun.epp firebird/trunk/src/jrd/idx.cpp firebird/trunk/src/jrd/jrd.cpp firebird/trunk/src/jrd/met.epp firebird/trunk/src/jrd/nbak.cpp firebird/trunk/src/jrd/ods.cpp firebird/trunk/src/jrd/opt.cpp firebird/trunk/src/jrd/pag.cpp firebird/trunk/src/jrd/recsrc/BufferedStream.cpp firebird/trunk/src/jrd/recsrc/IndexTableScan.cpp firebird/trunk/src/lock/lock.cpp firebird/trunk/src/qli/all.cpp firebird/trunk/src/qli/compile.cpp firebird/trunk/src/qli/gener.cpp firebird/trunk/src/remote/client/BlrFromMessage.cpp firebird/trunk/src/remote/parser.cpp firebird/trunk/src/utilities/nbackup/nbackup.cpp firebird/trunk/src/yvalve/msg.h Modified: firebird/trunk/src/burp/backup.epp =================================================================== --- firebird/trunk/src/burp/backup.epp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/burp/backup.epp 2014-07-28 13:01:10 UTC (rev 59923) @@ -1620,7 +1620,7 @@ break; } if (alignment) - offset = fbAlign(offset, alignment); + offset = FB_ALIGN(offset, alignment); field->fld_offset = offset; field->fld_parameter = count++; offset += length; @@ -1634,7 +1634,7 @@ continue; add_byte(blr, blr_short); add_byte(blr, 0); - offset = fbAlign(offset, sizeof(SSHORT)); + offset = FB_ALIGN(offset, sizeof(SSHORT)); field->fld_missing_parameter = count++; offset += sizeof(SSHORT); } @@ -1645,7 +1645,7 @@ add_byte(blr, 0); // scale for eof field SSHORT eof_parameter = count++; RCRD_OFFSET record_length = offset; - RCRD_OFFSET eof_offset = fbAlign(offset, sizeof(SSHORT)); + RCRD_OFFSET eof_offset = FB_ALIGN(offset, sizeof(SSHORT)); // To be used later for the buffer size to receive data const FLD_LENGTH length = (USHORT) (eof_offset + sizeof(SSHORT)); Modified: firebird/trunk/src/burp/canonical.cpp =================================================================== --- firebird/trunk/src/burp/canonical.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/burp/canonical.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -191,7 +191,7 @@ { if (field->fld_flags & FLD_computed) continue; - offset = fbAlign(offset, sizeof(SSHORT)); + offset = FB_ALIGN(offset, sizeof(SSHORT)); UCHAR* p = data + offset; if (!xdr_short(xdrs, (SSHORT*) p)) return FALSE; Modified: firebird/trunk/src/burp/restore.epp =================================================================== --- firebird/trunk/src/burp/restore.epp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/burp/restore.epp 2014-07-28 13:01:10 UTC (rev 59923) @@ -2821,7 +2821,7 @@ break; } if (alignment) - offset = fbAlign(offset, alignment); + offset = FB_ALIGN(offset, alignment); field->fld_offset = offset; field->fld_parameter = count++; offset += length; @@ -2836,7 +2836,7 @@ continue; add_byte(blr, blr_short); add_byte(blr, 0); - offset = fbAlign(offset, sizeof(SSHORT)); + offset = FB_ALIGN(offset, sizeof(SSHORT)); field->fld_missing_parameter = count++; offset += sizeof(SSHORT); } @@ -9519,8 +9519,8 @@ { if (field->fld_flags & FLD_computed) continue; - p = fbAlign(p, sizeof(SSHORT)); - q = fbAlign(q, sizeof(SSHORT)); + p = FB_ALIGN(p, sizeof(SSHORT)); + q = FB_ALIGN(q, sizeof(SSHORT)); *p++ = *q++; *p++ = *q++; } @@ -9568,7 +9568,7 @@ length += sizeof(USHORT); if (alignment) - offset = fbAlign(offset, alignment); + offset = FB_ALIGN(offset, alignment); field->fld_old_offset = offset; offset += length; } @@ -9581,7 +9581,7 @@ { if (field->fld_flags & FLD_computed) continue; - offset = fbAlign(offset, sizeof(SSHORT)); + offset = FB_ALIGN(offset, sizeof(SSHORT)); offset += sizeof(SSHORT); } } Modified: firebird/trunk/src/common/classes/AlignedBuffer.h =================================================================== --- firebird/trunk/src/common/classes/AlignedBuffer.h 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/common/classes/AlignedBuffer.h 2014-07-28 13:01:10 UTC (rev 59923) @@ -41,7 +41,7 @@ operator UCHAR*() { - return (UCHAR*) fbAlign(buffer, A); + return (UCHAR*) FB_ALIGN(buffer, A); } FB_SIZE_T size() const Modified: firebird/trunk/src/common/classes/File.h =================================================================== --- firebird/trunk/src/common/classes/File.h 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/common/classes/File.h 2014-07-28 13:01:10 UTC (rev 59923) @@ -55,7 +55,7 @@ { bufSize = size; bufAligned = buffer.getBuffer(bufSize + SYS_PAGE_SIZE); - bufAligned = fbAlign(bufAligned, SYS_PAGE_SIZE); + bufAligned = FB_ALIGN(bufAligned, SYS_PAGE_SIZE); memset(bufAligned, 0, size); } Modified: firebird/trunk/src/common/classes/alloc.cpp =================================================================== --- firebird/trunk/src/common/classes/alloc.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/common/classes/alloc.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -808,7 +808,7 @@ } #endif - size = fbAlign(size, get_map_page_size()); + size = FB_ALIGN(size, get_map_page_size()); #ifdef WIN_NT @@ -909,7 +909,7 @@ // Set access protection for block to prevent memory from deleted pool being accessed int handle = /* //VALGRIND_MAKE_NOACCESS */ VALGRIND_MAKE_MEM_DEFINED(block, size); - size = fbAlign(size, get_map_page_size()); + size = FB_ALIGN(size, get_map_page_size()); void* unmapBlockPtr = block; size_t unmapBlockSize = size; @@ -958,7 +958,7 @@ } #endif - size = fbAlign(size, get_map_page_size()); + size = FB_ALIGN(size, get_map_page_size()); #ifdef WIN_NT if (!VirtualFree(block, 0, MEM_RELEASE)) #else // WIN_NT Modified: firebird/trunk/src/common/classes/alloc.h =================================================================== --- firebird/trunk/src/common/classes/alloc.h 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/common/classes/alloc.h 2014-07-28 13:01:10 UTC (rev 59923) @@ -89,7 +89,7 @@ static inline size_t MEM_ALIGN(size_t value) { - return fbAlign(value, ALLOC_ALIGNMENT); + return FB_ALIGN(value, ALLOC_ALIGNMENT); } static const unsigned int DEFAULT_ROUNDING = 8; Modified: firebird/trunk/src/common/classes/init.cpp =================================================================== --- firebird/trunk/src/common/classes/init.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/common/classes/init.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -245,7 +245,7 @@ void create() { static char place[sizeof(Firebird::Mutex) + FB_ALIGNMENT]; - mutex = new((void*) fbAlign(place, FB_ALIGNMENT)) Firebird::Mutex; + mutex = new((void*) FB_ALIGN(place, FB_ALIGNMENT)) Firebird::Mutex; } void release() Modified: firebird/trunk/src/common/classes/init.h =================================================================== --- firebird/trunk/src/common/classes/init.h 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/common/classes/init.h 2014-07-28 13:01:10 UTC (rev 59923) @@ -246,7 +246,7 @@ public: Static() { - t = new((void*) fbAlign(buf, FB_ALIGNMENT)) T(); + t = new((void*) FB_ALIGN(buf, FB_ALIGNMENT)) T(); } T* operator->() Modified: firebird/trunk/src/common/isc_sync.cpp =================================================================== --- firebird/trunk/src/common/isc_sync.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/common/isc_sync.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -2428,7 +2428,7 @@ // Compute the start and end page-aligned offsets which contain the object being mapped. const ULONG start = (object_offset / page_size) * page_size; - const ULONG end = fbAlign(object_offset + object_length, page_size); + const ULONG end = FB_ALIGN(object_offset + object_length, page_size); const ULONG length = end - start; UCHAR* address = (UCHAR*) mmap(0, length, PROT_READ | PROT_WRITE, MAP_SHARED, mainLock->getFd(), start); @@ -2523,7 +2523,7 @@ // contain the object being mapped. const ULONG start = (object_offset / page_size) * page_size; - const ULONG end = fbAlign(object_offset + object_length, page_size); + const ULONG end = FB_ALIGN(object_offset + object_length, page_size); const ULONG length = end - start; const HANDLE handle = sh_mem_object; Modified: firebird/trunk/src/common/utils.cpp =================================================================== --- firebird/trunk/src/common/utils.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/common/utils.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -1381,14 +1381,14 @@ unsigned align = type_alignments[dscType % FB_NELEM(type_alignments)]; if (align) - runOffset = fbAlign(runOffset, align); + runOffset = FB_ALIGN(runOffset, align); if (offset) *offset = runOffset; runOffset += sqlLength; align = type_alignments[dtype_short]; if (align) - runOffset = fbAlign(runOffset, align); + runOffset = FB_ALIGN(runOffset, align); if (nullOffset) *nullOffset = runOffset; Modified: firebird/trunk/src/dsql/ExprNodes.cpp =================================================================== --- firebird/trunk/src/dsql/ExprNodes.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/dsql/ExprNodes.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -10757,8 +10757,8 @@ const ULONG inMsgLength = function->getInputFormat() ? function->getInputFormat()->fmt_length : 0; const ULONG outMsgLength = function->getOutputFormat()->fmt_length; - UCHAR* const inMsg = fbAlign(impure + sizeof(impure_value), FB_ALIGNMENT); - UCHAR* const outMsg = fbAlign(inMsg + inMsgLength, FB_ALIGNMENT); + UCHAR* const inMsg = FB_ALIGN(impure + sizeof(impure_value), FB_ALIGNMENT); + UCHAR* const outMsg = FB_ALIGN(inMsg + inMsgLength, FB_ALIGNMENT); if (function->fun_inputs != 0) { Modified: firebird/trunk/src/dsql/StmtNodes.cpp =================================================================== --- firebird/trunk/src/dsql/StmtNodes.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/dsql/StmtNodes.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -1633,7 +1633,7 @@ fmtDesc = parameter->prm_desc; if (fmtDesc.dsc_dtype >= dtype_aligned) - format->fmt_length = fbAlign(format->fmt_length, type_alignments[fmtDesc.dsc_dtype]); + format->fmt_length = FB_ALIGN(format->fmt_length, type_alignments[fmtDesc.dsc_dtype]); fmtDesc.dsc_address = (UCHAR*)(IPTR) format->fmt_length; format->fmt_length += fmtDesc.dsc_length; @@ -2794,7 +2794,7 @@ format = procedure->getOutputFormat(); outMsgLength = format->fmt_length; outMsg = tempBuffer.getBuffer(outMsgLength + FB_DOUBLE_ALIGN - 1); - outMsg = fbAlign(outMsg, FB_DOUBLE_ALIGN); + outMsg = FB_ALIGN(outMsg, FB_DOUBLE_ALIGN); } if (inputSources) @@ -5258,7 +5258,7 @@ ItemInfo itemInfo; const USHORT alignment = setupDesc(tdbb, csb, index, &*desc, &itemInfo); if (alignment) - offset = fbAlign(offset, alignment); + offset = FB_ALIGN(offset, alignment); desc->dsc_address = (UCHAR*)(IPTR) offset; offset += desc->dsc_length; @@ -5266,7 +5266,7 @@ maxAlignment = MAX(maxAlignment, alignment); if (maxAlignment && shouldPad && index + 1 == padField) - offset = fbAlign(offset, maxAlignment); + offset = FB_ALIGN(offset, maxAlignment); // ASF: Odd indexes are the nullable flag. // So we only check even indexes, which is the actual parameter. @@ -5321,7 +5321,7 @@ { fb_assert(format); - impureOffset = CMP_impure(csb, fbAlign(format->fmt_length, 2)); + impureOffset = CMP_impure(csb, FB_ALIGN(format->fmt_length, 2)); impureFlags = CMP_impure(csb, sizeof(USHORT) * format->fmt_count); return this; Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/dsql/dsql.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -670,7 +670,7 @@ // Allocate buffer for message const ULONG newLen = message->msg_length + FB_DOUBLE_ALIGN - 1; UCHAR* msgBuffer = FB_NEW(*tdbb->getDefaultPool()) UCHAR[newLen]; - msgBuffer = fbAlign(msgBuffer, FB_DOUBLE_ALIGN); + msgBuffer = FB_ALIGN(msgBuffer, FB_DOUBLE_ALIGN); message->msg_buffer_number = req_msg_buffers.add(msgBuffer); } @@ -805,7 +805,7 @@ message = &temp_msg; temp_msg.msg_number = 1; temp_msg.msg_length = 2; - msgBuffer = fbAlign(temp_buffer, FB_DOUBLE_ALIGN); + msgBuffer = FB_ALIGN(temp_buffer, FB_DOUBLE_ALIGN); } JRD_receive(tdbb, req_request, message->msg_number, message->msg_length, msgBuffer); Modified: firebird/trunk/src/dsql/gen.cpp =================================================================== --- firebird/trunk/src/dsql/gen.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/dsql/gen.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -213,7 +213,7 @@ const USHORT align = type_alignments[parameter->par_desc.dsc_dtype]; if (align) - offset = fbAlign(offset, align); + offset = FB_ALIGN(offset, align); parameter->par_desc.dsc_address = (UCHAR*)(IPTR) offset; offset += parameter->par_desc.dsc_length; GEN_descriptor(dsqlScratch, ¶meter->par_desc, true); Modified: firebird/trunk/src/gpre/msc.cpp =================================================================== --- firebird/trunk/src/gpre/msc.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/gpre/msc.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -88,7 +88,7 @@ UCHAR* MSC_alloc(int size) { - size = fbAlign(size, FB_ALIGNMENT); + size = FB_ALIGN(size, FB_ALIGNMENT); if (!space || size > space->spc_remaining) { @@ -120,7 +120,7 @@ UCHAR* MSC_alloc_permanent(int size) { - size = fbAlign(size, FB_ALIGNMENT); + size = FB_ALIGN(size, FB_ALIGNMENT); if (!permanent_space || size > permanent_space->spc_remaining) { Modified: firebird/trunk/src/include/fb_types.h =================================================================== --- firebird/trunk/src/include/fb_types.h 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/include/fb_types.h 2014-07-28 13:01:10 UTC (rev 59923) @@ -149,14 +149,11 @@ // The type of Jrd's transaction. typedef ULONG TraNumber; -// This solution may be useful after moving to c++11 -//template <typename FROM, typename TO = FROM> -//TO fbAlign(FROM n, size_t b) - +// Alignment rule template <typename T> -inline T fbAlign(T n, size_t b) +inline T FB_ALIGN(T n, uintptr_t b) { - return (T) FB_ALIGN((uintptr_t)n, b); + return (T) ((((uintptr_t)n) + b - 1) & ~(b - 1)); } #endif /* INCLUDE_FB_TYPES_H */ Modified: firebird/trunk/src/include/types_pub.h =================================================================== --- firebird/trunk/src/include/types_pub.h 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/include/types_pub.h 2014-07-28 13:01:10 UTC (rev 59923) @@ -45,8 +45,6 @@ #endif -#define FB_ALIGN(n, b) ((n + size_t(b - 1)) & ~size_t(b - 1)) - /******************************************************************/ /* API handles */ /******************************************************************/ Modified: firebird/trunk/src/jrd/CryptoManager.h =================================================================== --- firebird/trunk/src/jrd/CryptoManager.h 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/CryptoManager.h 2014-07-28 13:01:10 UTC (rev 59923) @@ -88,7 +88,7 @@ public: operator Ods::pag*() { - return reinterpret_cast<Ods::pag*>(fbAlign(buf, MIN_PAGE_SIZE)); + return reinterpret_cast<Ods::pag*>(FB_ALIGN(buf, MIN_PAGE_SIZE)); } private: Modified: firebird/trunk/src/jrd/DatabaseSnapshot.cpp =================================================================== --- firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -275,7 +275,7 @@ if (newSize > shared_memory->getHeader()->allocated) { - newSize = fbAlign(newSize, DEFAULT_SIZE); + newSize = FB_ALIGN(newSize, DEFAULT_SIZE); #ifdef HAVE_OBJECT_MAP Arg::StatusVector statusVector; Modified: firebird/trunk/src/jrd/Function.epp =================================================================== --- firebird/trunk/src/jrd/Function.epp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/Function.epp 2014-07-28 13:01:10 UTC (rev 59923) @@ -345,7 +345,7 @@ parameter->prm_desc.dsc_length++; length += (parameter->prm_desc.dsc_dtype == dtype_blob) ? - sizeof(udf_blob) : fbAlign(parameter->prm_desc.dsc_length, FB_DOUBLE_ALIGN); + sizeof(udf_blob) : FB_ALIGN(parameter->prm_desc.dsc_length, FB_DOUBLE_ALIGN); count = MAX(count, size_t(Y.RDB$ARGUMENT_POSITION)); } Modified: firebird/trunk/src/jrd/RecordSourceNodes.cpp =================================================================== --- firebird/trunk/src/jrd/RecordSourceNodes.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/RecordSourceNodes.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -3302,7 +3302,7 @@ const USHORT align = type_alignments[desc3->dsc_dtype]; if (align) - offset = fbAlign(offset, align); + offset = FB_ALIGN(offset, align); desc3->dsc_address = (UCHAR*)(IPTR) offset; offset += desc3->dsc_length; Modified: firebird/trunk/src/jrd/Routine.cpp =================================================================== --- firebird/trunk/src/jrd/Routine.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/Routine.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -170,7 +170,7 @@ { const USHORT align = PAR_desc(tdbb, csb, &*desc); if (align) - offset = fbAlign(offset, align); + offset = FB_ALIGN(offset, align); desc->dsc_address = (UCHAR*)(IPTR) offset; offset += desc->dsc_length; @@ -178,7 +178,7 @@ maxAlignment = MAX(maxAlignment, align); if (maxAlignment && shouldPad && i + 1 == padField) - offset = fbAlign(offset, maxAlignment); + offset = FB_ALIGN(offset, maxAlignment); } format->fmt_length = offset; Modified: firebird/trunk/src/jrd/SimilarToMatcher.h =================================================================== --- firebird/trunk/src/jrd/SimilarToMatcher.h 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/SimilarToMatcher.h 2014-07-28 13:01:10 UTC (rev 59923) @@ -277,7 +277,7 @@ : size(INCREASE_FACTOR) { data = FB_NEW(*getDefaultMemoryPool()) UCHAR[(size + 1) * sizeof(T)]; - back = (T*) fbAlign(data.get(), sizeof(T)); + back = (T*) FB_ALIGN(data.get(), sizeof(T)); end = back + size; // 'back' starts before initial element, then always points to the last pushed element. @@ -293,7 +293,7 @@ unsigned newSize = size + INCREASE_FACTOR; UCHAR* newData = FB_NEW(*getDefaultMemoryPool()) UCHAR[(newSize + 1) * sizeof(T)]; - T* p = (T*) fbAlign(newData, sizeof(T)); + T* p = (T*) FB_ALIGN(newData, sizeof(T)); memcpy(p, end - size, size * sizeof(T)); back = p + size; Modified: firebird/trunk/src/jrd/TempSpace.cpp =================================================================== --- firebird/trunk/src/jrd/TempSpace.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/TempSpace.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -117,7 +117,7 @@ if (minBlockSize < MIN_TEMP_BLOCK_SIZE) minBlockSize = MIN_TEMP_BLOCK_SIZE; else - minBlockSize = fbAlign(minBlockSize, MIN_TEMP_BLOCK_SIZE); + minBlockSize = FB_ALIGN(minBlockSize, MIN_TEMP_BLOCK_SIZE); } } } @@ -264,12 +264,12 @@ fb_assert(head == tail); delete head; head = tail = NULL; - size = fbAlign(logicalSize, minBlockSize); + size = FB_ALIGN(logicalSize, minBlockSize); physicalSize = size; } else { - size = fbAlign(logicalSize - physicalSize, minBlockSize); + size = FB_ALIGN(logicalSize - physicalSize, minBlockSize); physicalSize += size; } Modified: firebird/trunk/src/jrd/blb.cpp =================================================================== --- firebird/trunk/src/jrd/blb.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/blb.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -2727,7 +2727,7 @@ if (array_desc->dsc_dtype == dtype_varying && array_desc->dsc_address != - fbAlign(array_desc->dsc_address, (MIN(sizeof(USHORT), FB_ALIGNMENT)))) + FB_ALIGN(array_desc->dsc_address, (MIN(sizeof(USHORT), FB_ALIGNMENT)))) { // Note: cannot remove this JRD_get_thread_data without api change // to slice callback routines @@ -2764,7 +2764,7 @@ if (array_desc->dsc_dtype == dtype_varying && array_desc->dsc_address != - fbAlign(array_desc->dsc_address, (MIN(sizeof(USHORT), FB_ALIGNMENT)))) + FB_ALIGN(array_desc->dsc_address, (MIN(sizeof(USHORT), FB_ALIGNMENT)))) { // temp_desc will vanish at the end of the block, but it's used // only as a way to transfer blocks of memory. Modified: firebird/trunk/src/jrd/cch.cpp =================================================================== --- firebird/trunk/src/jrd/cch.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/cch.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -3551,7 +3551,7 @@ const size_t alloc_size = dbb->dbb_page_size * (num_per_seg + 1); memory = (UCHAR*) bcb->bcb_bufferpool->allocate(alloc_size); bcb->bcb_memory.push(memory); - memory = fbAlign(memory, dbb->dbb_page_size); + memory = FB_ALIGN(memory, dbb->dbb_page_size); num_in_seg = num_per_seg; left_to_do -= num_per_seg; @@ -4285,7 +4285,7 @@ // Allocate buffers on an address that is an even multiple // of the page size (rather the physical sector size.) This // is a necessary condition to support raw I/O interfaces. - memory = fbAlign(memory, page_size); + memory = FB_ALIGN(memory, page_size); old_tail = tail; old_buffers = buffers; } Modified: firebird/trunk/src/jrd/cmp.cpp =================================================================== --- firebird/trunk/src/jrd/cmp.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/cmp.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -340,7 +340,7 @@ return 0; } - const ULONG offset = fbAlign(csb->csb_impure, FB_ALIGNMENT); + const ULONG offset = FB_ALIGN(csb->csb_impure, FB_ALIGNMENT); if (offset + size > JrdStatement::MAX_REQUEST_SIZE) { Modified: firebird/trunk/src/jrd/event.cpp =================================================================== --- firebird/trunk/src/jrd/event.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/event.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -576,7 +576,7 @@ frb* free; SLONG best_tail = MAX_SLONG; - length = fbAlign(length, FB_ALIGNMENT); + length = FB_ALIGN(length, FB_ALIGNMENT); SRQ_PTR* best = NULL; for (SRQ_PTR* ptr = &m_sharedMemory->getHeader()->evh_free; Modified: firebird/trunk/src/jrd/extds/IscDS.cpp =================================================================== --- firebird/trunk/src/jrd/extds/IscDS.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/extds/IscDS.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -1557,7 +1557,7 @@ xVar->sqltype |= 1; if (type_alignments[dtype]) - offset = fbAlign(offset, type_alignments[dtype]); + offset = FB_ALIGN(offset, type_alignments[dtype]); offset += xVar->sqllen; const int type = xVar->sqltype & (~1); @@ -1566,7 +1566,7 @@ } // null indicator - offset = fbAlign(offset, type_alignments[dtype_short]); + offset = FB_ALIGN(offset, type_alignments[dtype_short]); offset += sizeof(SSHORT); } @@ -1580,7 +1580,7 @@ { const UCHAR dtype = sqlTypeToDscType(xVar->sqltype & ~1); if (type_alignments[dtype]) - offset = fbAlign(offset, type_alignments[dtype]); + offset = FB_ALIGN(offset, type_alignments[dtype]); xVar->sqldata = (ISC_SCHAR*) (p + offset); @@ -1604,7 +1604,7 @@ } // null indicator - offset = fbAlign(offset, type_alignments[dtype_short]); + offset = FB_ALIGN(offset, type_alignments[dtype_short]); xVar->sqlind = (SSHORT*) (p + offset); dsc& null = descs[i * 2 + 1]; Modified: firebird/trunk/src/jrd/fun.epp =================================================================== --- firebird/trunk/src/jrd/fun.epp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/fun.epp 2014-07-28 13:01:10 UTC (rev 59923) @@ -375,7 +375,7 @@ // Start by constructing argument list UCHAR* temp_ptr = temp.getBuffer(function->fun_temp_length + FB_DOUBLE_ALIGN); MOVE_CLEAR(temp_ptr, temp.getCount()); - temp_ptr = fbAlign(temp_ptr, FB_DOUBLE_ALIGN); + temp_ptr = FB_ALIGN(temp_ptr, FB_DOUBLE_ALIGN); MOVE_CLEAR(args, sizeof(args)); UDF_ARG* arg_ptr = args; @@ -436,7 +436,7 @@ temp_desc = parameter->prm_desc; temp_desc.dsc_address = temp_ptr; // CVC: There's a theoretical possibility of overflowing "length" here. - USHORT length = fbAlign(temp_desc.dsc_length, FB_DOUBLE_ALIGN); + USHORT length = FB_ALIGN(temp_desc.dsc_length, FB_DOUBLE_ALIGN); // If we've got a null argument, just pass zeros (got any better ideas?) Modified: firebird/trunk/src/jrd/idx.cpp =================================================================== --- firebird/trunk/src/jrd/idx.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/idx.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -1069,7 +1069,7 @@ desc1 = *desc_idx; const USHORT idx_dsc_length = record_idx->idx_expression_desc.dsc_length; desc1.dsc_address = tmp.getBuffer(idx_dsc_length + FB_DOUBLE_ALIGN); - desc1.dsc_address = fbAlign(desc1.dsc_address, FB_DOUBLE_ALIGN); + desc1.dsc_address = FB_ALIGN(desc1.dsc_address, FB_DOUBLE_ALIGN); fb_assert(desc_idx->dsc_length <= idx_dsc_length); memmove(desc1.dsc_address, desc_idx->dsc_address, desc_idx->dsc_length); Modified: firebird/trunk/src/jrd/jrd.cpp =================================================================== --- firebird/trunk/src/jrd/jrd.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/jrd.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -6170,7 +6170,7 @@ // If we are in a single-threaded maintenance mode then clean up and stop waiting SCHAR spare_memory[MIN_PAGE_SIZE * 2]; - SCHAR* header_page_buffer = fbAlign(spare_memory, MIN_PAGE_SIZE); + SCHAR* header_page_buffer = FB_ALIGN(spare_memory, MIN_PAGE_SIZE); Ods::header_page* const header_page = reinterpret_cast<Ods::header_page*>(header_page_buffer); PIO_header(dbb, header_page_buffer, MIN_PAGE_SIZE); Modified: firebird/trunk/src/jrd/met.epp =================================================================== --- firebird/trunk/src/jrd/met.epp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/met.epp 2014-07-28 13:01:10 UTC (rev 59923) @@ -1011,7 +1011,7 @@ alignment = MIN(alignment, FORMAT_ALIGNMENT); - return fbAlign(value, alignment); + return FB_ALIGN(value, alignment); } Modified: firebird/trunk/src/jrd/nbak.cpp =================================================================== --- firebird/trunk/src/jrd/nbak.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/nbak.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -855,7 +855,7 @@ // Allocate various database page buffers needed for operation temp_buffers_space = FB_NEW(*database->dbb_permanent) BYTE[database->dbb_page_size * 3 + MIN_PAGE_SIZE]; // Align it at sector boundary for faster IO (also guarantees correct alignment for ULONG later) - BYTE *temp_buffers = reinterpret_cast<BYTE*>(fbAlign(temp_buffers_space, MIN_PAGE_SIZE)); + BYTE *temp_buffers = reinterpret_cast<BYTE*>(FB_ALIGN(temp_buffers_space, MIN_PAGE_SIZE)); memset(temp_buffers, 0, database->dbb_page_size * 3); backup_state = ini_state; Modified: firebird/trunk/src/jrd/ods.cpp =================================================================== --- firebird/trunk/src/jrd/ods.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/ods.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -124,7 +124,7 @@ // ODS11 it doesn't matter because record numbers are 40-bit. // Benefit is ~1.5 times smaller sparse bitmaps on average and faster bitmap iteration. - //max_records = fbAlign(max_records, 64); + //max_records = FB_ALIGN(max_records, 64); return max_records; } Modified: firebird/trunk/src/jrd/opt.cpp =================================================================== --- firebird/trunk/src/jrd/opt.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/opt.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -2579,7 +2579,7 @@ map_length = ROUNDUP(map_length, sizeof(SLONG)); #else if (desc->dsc_dtype >= dtype_aligned) - map_length = fbAlign(map_length, type_alignments[desc->dsc_dtype]); + map_length = FB_ALIGN(map_length, type_alignments[desc->dsc_dtype]); #endif sort_key->skd_offset = map_length; @@ -2633,7 +2633,7 @@ if (id >= format->fmt_count || desc->dsc_dtype == dtype_unknown) IBERROR(157); // msg 157 cannot sort on a field that does not exist if (desc->dsc_dtype >= dtype_aligned) - map_length = fbAlign(map_length, type_alignments[desc->dsc_dtype]); + map_length = FB_ALIGN(map_length, type_alignments[desc->dsc_dtype]); map_item->clear(); map_item->fieldId = (SSHORT) id; map_item->stream = stream; Modified: firebird/trunk/src/jrd/pag.cpp =================================================================== --- firebird/trunk/src/jrd/pag.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/pag.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -1124,7 +1124,7 @@ // sector for raw disk access. SCHAR temp_buffer[2 * MIN_PAGE_SIZE]; - SCHAR* const temp_page = fbAlign(temp_buffer, MIN_PAGE_SIZE); + SCHAR* const temp_page = FB_ALIGN(temp_buffer, MIN_PAGE_SIZE); PIO_header(dbb, temp_page, MIN_PAGE_SIZE); const header_page* header = (header_page*) temp_page; @@ -1245,7 +1245,7 @@ Array<SCHAR> temp; SCHAR* const temp_page = - fbAlign(temp.getBuffer(dbb->dbb_page_size + MIN_PAGE_SIZE), MIN_PAGE_SIZE); + FB_ALIGN(temp.getBuffer(dbb->dbb_page_size + MIN_PAGE_SIZE), MIN_PAGE_SIZE); PageSpace* pageSpace = dbb->dbb_page_manager.findPageSpace(DB_PAGE_SPACE); jrd_file* file = pageSpace->file; @@ -2221,7 +2221,7 @@ Array<UCHAR> temp; page_inv_page* pip = reinterpret_cast<Ods::page_inv_page*> - (fbAlign(temp.getBuffer(database->dbb_page_size + MIN_PAGE_SIZE), MIN_PAGE_SIZE)); + (FB_ALIGN(temp.getBuffer(database->dbb_page_size + MIN_PAGE_SIZE), MIN_PAGE_SIZE)); PageSpace* pageSpace = database->dbb_page_manager.findPageSpace(DB_PAGE_SPACE); fb_assert(pageSpace); Modified: firebird/trunk/src/jrd/recsrc/BufferedStream.cpp =================================================================== --- firebird/trunk/src/jrd/recsrc/BufferedStream.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/recsrc/BufferedStream.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -91,7 +91,7 @@ dsc& desc = format->fmt_desc[i] = fields[i]; if (desc.dsc_dtype >= dtype_aligned) - format->fmt_length = fbAlign(format->fmt_length, type_alignments[desc.dsc_dtype]); + format->fmt_length = FB_ALIGN(format->fmt_length, type_alignments[desc.dsc_dtype]); desc.dsc_address = (UCHAR*)(IPTR) format->fmt_length; format->fmt_length += desc.dsc_length; Modified: firebird/trunk/src/jrd/recsrc/IndexTableScan.cpp =================================================================== --- firebird/trunk/src/jrd/recsrc/IndexTableScan.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/jrd/recsrc/IndexTableScan.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -50,7 +50,7 @@ fb_assert(m_index); FB_SIZE_T size = sizeof(Impure) + 2u * m_length; - size = fbAlign(size, FB_ALIGNMENT); + size = FB_ALIGN(size, FB_ALIGNMENT); m_offset = size; size += sizeof(index_desc); Modified: firebird/trunk/src/lock/lock.cpp =================================================================== --- firebird/trunk/src/lock/lock.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/lock/lock.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -1280,7 +1280,7 @@ * Allocate a block of given size. * **************************************/ - size = fbAlign(size, FB_ALIGNMENT); + size = FB_ALIGN(size, FB_ALIGNMENT); ASSERT_ACQUIRED; ULONG block = m_sharedMemory->getHeader()->lhb_used; @@ -1346,7 +1346,7 @@ * one. * **************************************/ - length = fbAlign(length, 8); + length = FB_ALIGN(length, 8); ASSERT_ACQUIRED; srq* lock_srq; @@ -2384,7 +2384,7 @@ const ULONG length = sizeof(lhb) + (hdr->lhb_hash_slots * sizeof(hdr->lhb_hash[0])); hdr->lhb_length = m_sharedMemory->sh_mem_length_mapped; - hdr->lhb_used = fbAlign(length, FB_ALIGNMENT); + hdr->lhb_used = FB_ALIGN(length, FB_ALIGNMENT); shb* secondary_header = (shb*) alloc(sizeof(shb), NULL); if (!secondary_header) Modified: firebird/trunk/src/qli/all.cpp =================================================================== --- firebird/trunk/src/qli/all.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/qli/all.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -92,7 +92,7 @@ if (tail) size += count * tail; - size = fbAlign(size, FB_ALIGNMENT); + size = FB_ALIGN(size, FB_ALIGNMENT); if (size <= 4 || size > 65535) ERRQ_bugcheck(2); // Msg2 bad block size Modified: firebird/trunk/src/qli/compile.cpp =================================================================== --- firebird/trunk/src/qli/compile.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/qli/compile.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -119,7 +119,7 @@ qli_str* string = (qli_str*) ALLOCDV(type_str, node->nod_desc.dsc_length + type_alignments[node->nod_desc.dsc_dtype]); node->nod_desc.dsc_address = (UCHAR*) - fbAlign(string->str_data, type_alignments[node->nod_desc.dsc_dtype]); + FB_ALIGN(string->str_data, type_alignments[node->nod_desc.dsc_dtype]); QLI_validate_desc(node->nod_desc); } Modified: firebird/trunk/src/qli/gener.cpp =================================================================== --- firebird/trunk/src/qli/gener.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/qli/gener.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -1506,14 +1506,14 @@ param->par_parameter = message->msg_parameter++; const USHORT alignment = type_alignments[desc->dsc_dtype]; if (alignment) - message->msg_length = fbAlign(message->msg_length, alignment); + message->msg_length = FB_ALIGN(message->msg_length, alignment); param->par_offset = message->msg_length; message->msg_length += desc->dsc_length; qli_par* missing_param = param->par_missing; if (missing_param) { missing_param->par_parameter = message->msg_parameter++; - message->msg_length = fbAlign(message->msg_length, sizeof(USHORT)); + message->msg_length = FB_ALIGN(message->msg_length, sizeof(USHORT)); desc = &missing_param->par_desc; missing_param->par_offset = message->msg_length; message->msg_length += desc->dsc_length; @@ -1525,7 +1525,7 @@ STUFF_WORD(message->msg_parameter); qli_str* string = (qli_str*) ALLOCDV(type_str, message->msg_length + FB_DOUBLE_ALIGN - 1); - message->msg_buffer = (UCHAR*) fbAlign(string->str_data, FB_DOUBLE_ALIGN); + message->msg_buffer = (UCHAR*) FB_ALIGN(string->str_data, FB_DOUBLE_ALIGN); for (param = message->msg_parameters; param; param = param->par_next) { Modified: firebird/trunk/src/remote/client/BlrFromMessage.cpp =================================================================== --- firebird/trunk/src/remote/client/BlrFromMessage.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/remote/client/BlrFromMessage.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -202,13 +202,13 @@ unsigned align = type_alignments[dtype]; if (align) - msgLen = fbAlign(msgLen, align); + msgLen = FB_ALIGN(msgLen, align); msgLen += len; align = type_alignments[dtype_short]; if (align) - msgLen = fbAlign(msgLen, align); + msgLen = FB_ALIGN(msgLen, align); msgLen += sizeof(SSHORT); } Modified: firebird/trunk/src/remote/parser.cpp =================================================================== --- firebird/trunk/src/remote/parser.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/remote/parser.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -267,7 +267,7 @@ else net_length += (desc->dsc_length + 3) & ~3; if (align > 1) - offset = fbAlign(offset, align); + offset = FB_ALIGN(offset, align); desc->dsc_address = (UCHAR*) (IPTR) offset; offset += desc->dsc_length; } Modified: firebird/trunk/src/utilities/nbackup/nbackup.cpp =================================================================== --- firebird/trunk/src/utilities/nbackup/nbackup.cpp 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/utilities/nbackup/nbackup.cpp 2014-07-28 13:01:10 UTC (rev 59923) @@ -1032,7 +1032,7 @@ char unaligned_header_buffer[SECTOR_ALIGNMENT * 2]; Ods::header_page *header = reinterpret_cast<Ods::header_page*>( - fbAlign(unaligned_header_buffer, SECTOR_ALIGNMENT)); + FB_ALIGN(unaligned_header_buffer, SECTOR_ALIGNMENT)); if (read_file(dbase, header, SECTOR_ALIGNMENT/*sizeof(*header)*/) != SECTOR_ALIGNMENT/*sizeof(*header)*/) status_exception::raise(Arg::Gds(isc_nbackup_err_eofhdrdb) << dbname.c_str() << Arg::Num(1)); @@ -1053,7 +1053,7 @@ Array<UCHAR> unaligned_page_buffer; { // scope UCHAR* buf = unaligned_page_buffer.getBuffer(header->hdr_page_size + SECTOR_ALIGNMENT); - page_buff = reinterpret_cast<Ods::pag*>(fbAlign(buf, SECTOR_ALIGNMENT)); + page_buff = reinterpret_cast<Ods::pag*>(FB_ALIGN(buf, SECTOR_ALIGNMENT)); } // end scope ULONG db_size = db_size_pages; @@ -1114,7 +1114,7 @@ Ods::scns_page* scns = NULL, *scns_buf = NULL; { // scope UCHAR* buf = unaligned_scns_buffer.getBuffer(header->hdr_page_size + SECTOR_ALIGNMENT); - scns_buf = reinterpret_cast<Ods::scns_page*>(fbAlign(buf, SECTOR_ALIGNMENT)); + scns_buf = reinterpret_cast<Ods::scns_page*>(FB_ALIGN(buf, SECTOR_ALIGNMENT)); } while (true) Modified: firebird/trunk/src/yvalve/msg.h =================================================================== --- firebird/trunk/src/yvalve/msg.h 2014-07-28 12:07:15 UTC (rev 59922) +++ firebird/trunk/src/yvalve/msg.h 2014-07-28 13:01:10 UTC (rev 59923) @@ -64,7 +64,7 @@ inline msgrec* next() const { IPTR next = (IPTR) this; - next += fbAlign(offsetof(msgrec, msgrec_text[0]) + msgrec_length, sizeof (SLONG)); + next += FB_ALIGN(offsetof(msgrec, msgrec_text[0]) + msgrec_length, sizeof (SLONG)); return (msgrec*) next; } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |