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

1166 Commits

Author SHA1 Message Date
Ilya Eremin
d64868cdcd Execute ON DISCONNECT triggers in the following cases:
1. During database shutdown (gfix -shut full -force 0).
2. An attachment is deleted from MON$ATTACHMENTS by another attachment.
3. An attachment is closed by idle timeout.

ON DISCONNECT triggers will still not be executed during server shutdown.
2022-04-06 19:44:51 +03:00
Adriano dos Santos Fernandes
4c9fffd9b9 Compiled statement cache. 2022-03-18 08:17:35 -03:00
Adriano dos Santos Fernandes
98ba60e763 Correction for my last commit, thanks to Vlad. 2022-03-07 09:51:23 -03:00
Adriano dos Santos Fernandes
af6a227a71 Do not checkCancelState twice when there is no contention in thread_db::reschedule().
Remove unused variable 'dbb'.
2022-03-07 09:20:37 -03:00
AlexPeshkoff
44fc1289dd Fixed #7138: Problems accessing database, copied from another host. 2022-02-28 16:41:00 +03:00
AlexPeshkoff
24772275b2 Improved use of shutdown error codes a little 2022-02-22 20:20:11 +03:00
Vlad Khorsun
b985bcafa9 This should fix bug #7134 : Firebird 4: Database page errors directly after gbak, which dissappear after some calls of gfix 2022-02-17 09:55:20 +02:00
Adriano dos Santos Fernandes
98f678d4ee Rename class jrd_req to Request. 2022-02-13 10:51:30 -03:00
Adriano dos Santos Fernandes
7ff8855317 Avoid prefix Jrd in Statement class and Statement/jrd_req accessors/variables.
Change DSQL methods accordingly prefixing things with Dsql to avoid things as
request->getRequest() and statement->getStatement().
2022-02-09 15:47:58 -03:00
Dmitry Yemanov
19f2bfdd01 Refactored the optimizer. Better debug logging. 2022-02-09 10:20:16 +03:00
Adriano dos Santos Fernandes
391e7ef4fc Refactor statement and request parts so multiple DSQL requests could be created from a single compiled statement.
Pave the ground for compiled statement cache.
2022-02-07 15:52:12 -03:00
AlexPeshkoff
a88dc50736 Fixed #7122: Invalid state of mapping cache after replacement of database 2022-02-01 19:22:50 +03:00
Adriano dos Santos Fernandes
9772a398af
Fix MacOS UDR and Legacy_UserManager plugins not working due to not exported entry point. (#7088)
Add FB_DLL_EXPORT to public headers.

Use default visibility also for Linux/Unix (in addition to MacOS) as
user application can also be compiled with -fvisibility=hidden.
2021-12-26 11:35:16 -03:00
Adriano dos Santos Fernandes
2f503f2e2d Profiler. 2021-12-23 15:08:04 -03:00
Dmitry Yemanov
94e1b8b7a3 Initial implementation of ResultSet::getInfo() 2021-12-21 13:06:06 +03:00
AlexPeshkoff
b6658ade91 Cleanup: avoid deprecated entries in regular calls 2021-11-09 12:48:04 +03:00
Dmitry Yemanov
6088f2df65 Reworked bugfix for #6727 to resolve problems with SuperClassic. Some error handling improvements. 2021-11-03 19:26:40 +03:00
AlexPeshkoff
9ed56eff6c Better fix for #6947: Query to mon$ tables does not return data when the encryption/decryption thread is running 2021-10-11 20:06:38 +03:00
Dmitry Yemanov
21307a7bf8 Fixed #6989: Invalid message in replication.log (and possibly crash in the case of synchronous replication) when the target DB has no its replica flag set 2021-10-05 13:21:53 +03:00
Adriano dos Santos Fernandes
f412800202 Cleanup: get rid of unused variables. 2021-09-21 09:47:30 -03:00
Dmitry Yemanov
540bccf8a4 Fixed #6975: Crash or hang while shutting down the replica database if segments are being applied 2021-09-18 18:28:23 +03:00
AlexPeshkoff
33caf198dd Implemented #6959: IBatch::getInfo() 2021-09-10 17:18:48 +03:00
Dmitry Yemanov
4e869cab10 Revert "Additional fix for #6850, forcibly disable db-triggers in read-only replica"
This reverts commit 3341eb4c20.
2021-09-03 16:04:25 +03:00
Dmitry Yemanov
6ae5e1026e Code simplification (and preparation for the next commits) 2021-09-03 15:53:12 +03:00
AlexPeshkoff
6a9d2aa3fa Postfix for #6886, thanks to Adriano for very useful comments and suggestions 2021-09-01 19:04:55 +03:00
Dmitry Yemanov
3341eb4c20 Additional fix for #6850, forcibly disable db-triggers in read-only replica 2021-08-28 11:42:33 +03:00
AlexPeshkoff
de15522f32 Fixed #6886: Differerent interfaces behaviour depending upon source of interface 2021-08-16 20:57:55 +03:00
Adriano dos Santos Fernandes
1fbfeedb69 Add SET DEBUG OPTION DSQL_KEEP_BLR and remove Statement::PREPARE_KEEP_EXEC_PATH flag.
Make ISQL' SET EXEC_PATH_DISPLAY persistent between connections.
2021-07-30 16:40:01 -03:00
Adriano dos Santos Fernandes
234ae81f32 Feature #6910 - Add way to retrieve statement BLR with Statement::getInfo and ISQL's SET EXEC_PATH_DISPLAY BLR. 2021-07-30 15:25:20 -03:00
Adriano dos Santos Fernandes
1a8a895656 Revert "Feature #6910 - Add way to retrieve statement BLR with Statement::getInfo and ISQL's SET EXEC_PATH_DISPLAY BLR."
This reverts commit c93e8489fb.
2021-07-28 15:08:38 -03:00
Adriano dos Santos Fernandes
c93e8489fb Feature #6910 - Add way to retrieve statement BLR with Statement::getInfo and ISQL's SET EXEC_PATH_DISPLAY BLR. 2021-07-26 17:02:12 -03:00
Dmitry Yemanov
49f6ab8e10 Make this function's code better understandable, avoid negative wait times 2021-05-17 10:55:44 +03:00
hvlad
0c02c039e4 Fixed bug #6802 : When the statement timeout is set, it causes the lock manager to delay reporting deadlocks until timeout is expired 2021-05-14 20:43:50 +03:00
Dmitry Yemanov
7338eab650 Allow replication for a freshly created database 2021-05-06 19:53:41 +03:00
Dmitry Yemanov
deb40096af Correction for my yesterday's commit 2021-05-06 17:04:59 +03:00
Dmitry Yemanov
846629dfb9 Fixed partially released external triggers 2021-05-05 19:09:29 +03:00
Adriano dos Santos Fernandes
9436f57498 Fix #6787 - MON$ATTACHMENTS.MON$TIMESTAMP should use its session original time zone. 2021-05-04 11:30:37 -03:00
AlexPeshkoff
d46b5182b2 Added dedicated method to close Batch interface with errors check 2021-05-04 14:20:32 +03:00
Dmitry Yemanov
5c0d3f82f1 Allow multiple appliers per attachment 2021-05-01 18:10:57 +03:00
AlexPeshkoff
86649a4d94 Fixed CORE-6503: Attempt to create database with page_size >= 65536 makes DB with actual page size = 4k or 8k, but not 32k as it would be 2021-03-09 20:31:58 +03:00
Dmitry Yemanov
f18079af4d This should fix hanging replicator on disconnect (CORE-6497) 2021-02-24 20:12:11 +03:00
Adriano dos Santos Fernandes
03910bb920 Misc. 2021-02-04 12:33:44 -03:00
hvlad
28a8cd2a5c This should avoid hangup\crash when engine shutdown was not complete within the allowed timeout. 2021-02-03 21:43:02 +02:00
AlexPeshkoff
c3724f8384 Fixed CORE-6023: FB4 unable to overwrite older ods database 2020-12-25 17:10:23 +03:00
AlexPeshkoff
090a5c762d Next attempt to fix CORE-5197 2020-12-25 17:03:26 +03:00
AlexPeshkoff
e1ffc62063 Another (and hopefully better) approach to CORE-5197 2020-12-18 21:13:17 +03:00
AlexPeshkoff
c7054df600 Postfix for CORE-5197, ensure safe locking order 2020-12-09 16:46:37 +03:00
AlexPeshkoff
b0bfe3f1fc Fixed indentation 2020-12-08 19:51:03 +03:00
AlexPeshkoff
7a6712660d Fixed CORE-5197: Segfault when process exits with active sweep thread 2020-12-08 18:08:57 +03:00
hvlad
752424d513 Addition for CORE-5832 : Implement way to reset user session environment to its initial (default) state
Database triggers ON DISCONNECT and ON CONNECT is fired during session reset.
New system variable RESETTING is introduced to detect session reset state.
More detailed description see in tracker.
2020-11-30 13:15:48 +02:00
AlexPeshkoff
c1179d7a24 Removed dispose() and release() from most of implementations as was suggested by Adriano long time ago.
Cleanup old unused debugging feature (RefDeb).
Fixed CORE-6433: Several firebird servers crash
2020-11-13 14:49:35 +03:00
hvlad
000be2f2ee Addition for my recent patch (deadlock when attachment is initialized or released while database shutdown is in progress). 2020-10-06 16:36:30 +03:00
Dmitry Yemanov
51b7550622 Fixed the method names 2020-09-18 15:53:14 +03:00
1677359553
Replication plug (#280)
* Support for replication plugins + sample plugin
* Renamed TDBB flag
* Configurable replication errors handling
* Commit in two phases
* Move call to dispose() out of commit/rollback for code simplification
* A comment and manual fix for constant wrongly generated by CLOOP
* Log replication warnings as well
2020-09-18 11:45:51 +03:00
AlexPeshkoff
c49f293a92 Code cleanup - removed old DEBUG facility not used ay least for last 15 years 2020-08-13 23:39:03 +03:00
Dmitry Yemanov
ac107bd45a Postfix for CORE-6382 and some related cleanup 2020-08-10 21:45:54 +03:00
Dmitry Yemanov
ffb9f22065 This should fix CORE-6382: Triggers accessing a table prevent concurrent DDL command from dropping that table 2020-08-09 13:58:04 +03:00
AlexPeshkoff
ca12563ba5 Fixed CORE-6371: Avoid server crash on shutdown in case of wrong reference counting in UDR 2020-07-24 18:45:48 +03:00
Dmitry Yemanov
ffdb0bc40f Frontported protection against orphan dbb, fixed return-else style, misc code simplifications 2020-07-13 16:45:14 +03:00
hvlad
e4b54dc570 Calls of ITransaction::validate() is moved out of attachment context to avoid potential deadlocks.
Ensure check_database() is called after validateHandle().
Removed unneeded find_transaction().
2020-07-10 12:59:25 +03:00
AlexPeshkoff
99ea876e23 Fixed regression caused by previous commit - segfault when unwinding half-done attachment 2020-07-09 19:16:58 +03:00
AlexPeshkoff
ebddc8f8e5 Fixed CORE-6360: Engine may hang due to races when starting crypt thread and simultaneous shutdown 2020-07-09 18:08:05 +03:00
hvlad
e23273d615 This should fix bug CORE-6346 : New connection to the server hangs 2020-07-08 18:24:31 +03:00
Alexander Peshkov
cb6fee68eb
Small meta name (#271)
Keep metadata name strings in hash table having just a pointer to a hash table member in all places where metadata name is needed in order to save RAM. Hash table of metadata names is almost lock-less: mutex is used only when new segment of memory is needed or hash table should be grown.

Co-authored-by: hvlad <hvlad@users.sourceforge.net>
2020-06-16 19:22:15 +03:00
Dmitry Yemanov
34cb7c8c25 Refactoring: simplify the rescheduling usage 2020-06-03 09:44:01 +03:00
hvlad
1454fea3ea Use common template for Attachment::IdleTimer.
Don't start session idle timer if there is executing statement.
Show in monitoring tables real expiration time of timeout timers, independent of system time change after timer start.
2020-05-19 17:07:18 +03:00
Dmitry Yemanov
25f5bf7b6a Allow the replication state to be changed at runtime 2020-04-21 19:36:43 +03:00
Dmitry Yemanov
c31517b4c7 Refactored the global objects to be managed from a single place, this also removes code duplication 2020-04-16 17:34:33 +03:00
Adriano dos Santos Fernandes
471cc13ddc Fixed CORE-6281 and CORE-6282:
- CORE-6281: Invalid timestamp errors with RDB$TIME_ZONE_UTIL.TRANSITIONS
- CORE-6282: Change type of MON$ATTACHMENTS.MON$IDLE_TIMER and MON$STATEMENTS.MON$STATEMENT_TIMER to TIMESTAMP WITH TIME ZONE
2020-04-13 15:36:09 +00:00
AlexPeshkoff
c94e45bd6f Fixed CORE-5364: gfix -online normal <db> (being issued in window #1) does not produce error when there is sysdba attachment in window #2 2020-04-09 15:21:59 +03:00
Alex Peshkoff
2db2dc94c1 Fixed CORE-6272: Failed attach to database not traced 2020-03-30 18:57:12 +03:00
hvlad
9ac2238c3d Merge branch 'query_restarts_2' 2020-03-28 12:20:04 +02:00
Adriano dos Santos Fernandes
3ee737cb20 Fixed CORE-6246 - Problem with too many number of columns in resultset. 2020-03-21 22:49:46 -03:00
Alexander Peshkov
199b0a6306
Postfix for CORE-6110: always store strings in local StatusVector's memory (#261)
* Postfix for CORE-6110: always store strings in local StatusVector's memory, i.e. no lost string args
2020-03-10 20:39:04 +03:00
hvlad
7e5b0ce6ac Fixed bug CORE-6254 : AV in engine when using SET TRANSACTION and ON TRANSACTION START trigger uses EXECUTE STATEMENT against current transaction 2020-02-20 18:32:11 +02:00
hvlad
24e4944b05 Merge branch 'master' into query_restarts_2 2020-02-13 02:04:02 +02:00
AlexPeshkoff
b9f4c65220 Added various ways to get infomation about wire crypt plugin name: variable in rdb$get_context(), field in mon$attachments and tag in Attachment::getInfo() 2020-01-15 18:02:19 +03:00
AlexPeshkoff
66bdb2c9c6 Fixed errors displayed in case of error in DPB bindings 2019-12-06 18:35:43 +03:00
AlexPeshkoff
0dce25ffc1 Change style of setting database compatibility in config files (docs to come later) 2019-12-06 18:35:43 +03:00
AlexPeshkoff
e8787500d7 First edition of SET BIND statement 2019-12-06 18:35:43 +03:00
Alexander Peshkov
861d536fc2
Int128 - new datatype (#220)
* Int128 support - work in progress

* Work in progress

* Int128 datatype appears to be mostly OK except sort & index

* Fixed divide scaling, added sorting & network (xdr) support

* Binding control, aggregate nodes, cleanup and documentation

* Fixed VS2017 AppVeyor build

* Next attempt to fix vs2017 build

* Next attempt to fix vs2017 build

* Next attempt to fix vs2017 build

* Update MSVC build.

* Set VS architecture correctly

* Fixed a number of issues noticed by Mark
2019-09-16 20:59:54 +03:00
nikolay.samofatov
059694b0b4 Improve query restarts logic so that it handles SELECT ... WITH LOCK (with single record), inserts and updates correctly 2019-08-01 10:49:45 +03:00
Dmitry Yemanov
9ab1c1ab27 Fixed a mistake 2019-05-23 18:55:36 +03:00
Adriano dos Santos Fernandes
89c09d1320 Improve some error names/constants. 2019-04-15 12:22:10 -03:00
Adriano dos Santos Fernandes
2a9f8fa60b Improvement CORE-6032 - Add DPB properties for time zone bind and decfloat configuration. 2019-04-07 11:56:02 -03:00
AlexPeshkoff
84a682bf17 Fixed some gcc8 warnings - WiP 2019-03-18 20:10:48 +03:00
Roman Simakov
bb3c2e94ec Fixed CORE-5892: SQL SECURITY DEFINER context is not properly evaluated for monitoring tables (#196)
* Now we take into account the call hierarchy when use SQL SECURITY
option.
Added new context variable in SYSTEM namespace - EFFICIENT_USER which is
returns user name in which context a code works.
We change efficient user before call procedure and function, fetch a
record from selective procedure and before execute a trigger.

* Renamed new context variable to EFFECTIVE_USER. Fixed nested calls.

* Improved error messages to print effective user when there is no permission.

* Added description of new context variable EFFECTIVE_USER. Improved description of SQL SECURITY clause.
2019-03-18 14:17:02 +03:00
Artyom Smirnov
1f13a2fa15 Fix external engine memory leaks (#168)
* Release objects of external engine

1. Added explicit destruction of procedures and functions, because it
should execute external routines destructor to avoid leaks inside
external engine
2. Add explicit destruction of trigger and destruction of linked
external trigger
3. Release external engine after use

* Fix external engine procedures leaking, when creating new procedure
2019-02-26 07:54:01 +03:00
Dmitry Yemanov
932ca51574
Replication support (#182)
* Initial implementation of replication

* Postfixes for configuration and Windows builds

* Misc Windows adjustments

* Forgotten changes from prior commits

* Last round (fingers crossed) of fixing the Windows build

* Improve self-documentation

* Misc improvements

* Updates the docs

* More configuration

* Frontported some remaining pieces

* Installation post-fixes

* Special permission for replication
2019-01-25 12:09:01 +03:00
Dmitry Yemanov
b0f2529c3e Fixed monitoring for non-privileged users 2019-01-22 12:25:30 +03:00
Dmitry Yemanov
c349d28686 Fixed the database left attached (and the engine not unloaded) after error thrown from the beginning of the attach process (e.g. due to the engine shutdown in progress) 2019-01-17 14:53:57 +03:00
Adriano dos Santos Fernandes
050cea380e - Change MON$ TIMESTAMP fields to TIMESTAMP WITH TIME ZONE.
- Added fb_info_creation_timestamp_tz.
- Make timeouts work when server time zone is changed.
2018-11-27 23:27:52 -02:00
Adriano dos Santos Fernandes
873cd8090f Make isc_dpb_session_time_zone also define the original time zone, and make RESET reset the session time zone to the original one. 2018-11-12 13:18:00 -02:00
Adriano dos Santos Fernandes
3c4c8e781d Support for system packages and RDB$TIME_ZONE_UTIL system package implementation. 2018-11-12 13:18:00 -02:00
Adriano dos Santos Fernandes
4ea34933f0 Added isc_dpb_session_time_zone. 2018-11-12 13:18:00 -02:00
AlexPeshkoff
ef57295112 Fixed CORE-5950: Deadlock when attaching to bugchecked database 2018-10-24 17:22:58 +03:00
Dmitry Starodubov
0c275c1f3a Fixed CORE-5823: No permission for SELECT access to blob field in stored procedure. And CORE-5841: No permission for SELECT access to TABLE PLG$SRP in newer snapshot. (#170) 2018-09-17 15:59:14 +03:00
Alex Peshkoff
2cb086d431 This should fix memory leak when not fully initialized attachment killed by DBA 2018-08-31 12:55:38 +03:00
hvlad
69b9182b16 This should fix crash when not fully initialized attachment killed by DBA.
For example - sweep (it happens few times when running core_4337.fbt).
2018-08-30 20:30:52 +03:00
hvlad
96ac2145e8 Avoid crash due to executing already unloaded code (in attachmentShutdownThread).
Probably, same trick should be used in all threads, started not by Dispatcher,
which could run after its module is unloaded concurrently. So far, it looks like
Windows specific.
2018-08-26 23:24:40 +03:00