From 946c8ef115e107598479ed17d6dd2e46d997c727 Mon Sep 17 00:00:00 2001 From: Dmitry Yemanov Date: Wed, 13 Jul 2016 18:46:26 +0300 Subject: [PATCH] Bugfix for CORE-5307: Random 'invalid transaction handle' errors are returned from the engine. --- src/jrd/blb.cpp | 6 ++++-- src/jrd/blb.h | 2 +- src/jrd/jrd.cpp | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/jrd/blb.cpp b/src/jrd/blb.cpp index 0179618b0e..9ec3c8a5b6 100644 --- a/src/jrd/blb.cpp +++ b/src/jrd/blb.cpp @@ -171,7 +171,7 @@ void blb::BLB_check_well_formed(Jrd::thread_db* tdbb, const dsc* desc) } -void blb::BLB_close(thread_db* tdbb) +bool blb::BLB_close(thread_db* tdbb) { /************************************** * @@ -183,6 +183,7 @@ void blb::BLB_close(thread_db* tdbb) * Close a blob. If the blob is open for retrieval, release the * blob block. If it's a temporary blob, flush out the last page * (if necessary) in preparation for materialization. + * Return true if the blob was physically destroyed. * **************************************/ @@ -198,7 +199,7 @@ void blb::BLB_close(thread_db* tdbb) if (!(blb_flags & BLB_temporary)) { destroy(true); - return; + return true; } if (blb_level == 0) @@ -222,6 +223,7 @@ void blb::BLB_close(thread_db* tdbb) } freeBuffer(); + return false; } diff --git a/src/jrd/blb.h b/src/jrd/blb.h index 4ccd5ac43a..52128374bd 100644 --- a/src/jrd/blb.h +++ b/src/jrd/blb.h @@ -98,7 +98,7 @@ public: void BLB_cancel(thread_db* tdbb); void BLB_check_well_formed(thread_db*, const dsc* desc); - void BLB_close(thread_db*); + bool BLB_close(thread_db*); static blb* create(thread_db*, jrd_tra*, bid*); static blb* create2(thread_db*, jrd_tra*, bid*, USHORT, const UCHAR*, bool = false); static Jrd::blb* get_array(Jrd::thread_db*, Jrd::jrd_tra*, const Jrd::bid*, Ods::InternalArrayDesc*); diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index f13c15f88b..bcffc10a6b 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -2134,7 +2134,8 @@ void JBlob::close(CheckStatusWrapper* user_status) try { - getHandle()->BLB_close(tdbb); + if (!getHandle()->BLB_close(tdbb)) + getHandle()->blb_interface = NULL; blob = NULL; } catch (const Exception& ex)