| 213 | const ULONG IS_LARGE_SCAN = 0x02; // relation not fits into page cache |
| 214 | |
| 215 | IndexCreateTask(thread_db* tdbb, MemoryPool* pool, IndexCreation* creation) : Task(), |
| 216 | m_pool(pool), |
| 217 | m_dbb(tdbb->getDatabase()), |
| 218 | m_tdbb_flags(tdbb->tdbb_flags), |
| 219 | m_flags(0), |
| 220 | m_creation(creation), |
| 221 | m_items(*m_pool), |
| 222 | m_stop(false), |
| 223 | m_countPP(0), |
| 224 | m_nextPP(0) |
| 225 | { |
| 226 | Attachment* att = tdbb->getAttachment(); |
| 227 | |
| 228 | if (att->isGbak()) |
| 229 | m_flags |= IS_GBAK; |
| 230 | |
| 231 | m_exprBlob.clear(); |
| 232 | m_condBlob.clear(); |
| 233 | |
| 234 | int workers = 1; |
| 235 | if (att->att_parallel_workers > 0) |
| 236 | workers = att->att_parallel_workers; |
| 237 | |
| 238 | // Classic in single-user shutdown mode can't create additional worker attachments |
| 239 | if ((m_dbb->dbb_ast_flags & DBB_shutdown_single) && !(m_dbb->dbb_flags & DBB_shared)) |
| 240 | workers = 1; |
| 241 | |
| 242 | for (int i = 0; i < workers; i++) |
| 243 | m_items.add(FB_NEW_POOL(*m_pool) Item(this)); |
| 244 | |
| 245 | m_items[0]->m_ownAttach = false; |
| 246 | m_items[0]->m_attStable = att->getStable(); |
| 247 | m_items[0]->m_tra = m_creation->transaction; |
| 248 | |
| 249 | if (m_creation) |
| 250 | { |
| 251 | // Unless this is the only attachment or a database restore, worry about |
| 252 | // preserving the page working sets of other attachments. |
| 253 | if (att && (att != m_dbb->dbb_attachments || att->att_next)) |
| 254 | { |
| 255 | if (att->isGbak() || DPM_data_pages(tdbb, m_creation->relation) > m_dbb->dbb_bcb->bcb_count) |
| 256 | m_flags |= IS_LARGE_SCAN; |
| 257 | } |
| 258 | |
| 259 | m_countPP = DPM_pointer_pages(tdbb, m_creation->relation); |
| 260 | |
| 261 | if ((m_creation->index->idx_flags & (idx_expression | idx_condition)) && (workers > 1)) |
| 262 | MET_lookup_index_expr_cond_blr(tdbb, m_creation->index_name, m_exprBlob, m_condBlob); |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | virtual ~IndexCreateTask() |
| 267 | { |
nothing calls this directly
no test coverage detected