Skip to content

Commit af8b227

Browse files
committed
1.Revert adding the path separator to the end of the StringBuffer
in getTempfileBase. Signed-off-by: Dave Streeter <dave.streeter@lexisnexisrisk.com>
1 parent 3c03e84 commit af8b227

3 files changed

Lines changed: 50 additions & 52 deletions

File tree

common/thorhelper/roxiehelper.cpp

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void OwnedRowArray::replace(const void * row, aindex_t pos)
6565
CRHRollingCacheElem::CRHRollingCacheElem()
6666
{
6767
row = NULL;
68-
cmp = INT_MIN;
68+
cmp = INT_MIN;
6969
}
7070
CRHRollingCacheElem::~CRHRollingCacheElem()
7171
{
@@ -84,10 +84,10 @@ void CRHRollingCacheElem::set(const void *_row)
8484
CRHRollingCache::~CRHRollingCache()
8585
{
8686
while (cache.ordinality())
87-
{
88-
CRHRollingCacheElem *e = cache.dequeue();
89-
delete e;
90-
}
87+
{
88+
CRHRollingCacheElem *e = cache.dequeue();
89+
delete e;
90+
}
9191
}
9292

9393
void CRHRollingCache::init(IRowStream *_in, unsigned _max)
@@ -164,7 +164,7 @@ void CRHRollingCache::advance()
164164

165165
//=========================================================================================
166166

167-
//CRHDualCache copied from THOR, and modified to get input from IInputBase instead
167+
//CRHDualCache copied from THOR, and modified to get input from IInputBase instead
168168
//of IReadSeqVar and to manage rows as OwnedRoxieRow types
169169
CRHDualCache::CRHDualCache()
170170
{
@@ -177,12 +177,12 @@ CRHDualCache::~CRHDualCache()
177177
::Release(strm1);
178178
::Release(strm2);
179179
for (;;)
180-
{
181-
CRHRollingCacheElem *e = cache.dequeue();
182-
if (!e)
183-
break;
184-
delete e;
185-
}
180+
{
181+
CRHRollingCacheElem *e = cache.dequeue();
182+
if (!e)
183+
break;
184+
delete e;
185+
}
186186
}
187187

188188
void CRHDualCache::init(IRowStream * _in)
@@ -206,7 +206,7 @@ void CRHDualCache::PrintCache()
206206
{
207207
DBGLOG("DC=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-BASE:%d,posL=%d,posR=%d %s", base, posL,posR, eos?"EOS":"");
208208
}
209-
209+
210210
DBGLOG("%c%d: %s",(i==cache.ordinality()/2)?'>':' ',i,e?(const char *)e->row:"-----");
211211
if (i == cache.ordinality()-1)
212212
DBGLOG("DC=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
@@ -251,7 +251,7 @@ bool CRHDualCache::get(unsigned n, CRHRollingCacheElem *&out)
251251
return true;
252252
}
253253

254-
CRHDualCache::cOut::cOut(CRHDualCache *_parent, unsigned &_pos)
254+
CRHDualCache::cOut::cOut(CRHDualCache *_parent, unsigned &_pos)
255255
: pos(_pos)
256256
{
257257
parent = _parent;
@@ -297,22 +297,22 @@ void CRHLimitedCompareHelper::init( unsigned _atmost,
297297
bool CRHLimitedCompareHelper::getGroup(OwnedRowArray &group, const void *left)
298298
{
299299
// this could be improved!
300-
300+
301301
// first move 'mid' forwards until mid>=left
302302
int low = 0;
303303
for (;;)
304304
{
305305
CRHRollingCacheElem * r = cache->mid(0);
306306
if (!r)
307-
break; // hit eos
307+
break; // hit eos
308308
int c = cmp->docompare(left,r->row);
309-
if (c == 0)
309+
if (c == 0)
310310
{
311311
r->cmp = limitedcmp->docompare(left,r->row);
312-
if (r->cmp <= 0)
312+
if (r->cmp <= 0)
313313
break;
314314
}
315-
else if (c < 0)
315+
else if (c < 0)
316316
{
317317
r->cmp = -1;
318318
break;
@@ -328,51 +328,51 @@ bool CRHLimitedCompareHelper::getGroup(OwnedRowArray &group, const void *left)
328328
{
329329
CRHRollingCacheElem * pr = cache->mid(low-1);
330330
if (!pr)
331-
break; // hit start
331+
break; // hit start
332332
int c = cmp->docompare(left,pr->row);
333-
if (c == 0)
333+
if (c == 0)
334334
{
335335
pr->cmp = limitedcmp->docompare(left,pr->row);
336-
if (pr->cmp==1)
336+
if (pr->cmp==1)
337337
break;
338338
}
339-
else
339+
else
340340
{
341-
pr->cmp = 1;
341+
pr->cmp = 1;
342342
break;
343343
}
344344
low--;
345345
}
346346
int high = 0;
347347
if (cache->mid(0)) // check haven't already hit end
348-
{
348+
{
349349
// now scan fwd
350350
for (;;)
351351
{
352352
high++;
353353
CRHRollingCacheElem * nr = cache->mid(high);
354-
if (!nr)
354+
if (!nr)
355355
break;
356356
int c = cmp->docompare(left,nr->row);
357-
if (c==0)
357+
if (c==0)
358358
{
359359
nr->cmp = limitedcmp->docompare(left,nr->row);
360-
if (nr->cmp==-1)
360+
if (nr->cmp==-1)
361361
break;
362362
}
363-
else
363+
else
364364
{
365365
nr->cmp = -1;
366366
break;
367367
}
368368
}
369369
}
370-
while (high-low>(int)atmost)
370+
while (high-low>(int)atmost)
371371
{
372372
int vl = iabs(cache->mid(low)->cmp);
373373
int vh = iabs(cache->mid(high-1)->cmp);
374374
int v;
375-
if (vl==0)
375+
if (vl==0)
376376
{
377377
if (vh==0) // both ends equal
378378
return false;
@@ -387,14 +387,14 @@ bool CRHLimitedCompareHelper::getGroup(OwnedRowArray &group, const void *left)
387387
low++;
388388
while ((low<high)&&(iabs(cache->mid(high-1)->cmp)==v))
389389
high--;
390-
if (low>=high)
390+
if (low>=high)
391391
return true; // couldn't make group;
392392
}
393-
for (int i=low;i<high;i++)
393+
for (int i=low;i<high;i++)
394394
{
395395
CRHRollingCacheElem *r = cache->mid(i);
396396
LinkRoxieRow(r->row);
397-
group.append(r->row);
397+
group.append(r->row);
398398
}
399399
return group.ordinality()>0;
400400
}
@@ -609,7 +609,7 @@ extern IEngineRowStream *createSortedGroupedInputReader(IEngineRowStream *_input
609609
return new SortedGroupedInputReader(_input, _groupCompare, _sorter);
610610
}
611611

612-
//=========================================================================================
612+
//=========================================================================================
613613

614614
class CSortAlgorithm : implements CInterfaceOf<ISortAlgorithm>
615615
{
@@ -1196,7 +1196,7 @@ class CSpillingSortAlgorithm : public CSortAlgorithm, implements roxiemem::IBuff
11961196
{
11971197
unsigned __int64 seq = (memsize_t)this ^ get_cycles_now();
11981198
StringBuffer spillBasename;
1199-
spillBasename.append(tempDirectory).appendf("spill_sort_%" I64F "u", seq);
1199+
spillBasename.append(tempDirectory).append(PATHSEPCHAR).appendf("spill_sort_%" I64F "u", seq);
12001200
Owned<IRowLinkCounter> linker = new RoxieRowLinkCounter();
12011201
unsigned heapFlags = 0;
12021202
Owned<IRowInterfaces> rowInterfaces = createRowInterfaces(rowMeta, activityId, heapFlags, ctx);
@@ -1350,8 +1350,8 @@ extern ISortAlgorithm *createSortAlgorithm(RoxieSortAlgorithm _algorithm, ICompa
13501350
CSafeSocket::CSafeSocket(ISocket *_sock)
13511351
{
13521352
httpMode = false;
1353-
sent = 0;
1354-
heartbeat = false;
1353+
sent = 0;
1354+
heartbeat = false;
13551355
sock.setown(_sock);
13561356
}
13571357

@@ -1779,7 +1779,7 @@ bool CSafeSocket::sendHeartBeat(const IContextLogger &logctx)
17791779
rev = (unsigned) time(NULL);
17801780
_WINREV(rev);
17811781
s.append(sizeof(rev), (char *) &rev);
1782-
1782+
17831783
try
17841784
{
17851785
CriticalBlock c(crit);
@@ -1979,7 +1979,7 @@ interface IXmlStreamFlusher;
19791979

19801980
bool FlushingStringBuffer::needsFlush(bool closing)
19811981
{
1982-
if (isBlocked || closing) // can't flush unblocked. MORE - may need to break it up though....
1982+
if (isBlocked || closing) // can't flush unblocked. MORE - may need to break it up though....
19831983
{
19841984
size32_t len = s.length() - emptyLength;
19851985
return len > (closing ? 0 : RESULT_FLUSH_THRESHOLD);
@@ -2582,17 +2582,17 @@ void ClusterWriteHandler::setDescriptorParts(IFileDescriptor * desc, char const
25822582
ClusterPartDiskMapSpec partmap; // will get this from group at some point
25832583
desc->setNumParts(1);
25842584
desc->setPartMask(basename);
2585-
if (localCluster)
2585+
if (localCluster)
25862586
desc->addCluster(localClusterName,localCluster, partmap);
2587-
ForEachItemIn(idx,remoteNodes)
2587+
ForEachItemIn(idx,remoteNodes)
25882588
desc->addCluster(remoteClusters.item(idx),&remoteNodes.item(idx), partmap);
25892589
if (attrs) {
25902590
// need to set part attr
25912591
IPartDescriptor *partdesc = desc->queryPart(0);
25922592
IPropertyTree &pprop = partdesc->queryProperties();
25932593
// bit of a kludge (should really set properties *after* creating part rather than passing prop tree in)
25942594
Owned<IAttributeIterator> ai = attrs->getAttributes();
2595-
ForEach(*ai)
2595+
ForEach(*ai)
25962596
pprop.setProp(ai->queryName(),ai->queryValue());
25972597
}
25982598
}
@@ -2702,16 +2702,16 @@ class COrderedOutputSerializer : implements IOrderedOutputSerializer, public CIn
27022702
}
27032703

27042704
//IOrderedOutputSerializer
2705-
size32_t fwrite(int seq, const void * data, size32_t size, size32_t count)
2706-
{
2705+
size32_t fwrite(int seq, const void * data, size32_t size, size32_t count)
2706+
{
27072707
CriticalBlock c(crit);
27082708
size32_t ret = getResult(seq)->fwrite(data,size, count);
27092709
if (seq == (lastSeqFlushed + 1))
27102710
flushCurrent();
27112711
return ret;
27122712
}
27132713
size32_t printf(int seq, const char *format, ...) __attribute__((format(printf, 3, 4)))
2714-
{
2714+
{
27152715
CriticalBlock c(crit);
27162716
va_list args;
27172717
va_start(args, format);

ecl/eclagent/eclagent.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,12 +612,12 @@ const char *EclAgent::queryTempfilePath()
612612

613613
StringBuffer &EclAgent::getTempfileBase(StringBuffer &buff)
614614
{
615-
return buff.append(queryTempfilePath()).append(PATHSEPCHAR).appendLower(wuid).append(PATHSEPCHAR);
615+
return buff.append(queryTempfilePath()).append(PATHSEPCHAR).appendLower(wuid);
616616
}
617617

618618
void EclAgent::buildTempFilename(StringBuffer &tempFilename, const char *name)
619619
{
620-
getTempfileBase(tempFilename).append(name);
620+
getTempfileBase(tempFilename).append(PATHSEPCHAR).append(name);
621621
}
622622

623623
const char *EclAgent::queryTemporaryFile(const char *name)

ecl/hthor/hthor.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ class CHThorClusterWriteHandler : public ClusterWriteHandler
375375
virtual void getTempFilename(StringAttr & out) const
376376
{
377377
StringBuffer buff;
378-
agent.getTempfileBase(buff).appendf("cluster_write_%p.%" I64F "d_%u", this, (__int64)GetCurrentThreadId(), GetCurrentProcessId());
378+
agent.getTempfileBase(buff).append(PATHSEPCHAR).appendf("cluster_write_%p.%" I64F "d_%u", this, (__int64)GetCurrentThreadId(), GetCurrentProcessId());
379379
out.set(buff.str());
380380
}
381381
};
@@ -4343,7 +4343,7 @@ bool CHThorGroupSortActivity::sortAndSpillRows()
43434343
if(!diskMerger)
43444344
{
43454345
StringBuffer fbase;
4346-
agent.getTempfileBase(fbase).appendf("spill_sort_%p", this);
4346+
agent.getTempfileBase(fbase).append(PATHSEPCHAR).appendf("spill_sort_%p", this);
43474347
PROGLOG("SORT: spilling to disk, filename base %s", fbase.str());
43484348
class CHThorRowLinkCounter : implements IRowLinkCounter, public CSimpleInterface
43494349
{
@@ -4818,7 +4818,6 @@ void CHThorJoinActivity::ready()
48184818
RoxieSortAlgorithm sortAlgorithm = isStable ? stableSpillingQuickSortAlgorithm : spillingQuickSortAlgorithm;
48194819
StringBuffer tempBase;
48204820
agent.getTempfileBase(tempBase);
4821-
tempBase.setLength(tempBase.length() - 1); // remove the path separator, as the sort does not want it
48224821
if (helper.isLeftAlreadySorted())
48234822
sortedLeftInput.setown(createDegroupedInputReader(&input->queryStream()));
48244823
else
@@ -5456,7 +5455,6 @@ void CHThorSelfJoinActivity::ready()
54565455
RoxieSortAlgorithm sortAlgorithm = isStable ? stableSpillingQuickSortAlgorithm : spillingQuickSortAlgorithm;
54575456
StringBuffer tempBase;
54585457
agent.getTempfileBase(tempBase);
5459-
tempBase.setLength(tempBase.length() - 1); // remove the path separator, as the sort does not want it
54605458
groupedInput.setown(createSortedGroupedInputReader(&input->queryStream(), compareLeft, createSortAlgorithm(sortAlgorithm, compareLeft, *queryRowManager(), input->queryOutputMeta(), agent.queryCodeContext(), tempBase, activityId)));
54615459
}
54625460
leftOuterJoin = (helper.getJoinFlags() & JFleftouter) != 0;

0 commit comments

Comments
 (0)