Skip to content

Commit df4d5b3

Browse files
committed
New implementation of bulk insert
1 parent 7163d73 commit df4d5b3

File tree

18 files changed

+1145
-28
lines changed

18 files changed

+1145
-28
lines changed

builds/win32/msvc15/engine_static.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
<ClCompile Include="..\..\..\src\jrd\blb.cpp" />
7070
<ClCompile Include="..\..\..\src\jrd\blob_filter.cpp" />
7171
<ClCompile Include="..\..\..\src\jrd\BlobUtil.cpp" />
72+
<ClCompile Include="..\..\..\src\jrd\BulkInsert.cpp" />
7273
<ClCompile Include="..\..\..\src\jrd\btn.cpp" />
7374
<ClCompile Include="..\..\..\src\jrd\btr.cpp" />
7475
<ClCompile Include="..\..\..\src\jrd\builtin.cpp" />
@@ -241,6 +242,7 @@
241242
<ClInclude Include="..\..\..\src\jrd\blf_proto.h" />
242243
<ClInclude Include="..\..\..\src\jrd\blob_filter.h" />
243244
<ClInclude Include="..\..\..\src\jrd\BlobUtil.h" />
245+
<ClInclude Include="..\..\..\src\jrd\BulkInsert.h" />
244246
<ClInclude Include="..\..\..\src\jrd\blp.h" />
245247
<ClInclude Include="..\..\..\src\jrd\btn.h" />
246248
<ClInclude Include="..\..\..\src\jrd\btr.h" />

builds/win32/msvc15/engine_static.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@
228228
<ClCompile Include="..\..\..\src\jrd\BlobUtil.cpp">
229229
<Filter>JRD files</Filter>
230230
</ClCompile>
231+
<ClCompile Include="..\..\..\src\jrd\BulkInsert.cpp">
232+
<Filter>JRD files</Filter>
233+
</ClCompile>
231234
<ClCompile Include="..\..\..\src\jrd\btn.cpp">
232235
<Filter>JRD files</Filter>
233236
</ClCompile>
@@ -719,6 +722,9 @@
719722
<ClInclude Include="..\..\..\src\jrd\BlobUtil.h">
720723
<Filter>Header files</Filter>
721724
</ClInclude>
725+
<ClInclude Include="..\..\..\src\jrd\BulkInsert.h">
726+
<Filter>Header files</Filter>
727+
</ClInclude>
722728
<ClInclude Include="..\..\..\src\jrd\blp.h">
723729
<Filter>Header files</Filter>
724730
</ClInclude>

src/burp/restore.epp

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13503,6 +13503,8 @@ bool WriteRelationMeta::prepareBatch(BurpGlobals* tdgbl)
1350313503

1350413504
void WriteRelationMeta::prepareRequest(BurpGlobals* tdgbl)
1350513505
{
13506+
const bool use_bulk_insert = (tdgbl->runtimeODS >= DB_VERSION_DDL14);
13507+
1350613508
m_batchMode = false;
1350713509
m_inMgsNum = 0;
1350813510

@@ -13657,18 +13659,27 @@ void WriteRelationMeta::prepareRequest(BurpGlobals* tdgbl)
1365713659
add_byte(blr, blr_loop);
1365813660
add_byte(blr, blr_receive);
1365913661
add_byte(blr, 0);
13660-
if (identity_type == IDENT_TYPE_ALWAYS)
13662+
13663+
if (!use_bulk_insert)
1366113664
{
13662-
add_byte(blr, blr_store3);
13663-
add_byte(blr, blr_store_override_system);
13665+
if (identity_type == IDENT_TYPE_ALWAYS)
13666+
{
13667+
add_byte(blr, blr_store3);
13668+
add_byte(blr, blr_store_override_system);
13669+
}
13670+
else
13671+
add_byte(blr, blr_store);
13672+
13673+
// Mark this store operation as bulk one
13674+
add_byte(blr, blr_marks);
13675+
add_byte(blr, 1);
13676+
add_byte(blr, 0x10); // must be Jrd::StatementNode::MARK_BULK_INSERT
1366413677
}
1366513678
else
13666-
add_byte(blr, blr_store);
13667-
13668-
// Mark this store operation as bulk one
13669-
add_byte(blr, blr_marks);
13670-
add_byte(blr, 1);
13671-
add_byte(blr, 0x10); // must be Jrd::StatementNode::MARK_BULK_INSERT
13679+
{
13680+
add_byte(blr, blr_bulk_insert);
13681+
add_byte(blr, blr_null); // no source RSE
13682+
}
1367213683

1367313684
if (m_relation->rel_name.schema.hasData())
1367413685
{
@@ -13710,8 +13721,11 @@ void WriteRelationMeta::prepareRequest(BurpGlobals* tdgbl)
1371013721
}
1371113722

1371213723
add_byte(blr, blr_end);
13713-
if (identity_type == IDENT_TYPE_ALWAYS)
13714-
add_byte(blr, blr_null);
13724+
if (!use_bulk_insert)
13725+
{
13726+
if (identity_type == IDENT_TYPE_ALWAYS)
13727+
add_byte(blr, blr_null);
13728+
}
1371513729
add_byte(blr, blr_end);
1371613730
add_byte(blr, blr_eoc);
1371713731

@@ -13811,7 +13825,7 @@ void WriteRelationReq::send(BurpGlobals* tdgbl, ITransaction* tran, bool lastRec
1381113825
// memory when there are blobs and arrays fields - CORE-3802.
1381213826

1381313827
FbLocalStatus status;
13814-
if (m_resync || m_recs % 1000 == 1)
13828+
if (m_resync || ((m_recs % 1000 == 1) && !tdgbl->gbl_use_auto_release_temp_blobid))
1381513829
m_request->startAndSend(&status, tran, 0, 0, m_inMsg.getCount(), m_inMsg.begin());
1381613830
else
1381713831
m_request->send(&status, 0, 0, m_inMsg.getCount(), m_inMsg.begin());

src/dsql/Nodes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,7 @@ class StmtNode : public DmlNode
14541454
{
14551455
TYPE_ASSIGNMENT,
14561456
TYPE_BLOCK,
1457+
TYPE_BULK_INSERT,
14571458
TYPE_COMPOUND_STMT,
14581459
TYPE_CONTINUE_LEAVE,
14591460
TYPE_CURSOR_STMT,

0 commit comments

Comments
 (0)