Commit f77ba282 authored by unknown's avatar unknown

Bug #28593 cluster backup scans in acc index order, bad for disk data

- change to scan in tup and disk order (if applicable)


storage/ndb/src/kernel/blocks/backup/Backup.cpp:
  tup scan for backup also, not only lcp
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  choose disk order scan for disktables during backup
  + move bug workaround for 27776 from tup to lqh
storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp:
  add missing jamEntry
storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp:
  move bug workaround for 27776 from tup to lqh
storage/ndb/src/kernel/blocks/pgman.cpp:
  missing jamEntry
parent af5bb184
...@@ -3543,10 +3543,10 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal) ...@@ -3543,10 +3543,10 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal)
ScanFragReq::setHoldLockFlag(req->requestInfo, 0); ScanFragReq::setHoldLockFlag(req->requestInfo, 0);
ScanFragReq::setKeyinfoFlag(req->requestInfo, 0); ScanFragReq::setKeyinfoFlag(req->requestInfo, 0);
ScanFragReq::setAttrLen(req->requestInfo,attrLen); ScanFragReq::setAttrLen(req->requestInfo,attrLen);
ScanFragReq::setTupScanFlag(req->requestInfo, 1);
if (ptr.p->is_lcp()) if (ptr.p->is_lcp())
{ {
ScanFragReq::setScanPrio(req->requestInfo, 1); ScanFragReq::setScanPrio(req->requestInfo, 1);
ScanFragReq::setTupScanFlag(req->requestInfo, 1);
ScanFragReq::setNoDiskFlag(req->requestInfo, 1); ScanFragReq::setNoDiskFlag(req->requestInfo, 1);
ScanFragReq::setLcpScanFlag(req->requestInfo, 1); ScanFragReq::setLcpScanFlag(req->requestInfo, 1);
} }
......
...@@ -8476,9 +8476,32 @@ void Dblqh::continueAfterReceivingAllAiLab(Signal* signal) ...@@ -8476,9 +8476,32 @@ void Dblqh::continueAfterReceivingAllAiLab(Signal* signal)
AccScanReq::setLockMode(req->requestInfo, scanptr.p->scanLockMode); AccScanReq::setLockMode(req->requestInfo, scanptr.p->scanLockMode);
AccScanReq::setReadCommittedFlag(req->requestInfo, scanptr.p->readCommitted); AccScanReq::setReadCommittedFlag(req->requestInfo, scanptr.p->readCommitted);
AccScanReq::setDescendingFlag(req->requestInfo, scanptr.p->descending); AccScanReq::setDescendingFlag(req->requestInfo, scanptr.p->descending);
AccScanReq::setNoDiskScanFlag(req->requestInfo,
!tcConnectptr.p->m_disk_table); if (refToBlock(tcConnectptr.p->clientBlockref) == BACKUP)
AccScanReq::setLcpScanFlag(req->requestInfo, scanptr.p->lcpScan); {
if (scanptr.p->lcpScan)
{
AccScanReq::setNoDiskScanFlag(req->requestInfo, 1);
AccScanReq::setLcpScanFlag(req->requestInfo, 1);
}
else
{
/* If backup scan disktables in disk order */
AccScanReq::setNoDiskScanFlag(req->requestInfo,
!tcConnectptr.p->m_disk_table);
AccScanReq::setLcpScanFlag(req->requestInfo, 0);
}
}
else
{
#if BUG_27776_FIXED
AccScanReq::setNoDiskScanFlag(req->requestInfo,
!tcConnectptr.p->m_disk_table);
#else
AccScanReq::setNoDiskScanFlag(req->requestInfo, 1);
#endif
AccScanReq::setLcpScanFlag(req->requestInfo, 0);
}
req->transId1 = tcConnectptr.p->transid[0]; req->transId1 = tcConnectptr.p->transid[0];
req->transId2 = tcConnectptr.p->transid[1]; req->transId2 = tcConnectptr.p->transid[1];
......
...@@ -318,6 +318,7 @@ Dbtup::restart_setup_page(Disk_alloc_info& alloc, PagePtr pagePtr) ...@@ -318,6 +318,7 @@ Dbtup::restart_setup_page(Disk_alloc_info& alloc, PagePtr pagePtr)
unsigned uncommitted, committed; unsigned uncommitted, committed;
uncommitted = committed = ~(unsigned)0; uncommitted = committed = ~(unsigned)0;
int ret = tsman.get_page_free_bits(&page, &uncommitted, &committed); int ret = tsman.get_page_free_bits(&page, &uncommitted, &committed);
jamEntry();
idx = alloc.calc_page_free_bits(real_free); idx = alloc.calc_page_free_bits(real_free);
ddassert(idx == committed); ddassert(idx == committed);
...@@ -428,12 +429,12 @@ Dbtup::disk_page_prealloc(Signal* signal, ...@@ -428,12 +429,12 @@ Dbtup::disk_page_prealloc(Signal* signal,
c_extent_pool.getPtr(ext); c_extent_pool.getPtr(ext);
if ((pageBits= tsman.alloc_page_from_extent(&ext.p->m_key, bits)) >= 0) if ((pageBits= tsman.alloc_page_from_extent(&ext.p->m_key, bits)) >= 0)
{ {
jam(); jamEntry();
found= true; found= true;
} }
else else
{ {
jam(); jamEntry();
/** /**
* The current extent is not in a free list * The current extent is not in a free list
* and since it couldn't accomadate the request * and since it couldn't accomadate the request
...@@ -490,7 +491,7 @@ Dbtup::disk_page_prealloc(Signal* signal, ...@@ -490,7 +491,7 @@ Dbtup::disk_page_prealloc(Signal* signal,
if ((err= tsman.alloc_extent(&ext.p->m_key)) < 0) if ((err= tsman.alloc_extent(&ext.p->m_key)) < 0)
{ {
jam(); jamEntry();
#if NOT_YET_UNDO_ALLOC_EXTENT #if NOT_YET_UNDO_ALLOC_EXTENT
c_lgman->free_log_space(logfile_group_id, c_lgman->free_log_space(logfile_group_id,
sizeof(Disk_undo::AllocExtent)>>2); sizeof(Disk_undo::AllocExtent)>>2);
...@@ -542,6 +543,7 @@ Dbtup::disk_page_prealloc(Signal* signal, ...@@ -542,6 +543,7 @@ Dbtup::disk_page_prealloc(Signal* signal,
alloc.m_curr_extent_info_ptr_i= ext.i; alloc.m_curr_extent_info_ptr_i= ext.i;
ext.p->m_free_matrix_pos= RNIL; ext.p->m_free_matrix_pos= RNIL;
pageBits= tsman.alloc_page_from_extent(&ext.p->m_key, bits); pageBits= tsman.alloc_page_from_extent(&ext.p->m_key, bits);
jamEntry();
ddassert(pageBits >= 0); ddassert(pageBits >= 0);
} }
...@@ -601,6 +603,7 @@ Dbtup::disk_page_prealloc(Signal* signal, ...@@ -601,6 +603,7 @@ Dbtup::disk_page_prealloc(Signal* signal,
} }
int res= m_pgman.get_page(signal, preq, flags); int res= m_pgman.get_page(signal, preq, flags);
jamEntry();
switch(res) switch(res)
{ {
case 0: case 0:
...@@ -900,6 +903,7 @@ Dbtup::disk_page_set_dirty(PagePtr pagePtr) ...@@ -900,6 +903,7 @@ Dbtup::disk_page_set_dirty(PagePtr pagePtr)
// Make sure no one will allocate it... // Make sure no one will allocate it...
tsman.unmap_page(&key, MAX_FREE_LIST - 1); tsman.unmap_page(&key, MAX_FREE_LIST - 1);
jamEntry();
} }
void void
...@@ -951,6 +955,7 @@ Dbtup::disk_page_unmap_callback(Uint32 page_id, Uint32 dirty_count) ...@@ -951,6 +955,7 @@ Dbtup::disk_page_unmap_callback(Uint32 page_id, Uint32 dirty_count)
fragPtr.p->m_tablespace_id); fragPtr.p->m_tablespace_id);
tsman.unmap_page(&key, idx); tsman.unmap_page(&key, idx);
jamEntry();
pagePtr.p->list_index = idx | 0x8000; pagePtr.p->list_index = idx | 0x8000;
} }
...@@ -999,6 +1004,7 @@ Dbtup::disk_page_alloc(Signal* signal, ...@@ -999,6 +1004,7 @@ Dbtup::disk_page_alloc(Signal* signal,
fragPtrP->m_tablespace_id); fragPtrP->m_tablespace_id);
tsman.update_page_free_bits(key, new_bits, lsn); tsman.update_page_free_bits(key, new_bits, lsn);
jamEntry();
} }
} }
...@@ -1051,6 +1057,7 @@ Dbtup::disk_page_free(Signal *signal, ...@@ -1051,6 +1057,7 @@ Dbtup::disk_page_free(Signal *signal,
fragPtrP->m_tablespace_id); fragPtrP->m_tablespace_id);
tsman.update_page_free_bits(key, new_bits, lsn); tsman.update_page_free_bits(key, new_bits, lsn);
jamEntry();
} }
Uint32 ext = pagePtr.p->m_extent_info_ptr; Uint32 ext = pagePtr.p->m_extent_info_ptr;
...@@ -1104,6 +1111,7 @@ Dbtup::disk_page_abort_prealloc(Signal *signal, Fragrecord* fragPtrP, ...@@ -1104,6 +1111,7 @@ Dbtup::disk_page_abort_prealloc(Signal *signal, Fragrecord* fragPtrP,
memcpy(&req.m_page, key, sizeof(Local_key)); memcpy(&req.m_page, key, sizeof(Local_key));
int res= m_pgman.get_page(signal, req, flags); int res= m_pgman.get_page(signal, req, flags);
jamEntry();
switch(res) switch(res)
{ {
case 0: case 0:
...@@ -1232,6 +1240,7 @@ Dbtup::disk_page_alloc_extent_log_buffer_callback(Signal* signal, ...@@ -1232,6 +1240,7 @@ Dbtup::disk_page_alloc_extent_log_buffer_callback(Signal* signal,
Uint64 lsn= lgman.add_entry(c, 1); Uint64 lsn= lgman.add_entry(c, 1);
tsman.update_lsn(&key, lsn); tsman.update_lsn(&key, lsn);
jamEntry();
} }
#endif #endif
...@@ -1250,6 +1259,7 @@ Dbtup::disk_page_undo_alloc(Page* page, const Local_key* key, ...@@ -1250,6 +1259,7 @@ Dbtup::disk_page_undo_alloc(Page* page, const Local_key* key,
Uint64 lsn= lgman.add_entry(c, 1); Uint64 lsn= lgman.add_entry(c, 1);
m_pgman.update_lsn(* key, lsn); m_pgman.update_lsn(* key, lsn);
jamEntry();
return lsn; return lsn;
} }
...@@ -1279,6 +1289,7 @@ Dbtup::disk_page_undo_update(Page* page, const Local_key* key, ...@@ -1279,6 +1289,7 @@ Dbtup::disk_page_undo_update(Page* page, const Local_key* key,
Uint64 lsn= lgman.add_entry(c, 3); Uint64 lsn= lgman.add_entry(c, 3);
m_pgman.update_lsn(* key, lsn); m_pgman.update_lsn(* key, lsn);
jamEntry();
return lsn; return lsn;
} }
...@@ -1308,6 +1319,7 @@ Dbtup::disk_page_undo_free(Page* page, const Local_key* key, ...@@ -1308,6 +1319,7 @@ Dbtup::disk_page_undo_free(Page* page, const Local_key* key,
Uint64 lsn= lgman.add_entry(c, 3); Uint64 lsn= lgman.add_entry(c, 3);
m_pgman.update_lsn(* key, lsn); m_pgman.update_lsn(* key, lsn);
jamEntry();
return lsn; return lsn;
} }
...@@ -1402,6 +1414,7 @@ Dbtup::disk_restart_undo(Signal* signal, Uint64 lsn, ...@@ -1402,6 +1414,7 @@ Dbtup::disk_restart_undo(Signal* signal, Uint64 lsn,
int flags = 0; int flags = 0;
int res= m_pgman.get_page(signal, preq, flags); int res= m_pgman.get_page(signal, preq, flags);
jamEntry();
switch(res) switch(res)
{ {
case 0: case 0:
...@@ -1545,6 +1558,7 @@ Dbtup::disk_restart_undo_callback(Signal* signal, ...@@ -1545,6 +1558,7 @@ Dbtup::disk_restart_undo_callback(Signal* signal,
lsn = undo->m_lsn - 1; // make sure undo isn't run again... lsn = undo->m_lsn - 1; // make sure undo isn't run again...
m_pgman.update_lsn(undo->m_key, lsn); m_pgman.update_lsn(undo->m_key, lsn);
jamEntry();
} }
else if (DBG_UNDO) else if (DBG_UNDO)
{ {
...@@ -1637,6 +1651,7 @@ Dbtup::disk_restart_undo_page_bits(Signal* signal, Apply_undo* undo) ...@@ -1637,6 +1651,7 @@ Dbtup::disk_restart_undo_page_bits(Signal* signal, Apply_undo* undo)
fragPtrP->m_tablespace_id); fragPtrP->m_tablespace_id);
tsman.restart_undo_page_free_bits(&undo->m_key, new_bits, undo->m_lsn, lsn); tsman.restart_undo_page_free_bits(&undo->m_key, new_bits, undo->m_lsn, lsn);
jamEntry();
} }
int int
......
...@@ -62,13 +62,11 @@ Dbtup::execACC_SCANREQ(Signal* signal) ...@@ -62,13 +62,11 @@ Dbtup::execACC_SCANREQ(Signal* signal)
break; break;
} }
#if BUG_27776_FIXED
if (!AccScanReq::getNoDiskScanFlag(req->requestInfo) if (!AccScanReq::getNoDiskScanFlag(req->requestInfo)
&& tablePtr.p->m_no_of_disk_attributes) && tablePtr.p->m_no_of_disk_attributes)
{ {
bits |= ScanOp::SCAN_DD; bits |= ScanOp::SCAN_DD;
} }
#endif
bool mm = (bits & ScanOp::SCAN_DD); bool mm = (bits & ScanOp::SCAN_DD);
if (tablePtr.p->m_attributes[mm].m_no_of_varsize > 0) { if (tablePtr.p->m_attributes[mm].m_no_of_varsize > 0) {
......
...@@ -1561,6 +1561,7 @@ Pgman::execFSWRITEREF(Signal* signal) ...@@ -1561,6 +1561,7 @@ Pgman::execFSWRITEREF(Signal* signal)
int int
Pgman::get_page(Signal* signal, Ptr<Page_entry> ptr, Page_request page_req) Pgman::get_page(Signal* signal, Ptr<Page_entry> ptr, Page_request page_req)
{ {
jamEntry();
#ifdef VM_TRACE #ifdef VM_TRACE
Ptr<Page_request> tmp = { &page_req, RNIL}; Ptr<Page_request> tmp = { &page_req, RNIL};
debugOut << "PGMAN: >get_page" << endl; debugOut << "PGMAN: >get_page" << endl;
...@@ -1708,6 +1709,7 @@ Pgman::get_page(Signal* signal, Ptr<Page_entry> ptr, Page_request page_req) ...@@ -1708,6 +1709,7 @@ Pgman::get_page(Signal* signal, Ptr<Page_entry> ptr, Page_request page_req)
void void
Pgman::update_lsn(Ptr<Page_entry> ptr, Uint32 block, Uint64 lsn) Pgman::update_lsn(Ptr<Page_entry> ptr, Uint32 block, Uint64 lsn)
{ {
jamEntry();
#ifdef VM_TRACE #ifdef VM_TRACE
const char* bname = getBlockName(block, "?"); const char* bname = getBlockName(block, "?");
debugOut << "PGMAN: >update_lsn: block=" << bname << " lsn=" << lsn << endl; debugOut << "PGMAN: >update_lsn: block=" << bname << " lsn=" << lsn << endl;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment