From 714c151a2dbab58cb843019d6258af99e6152f15 Mon Sep 17 00:00:00 2001 From: hvlad Date: Fri, 16 May 2014 10:53:28 +0000 Subject: [PATCH] Front ported fix for bug CORE-4372 : Deadlock is possible when two data pages contains record fragments pointing to each other --- src/jrd/dpm.epp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/jrd/dpm.epp b/src/jrd/dpm.epp index 22abb3e4ff..75703787a6 100644 --- a/src/jrd/dpm.epp +++ b/src/jrd/dpm.epp @@ -3018,6 +3018,14 @@ static rhd* locate_space(thread_db* tdbb, if (dp_number && !PPG_DP_BIT_TEST(bits, slot, ppg_dp_full) && ((type == DPM_primary) ^ dp_is_secondary)) { + // hvlad: to avoid deadlocks in DPM_fetch_fragment enforce ascending + // order of pages for record fragments + if (rpb->rpb_flags & rpb_fragment && type == DPM_other && + rpb->rpb_page > dp_number) + { + continue; + } + CCH_HANDOFF(tdbb, window, dp_number, LCK_write, pag_data); UCHAR* space = find_space(tdbb, rpb, size, stack, record, type); if (space)