Skip to content

Commit

Permalink
Addition for CORE-6043 : GTTs do not release used space
Browse files Browse the repository at this point in the history
corrected CCH_clean_page, fixed typo
  • Loading branch information
hvlad committed Apr 9, 2019
1 parent b2c0d17 commit a1cfe74
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions src/jrd/cch.cpp
Expand Up @@ -132,6 +132,7 @@ static void prefetch_init(Prefetch*, thread_db*);
static void prefetch_io(Prefetch*, ISC_STATUS *);
static void prefetch_prologue(Prefetch*, SLONG *);
#endif
static void purgePrecedence(BufferControl*, BufferDesc*);
static SSHORT related(BufferDesc*, const BufferDesc*, SSHORT, const ULONG);
static void release_bdb(thread_db*, BufferDesc*, const bool, const bool, const bool);
static void unmark(thread_db*, WIN*);
Expand Down Expand Up @@ -389,6 +390,19 @@ void CCH_clean_page(thread_db* tdbb, PageNumber page)
if (latch_bdb(tdbb, LATCH_exclusive, bdb, page, 0) != 0)
return;

// temporary pages should have no precedence relationship
if (!QUE_EMPTY(bdb->bdb_higher))
purgePrecedence(bcb, bdb);

fb_assert(QUE_EMPTY(bdb->bdb_higher));
fb_assert(QUE_EMPTY(bdb->bdb_lower));

if (!QUE_EMPTY(bdb->bdb_lower) || !QUE_EMPTY(bdb->bdb_higher))
{
release_bdb(tdbb, bdb, true, false, false);
return;
}

if (bdb->bdb_flags & (BDB_dirty | BDB_db_dirty))
{
bdb->bdb_difference_page = 0;
Expand All @@ -405,11 +419,10 @@ void CCH_clean_page(thread_db* tdbb, PageNumber page)
btc_remove(bdb);
}
#endif
bdb->bdb_flags &= ~(BDB_must_write | BDB_system_dirty);
bdb->bdb_flags &= ~(BDB_must_write | BDB_system_dirty | BDB_db_dirty);
clear_dirty_flag(tdbb, bdb);
}

clear_precedence(tdbb, bdb);
QUE_LEAST_RECENTLY_USED(bdb->bdb_in_use);

release_bdb(tdbb, bdb, true, false, false);
Expand Down
2 changes: 1 addition & 1 deletion src/jrd/tra.cpp
Expand Up @@ -2598,7 +2598,7 @@ static void release_temp_tables(thread_db* tdbb, jrd_tra* transaction)
{
/**************************************
*
* r el e a s e _ t e m p _ t a b l e s
* r e l e a s e _ t e m p _ t a b l e s
*
**************************************
*
Expand Down

0 comments on commit a1cfe74

Please sign in to comment.