当前位置: 首页>>代码示例>>C++>>正文


C++ VoltDBEngine::getBatchInputDepIdsContainer方法代码示例

本文整理汇总了C++中VoltDBEngine::getBatchInputDepIdsContainer方法的典型用法代码示例。如果您正苦于以下问题:C++ VoltDBEngine::getBatchInputDepIdsContainer方法的具体用法?C++ VoltDBEngine::getBatchInputDepIdsContainer怎么用?C++ VoltDBEngine::getBatchInputDepIdsContainer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VoltDBEngine的用法示例。


在下文中一共展示了VoltDBEngine::getBatchInputDepIdsContainer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: serialize_in

/**
 * Executes multiple plan fragments with the given parameter sets and gets the results.
 * @param pointer the VoltDBEngine pointer
 * @param plan_fragment_ids ID of the plan fragment to be executed.
 * @param outputBuffer buffer to be filled with the tables.
 * @param outputCapacity maximum number of bytes to write to buffer.
 * @return error code
*/
SHAREDLIB_JNIEXPORT jint JNICALL Java_org_voltdb_jni_ExecutionEngine_nativeExecuteQueryPlanFragmentsAndGetResults
(JNIEnv *env,
        jobject obj,
        jlong engine_ptr,
        jlongArray plan_fragment_ids,
        jint num_fragments,
        jintArray input_depIds,
        jintArray output_depIds,
        jlong txnId,
        jlong lastCommittedTxnId,
        jlong undoToken) {
    //VOLT_DEBUG("nativeExecuteQueryPlanFragmentAndGetResults() start");

    // setup
    VoltDBEngine *engine = castToEngine(engine_ptr);
    assert(engine);
    Topend *topend = static_cast<JNITopend*>(engine->getTopend())->updateJNIEnv(env);
    try {
        updateJNILogProxy(engine); //JNIEnv pointer can change between calls, must be updated
        engine->resetReusedResultOutputBuffer();
        engine->setUndoToken(undoToken);
        static_cast<JNITopend*>(engine->getTopend())->updateJNIEnv(env);
        Pool *stringPool = engine->getStringPool();

        // fragment info
        int batch_size = num_fragments;
        assert (batch_size <= MAX_BATCH_COUNT);
        jlong* fragment_ids_buffer = engine->getBatchFragmentIdsContainer();
        env->GetLongArrayRegion(plan_fragment_ids, 0, batch_size, fragment_ids_buffer);

        /** PAVLO **/
        // input dep ids
        jint* input_depIds_buffer = engine->getBatchInputDepIdsContainer();
        env->GetIntArrayRegion(input_depIds, 0, batch_size, input_depIds_buffer);
        
        // output dep ids
        jint* output_depIds_buffer = engine->getBatchOutputDepIdsContainer();
        env->GetIntArrayRegion(output_depIds, 0, batch_size, output_depIds_buffer);
        /** PAVLO **/

        // all fragments' parameters are in this buffer
        ReferenceSerializeInput serialize_in(engine->getParameterBuffer(), engine->getParameterBufferCapacity());
        NValueArray &params = engine->getParameterContainer();

        // count failures
        int failures = 0;

        for (int i = 0; i < batch_size; ++i) {
            int cnt = serialize_in.readShort();
            if (cnt < 0) {
                throwFatalException("parameter count is negative: %d", cnt);
            }
            assert (cnt < MAX_PARAM_COUNT);
            deserializeParameterSetCommon(cnt, serialize_in, params, stringPool);

            engine->setUsedParamcnt(cnt);
            // success is 0 and error is 1.
            if (engine->executeQuery(fragment_ids_buffer[i],
                                     output_depIds_buffer[i],
                                     input_depIds_buffer[i],
                                     params, txnId, lastCommittedTxnId, i == 0,
                                     i == (batch_size - 1)))
            {
                ++failures;
            }
        }

        // cleanup
        stringPool->purge();

        if (failures > 0)
            return org_voltdb_jni_ExecutionEngine_ERRORCODE_ERROR;
        else
            return org_voltdb_jni_ExecutionEngine_ERRORCODE_SUCCESS;
    } catch (FatalException e) {
        topend->crashVoltDB(e);
    }
    return org_voltdb_jni_ExecutionEngine_ERRORCODE_ERROR;
}
开发者ID:arpitmit,项目名称:h-store,代码行数:87,代码来源:voltdbjni.cpp


注:本文中的VoltDBEngine::getBatchInputDepIdsContainer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。