@@ -135,35 +135,34 @@ TTpcdsWorkloadDataInitializerGenerator::TBulkDataGenerator::TDataPortions TTpcds
135135 ctxs.emplace_back (*this , tdef->nParam );
136136 }
137137
138- with_lock (Lock) {
139- ds_key_t firstRow;
140- ds_key_t rowCount;
141- split_work (TableNum, &firstRow, &rowCount);
142- if (!Generated) {
143- ui32 toSkip = firstRow - 1 ;
144- if (!!Owner.StateProcessor && Owner.StateProcessor ->GetState ().contains (GetName ())) {
145- Generated = Owner.StateProcessor ->GetState ().at (TString (GetName ())).Position ;
146- toSkip += Generated;
147- }
148- if (toSkip) {
149- row_skip (TableNum, toSkip);
150- if (tdef->flags & FL_PARENT) {
151- row_skip (tdef->nParam , toSkip);
152- }
153- }
154- if (tdef->flags & FL_SMALL) {
155- resetCountCount ();
138+ auto g = Guard (Lock);
139+ ds_key_t firstRow;
140+ ds_key_t rowCount;
141+ split_work (TableNum, &firstRow, &rowCount);
142+ if (!Generated) {
143+ ui32 toSkip = firstRow - 1 ;
144+ if (!!Owner.StateProcessor && Owner.StateProcessor ->GetState ().contains (GetName ())) {
145+ Generated = Owner.StateProcessor ->GetState ().at (TString (GetName ())).Position ;
146+ toSkip += Generated;
147+ }
148+ if (toSkip) {
149+ row_skip (TableNum, toSkip);
150+ if (tdef->flags & FL_PARENT) {
151+ row_skip (tdef->nParam , toSkip);
156152 }
157153 }
158- const auto count = TableSize > Generated ? std::min (ui64 (TableSize - Generated), Owner.Params .BulkSize ) : 0 ;
159- if (!count) {
160- return result;
154+ if (tdef->flags & FL_SMALL) {
155+ resetCountCount ();
161156 }
162- ctxs.front ().SetCount (count);
163- ctxs.front ().SetStart (firstRow + Generated);
164- Generated += count;
165- GenerateRows (ctxs);
166157 }
158+ const auto count = TableSize > Generated ? std::min (ui64 (TableSize - Generated), Owner.Params .BulkSize ) : 0 ;
159+ if (!count) {
160+ return result;
161+ }
162+ ctxs.front ().SetCount (count);
163+ ctxs.front ().SetStart (firstRow + Generated);
164+ Generated += count;
165+ GenerateRows (ctxs, std::move (g));
167166 for (auto & ctx: ctxs) {
168167 ctx.AppendPortions (result);
169168 }
0 commit comments