|
63 | 63 | #include "../common/dsc_proto.h" |
64 | 64 | #include "../common/ThreadStart.h" |
65 | 65 | #include "../common/msg_encode.h" |
| 66 | +#include "../common/classes/BatchCompletionState.h" |
66 | 67 |
|
67 | 68 | using MsgFormat::SafeArg; |
68 | 69 | using namespace Firebird; |
@@ -2311,7 +2312,6 @@ void get_blob(BurpGlobals* tdgbl, IBatch* batch, const burp_fld* fields, UCHAR* |
2311 | 2312 | } |
2312 | 2313 |
|
2313 | 2314 | // Eat up blob segments |
2314 | | - |
2315 | 2315 | for (; segments > 0; --segments) |
2316 | 2316 | { |
2317 | 2317 | USHORT length = get(tdgbl); |
@@ -11672,6 +11672,7 @@ void WriteRelationMeta::clear() |
11672 | 11672 | m_blr.clear(); |
11673 | 11673 | m_inMgsNum = 0; |
11674 | 11674 | m_inMsgLen = 0; |
| 11675 | + m_blobCount = 0; |
11675 | 11676 | } |
11676 | 11677 |
|
11677 | 11678 | void WriteRelationMeta::setRelation(BurpGlobals* tdgbl, const burp_rel* relation) |
@@ -11793,11 +11794,17 @@ IBatch* WriteRelationMeta::createBatch(BurpGlobals* tdgbl, IAttachment* att) |
11793 | 11794 | // correct batchStep if necessary |
11794 | 11795 | unsigned msgSize = m_batchMeta->getAlignedLength(&tdgbl->throwStatus); |
11795 | 11796 | if (msgSize * m_batchStep > bufSize) |
| 11797 | + { |
11796 | 11798 | m_batchStep = bufSize / msgSize; |
| 11799 | + m_blobCount++; // looks like we are under low ram conditions on server... |
| 11800 | + // make batch step even smaller if we have some blobs |
| 11801 | + } |
| 11802 | + if (m_blobCount) |
| 11803 | + m_batchStep /= m_blobCount; |
11797 | 11804 |
|
11798 | 11805 | // determine maximum blob size for inline transfer |
11799 | 11806 | m_batchInlineBlobLimit = bufSize / m_batchStep; |
11800 | | - // take into an account: blob alignment header size |
| 11807 | + // take into an account: blob alignment header size |
11801 | 11808 | m_batchInlineBlobLimit -= ((blAlign - 1) + blHdr); |
11802 | 11809 | } |
11803 | 11810 | fb_assert(m_batchInlineBlobLimit); |
@@ -11877,6 +11884,8 @@ bool WriteRelationMeta::prepareBatch(BurpGlobals* tdgbl) |
11877 | 11884 | offset = FB_ALIGN(offset, alignment); |
11878 | 11885 | field->fld_offset = offset; |
11879 | 11886 | offset += field->fld_total_len = desc.dsc_length; |
| 11887 | + if (desc.isBlob()) |
| 11888 | + ++m_blobCount; |
11880 | 11889 |
|
11881 | 11890 | SLONG sqlLength, sqlSubType, sqlScale, sqlType; |
11882 | 11891 | desc.getSqlInfo(&sqlLength, &sqlSubType, &sqlScale, &sqlType); |
|
0 commit comments