Skip to content

Commit 4b71466

Browse files
committed
Cleanup old bulk insert code
1 parent 8ec5011 commit 4b71466

7 files changed

Lines changed: 8 additions & 35 deletions

File tree

src/dsql/StmtNodes.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9678,9 +9678,6 @@ const StmtNode* StoreNode::store(thread_db* tdbb, Request* request, WhichTrigger
96789678
record_param* rpb = &request->req_rpb[stream];
96799679
jrd_rel* relation = rpb->rpb_relation;
96809680

9681-
if ((marks & MARK_BULK_INSERT) || request->req_batch_mode)
9682-
rpb->rpb_stream_flags |= RPB_s_bulk;
9683-
96849681
const auto localTableSource = nodeAs<LocalTableSourceNode>(target);
96859682
const auto localTable = localTableSource ?
96869683
request->getStatement()->localTables[localTableSource->tableNumber] :

src/dsql/StmtNodes.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class RecordBuffer;
4444
class RelationSourceNode;
4545
class SelectNode;
4646
class GeneratorItem;
47-
class BulkInsert;
4847

4948

5049
class ExceptionItem final : public Firebird::PermanentStorage, public Printable

src/jrd/blb.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,12 +1264,7 @@ void blb::move(thread_db* tdbb, dsc* from_desc, dsc* to_desc,
12641264
if (bulkInsert)
12651265
destination->set_permanent(relation->getId(), bulkInsert->putBlob(tdbb, blob, record));
12661266
else
1267-
{
1268-
if (bulk)
1269-
blob->blb_flags |= BLB_bulk;
1270-
12711267
destination->set_permanent(relation->getId(), DPM_store_blob(tdbb, blob, relation, record));
1272-
}
12731268

12741269
// This is the only place in the engine where blobs are materialized
12751270
// If new places appear code below should transform to common sub-routine

src/jrd/blb.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ inline constexpr int BLB_damaged = 16; // Blob is busted
182182
inline constexpr int BLB_seek = 32; // Seek is pending
183183
inline constexpr int BLB_large_scan = 64; // Blob is larger than page buffer cache
184184
inline constexpr int BLB_close_on_read = 128; // Temporary blob is not closed until read
185-
inline constexpr int BLB_bulk = 256; // Blob created by bulk insert operation
186-
inline constexpr int BLB_user = 512; // User-defined blob
185+
inline constexpr int BLB_user = 256; // User-defined blob
187186

188187
/* Blob levels are:
189188

src/jrd/dpm.epp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2488,9 +2488,6 @@ RecordNumber DPM_store_blob(thread_db* tdbb, blb* blob, jrd_rel* relation, Recor
24882488
rpb.rpb_transaction_nr = tdbb->getTransaction()->tra_number;
24892489
rpb.rpb_flags = rpb_blob;
24902490

2491-
if (blob->blb_flags & BLB_bulk)
2492-
rpb.rpb_stream_flags |= RPB_s_bulk;
2493-
24942491
blh* header = (blh*) locate_space(tdbb, &rpb, (SSHORT) (BLH_SIZE + length),
24952492
stack, record, DPM_other);
24962493
header->blh_flags = rhd_blob;
@@ -3691,17 +3688,9 @@ static rhd* locate_space(thread_db* tdbb,
36913688
ULONG pp_sequence =
36923689
(type == DPM_primary ? relPages->rel_pri_data_space : relPages->rel_sec_data_space);
36933690

3694-
const bool bulkInsert = (type == DPM_primary || isBlob) && (rpb->rpb_stream_flags & RPB_s_bulk);
3695-
36963691
for (;; pp_sequence++)
36973692
{
3698-
// Bulk inserts looks up for empty DP only to avoid contention with
3699-
// another attachments doing bulk inserts. Note, DP number is saved in
3700-
// relPages->rel_last_free_pri_dp and next insert by same attachment
3701-
// will use same DP while concurrent bulk attachments will ignore it as
3702-
// non-empty. Take write lock on PP early to clear 'empty' flag.
3703-
3704-
locklevel_t ppLock = bulkInsert ? LCK_write : LCK_read;
3693+
locklevel_t ppLock = LCK_read;
37053694

37063695
if (type == DPM_primary)
37073696
relPages->rel_pri_data_space = pp_sequence;
@@ -3745,9 +3734,6 @@ static rhd* locate_space(thread_db* tdbb,
37453734
bool dp_is_empty = PPG_DP_BIT_TEST(bits, slot, ppg_dp_empty);
37463735
bool dp_is_secondary = PPG_DP_BIT_TEST(bits, slot, ppg_dp_secondary);
37473736

3748-
if (bulkInsert && !dp_is_empty)
3749-
continue;
3750-
37513737
if (dp_is_empty)
37523738
{
37533739
if (ppLock == LCK_read)

src/jrd/exe.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,6 @@ void EXE_assignment(thread_db* tdbb, const ValueExprNode* to, dsc* from_desc,
473473
jrd_rel* relation = nullptr;
474474
Record* record = nullptr;
475475
USHORT fieldId = 0;
476-
bool bulk = false;
477476

478477
if (to)
479478
{
@@ -484,13 +483,12 @@ void EXE_assignment(thread_db* tdbb, const ValueExprNode* to, dsc* from_desc,
484483
relation = rpb->rpb_relation;
485484
record = rpb->rpb_record;
486485
fieldId = toField->fieldId;
487-
bulk = rpb->rpb_stream_flags & RPB_s_bulk;
488486
}
489487
else if (!(nodeAs<ParameterNode>(to) || nodeAs<VariableNode>(to)))
490488
BUGCHECK(199); // msg 199 expected field node
491489
}
492490

493-
blb::move(tdbb, from_desc, to_desc, relation, record, fieldId, bulk);
491+
blb::move(tdbb, from_desc, to_desc, relation, record, fieldId);
494492
}
495493
else if (!DSC_EQUIV(from_desc, to_desc, false))
496494
{

src/jrd/req.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,11 @@ inline constexpr USHORT rpb_not_packed = 2048; // record (or delta) is stored "
155155

156156
// Stream flags
157157

158-
inline constexpr USHORT RPB_s_update = 0x01; // input stream fetched for update
159-
inline constexpr USHORT RPB_s_no_data = 0x02; // nobody is going to access the data
160-
inline constexpr USHORT RPB_s_sweeper = 0x04; // garbage collector - skip swept pages
161-
inline constexpr USHORT RPB_s_unstable = 0x08; // don't use undo log, used with unstable explicit cursors
162-
inline constexpr USHORT RPB_s_bulk = 0x10; // bulk operation (currently insert only)
163-
inline constexpr USHORT RPB_s_skipLocked = 0x20; // skip locked record
158+
inline constexpr USHORT RPB_s_update = 0x01; // input stream fetched for update
159+
inline constexpr USHORT RPB_s_no_data = 0x02; // nobody is going to access the data
160+
inline constexpr USHORT RPB_s_sweeper = 0x04; // garbage collector - skip swept pages
161+
inline constexpr USHORT RPB_s_unstable = 0x08; // don't use undo log, used with unstable explicit cursors
162+
inline constexpr USHORT RPB_s_skipLocked = 0x10; // skip locked record
164163

165164
// Runtime flags
166165

0 commit comments

Comments
 (0)