예제 #1
0
    virtual void process()
    {
        IRecordSize *recordSize = helper->queryOutputMeta();

        Owned<IThorRowInterfaces> rowIf = createThorRowInterfaces(queryRowManager(), helper->queryOutputMeta(), queryId(), queryCodeContext());
        OwnedConstThorRow result = getAggregate(*this, container.queryJob().querySlaves(), *rowIf, *helper, mpTag);
        if (!result)
            return;
        CMessageBuffer msg;
        CMemoryRowSerializer mbs(msg);
        rowIf->queryRowSerializer()->serialize(mbs, (const byte *)result.get());
        if (!queryJobChannel().queryJobComm().send(msg, 1, mpTag, 5000))
            throw MakeThorException(0, "Failed to give result to slave");
    }
예제 #2
0
    virtual void start() override
    {
        ActivityTimer s(totalCycles, timeActivities);
        try
        {
            try
            {
                PARENT::start();
            }
            catch (IException *e)
            {
                fireException(e);
                barrier->cancel();
                throw;
            }
            catch (CATCHALL)
            {
                Owned<IException> e = MakeActivityException(this, 0, "Unknown exception starting sort input");
                fireException(e);
                barrier->cancel();
                throw;
            }

            Linked<IThorRowInterfaces> rowif = queryRowInterfaces(input);
            Owned<IThorRowInterfaces> auxrowif = createThorRowInterfaces(queryRowManager(), helper->querySortedRecordSize(),queryId(),queryCodeContext());
            sorter->Gather(
                rowif,
                inputStream,
                helper->queryCompare(),
                helper->queryCompareLeftRight(),
                NULL,helper->querySerialize(),
                NULL,
                NULL,
                false,
                isUnstable(),
                abortSoon,
                auxrowif);

            PARENT::stop();
            if (abortSoon)
            {
                ActPrintLogEx(&queryContainer(), thorlog_null, MCwarning, "MSortSlaveActivity::start aborting");
                barrier->cancel();
                return;
            }
        }
        catch (IException *e)
        {
            fireException(e);
            barrier->cancel();
            throw;
        }
        catch (CATCHALL)
        {
            Owned<IException> e = MakeActivityException(this, 0, "Unknown exception gathering sort input");
            fireException(e);
            barrier->cancel();
            throw;
        }
        ActPrintLog("SORT waiting barrier.1");
        if (!barrier->wait(false)) {
            Sleep(1000); // let original error through
            throw MakeThorException(TE_BarrierAborted,"SORT: Barrier Aborted");
        }
        ActPrintLog("SORT barrier.1 raised");
        output.setown(sorter->startMerge(totalrows));
    }
예제 #3
0
IThorRowInterfaces * CDiskReadSlaveActivityBase::queryDiskRowInterfaces()
{
    if (!diskRowIf) 
        diskRowIf.setown(createThorRowInterfaces(queryRowManager(), helper->queryDiskRecordSize(),queryId(),queryCodeContext()));
    return diskRowIf;
}