Examples of BBContainer


Examples of org.voltdb.utils.DBBPool.BBContainer

                    oldlist = m_queuedWrites2;
                    m_queuedWrites = m_queuedWrites1;
                }
            }
        }
        final BBContainer results[] = new BBContainer[oldlist.size()];
        int ii = 0;
        DeferredSerialization ds = null;
        int bytesQueued = 0;
        while ((ds = oldlist.poll()) != null) {
            results[ii] = ds.serialize(pool);
View Full Code Here

Examples of org.voltdb.utils.DBBPool.BBContainer

     * and will be freed when the thread terminates.
     */
    synchronized void shutdown() {
        int bytesReleased = 0;
        m_isShutdown = true;
        BBContainer c = null;
        while ((c = m_queuedBuffers.poll()) != null) {
            bytesReleased += c.b.remaining();
            c.discard();
        }
        updateQueued(-bytesReleased, false);
        DeferredSerialization ds = null;
        while ((ds = m_queuedWrites.poll()) != null) {
            ds.cancel();
View Full Code Here

Examples of org.voltdb.utils.DBBPool.BBContainer

        final StoredProcedureInvocation invocation =
            new StoredProcedureInvocation(0, procName, parameters);
        final FastSerializer fds = new FastSerializer();
        int size = 0;
        try {
            final BBContainer c = fds.writeObjectForMessaging(invocation);
            size = c.b.remaining();
            c.discard();
        } catch (final IOException e) {
            throw new RuntimeException(e);
        }
        return size;
    }
View Full Code Here

Examples of org.voltdb.utils.DBBPool.BBContainer

                     * overwrite the partition id that is not part of the
                     * serialization format
                     */
                    Container c = m_buffers.poll();
                    if (c == null) {
                        final BBContainer originContainer = DBBPool.allocateDirect(DEFAULT_CHUNKSIZE);
                        final ByteBuffer b = originContainer.b;
                        final long pointer = org.voltdb.utils.DBBPool.getBufferAddress(b);
                        c = new Container(b, pointer, originContainer);
                    }

View Full Code Here

Examples of org.voltdb.utils.DBBPool.BBContainer

            } else {
               
                final FastSerializer fs = new FastSerializer(m_pool, expectedSerializedSize);
//                FastSerializer fs = this.getSerializer();
//                fs.reset();
                BBContainer c = null;
                try {
                    c = fs.writeObjectForMessaging(invocation);
                } catch (IOException e) {
                    fs.getBBContainer().discard();
                    throw new RuntimeException(e);
View Full Code Here

Examples of org.voltdb.utils.DBBPool.BBContainer

        m_availableSnapshotBuffers.clear();
    }

    void initializeBufferPool() {
        for (int ii = 0; ii < SnapshotSiteProcessor.m_numSnapshotBuffers; ii++) {
            final BBContainer origin = org.voltdb.utils.DBBPool.allocateDirect(m_snapshotBufferLength);
            m_snapshotBufferOrigins.add(origin);
            long snapshotBufferAddress = 0;
            if (VoltDB.getLoadLibVOLTDB()) {
                snapshotBufferAddress = org.voltdb.utils.DBBPool.getBufferAddress(origin.b);
            }
            m_availableSnapshotBuffers.offer(new BBContainer(origin.b, snapshotBufferAddress) {
                @Override
                public void discard() {
                    m_availableSnapshotBuffers.offer(this);
                    m_onPotentialSnapshotWork.run();
                }
View Full Code Here

Examples of org.voltdb.utils.DBBPool.BBContainer

            final SnapshotTableTask currentTask = m_snapshotTableTasks.peek();           
            assert(currentTask != null);
            LOG.trace("SNAPSHOT TASK : "+currentTask+ " on partition :"+ partition_id+ " Target :"+currentTask.m_target);

            final int headerSize = currentTask.m_target.getHeaderSize();
            final BBContainer snapshotBuffer = m_availableSnapshotBuffers.poll();
            assert(snapshotBuffer != null);
            snapshotBuffer.b.clear();
            snapshotBuffer.b.position(headerSize);
            int serialized = 0;
           
View Full Code Here

Examples of org.voltdb.utils.DBBPool.BBContainer

        }
        return hasMoreChunks;
    }

    private static synchronized BBContainer getNextChunk() throws IOException {
        BBContainer c = null;
        while (c == null && m_saveFiles.peek() != null) {
            TableSaveFile f = m_saveFiles.peek();
            LOG.trace("File Channel Size :" + f.getFileChannel().size());
            LOG.trace("File Channel Position :" + f.getFileChannel().position());
            c = f.getNextChunk();
View Full Code Here

Examples of org.voltdb.utils.DBBPool.BBContainer

        VoltTable[] results = new VoltTable[] { constructResultsTable() };
        results[0].addRow(m_hostId, hostname, m_siteId, tableName, 0, "NO DATA TO DISTRIBUTE", "");
        final Table new_catalog_table = getCatalogTable(tableName);
        Boolean needsConversion = null;
        BBContainer c = null;

        int c_size = 1024 * 1024;
        ByteBuffer c_aggregate = ByteBuffer.allocateDirect(c_size);

        try {
            VoltTable table = null;
            c = null;

            while (hasMoreChunks()) {
                c = getNextChunk();
                if (c == null) {
                    continue; // Should be equivalent to break
                }

                c_aggregate.put(c.b);
            }

            LOG.trace("c_aggregate position :" + c_aggregate.position());
            LOG.trace("c_aggregate capacity :" + c_aggregate.capacity());

            if (needsConversion == null) {
                VoltTable old_table = PrivateVoltTableFactory.createVoltTableFromBuffer(c_aggregate.duplicate(), true);
                needsConversion = SavedTableConverter.needsConversion(old_table, new_catalog_table);
            }

            final VoltTable old_table = PrivateVoltTableFactory.createVoltTableFromBuffer(c_aggregate, true);
            if (needsConversion) {
                table = SavedTableConverter.convertTable(old_table, new_catalog_table);
            } else {
                table = old_table;
            }

            LOG.trace("createPartitionedTables :" + tableName);

            VoltTable[] partitioned_tables = createPartitionedTables(tableName, table);
            if (c != null) {
                c.discard();
            }

            // LoadMultipartitionTable -- send data to all ..

            int[] dependencyIds = new int[sites_to_partitions.size()];
View Full Code Here

Examples of org.voltdb.utils.DBBPool.BBContainer

        fs.writeBoolean(isReplicated);
        if (!isReplicated) {
            fs.writeArray(partitionIds);
            fs.writeInt(numPartitions);
        }
        final BBContainer container = fs.getBBContainer();
        container.b.position(4);
        container.b.putInt(container.b.remaining() - 4);
        container.b.position(0);

        FastSerializer schemaSerializer = new FastSerializer();
        schemaTable.writeExternal(schemaSerializer);
        final BBContainer schemaContainer = schemaSerializer.getBBContainer();
        schemaContainer.b.limit(schemaContainer.b.limit() - 4);//Don't want the row count
        schemaContainer.b.position(schemaContainer.b.position() + 4);//Don't want total table length

        final CRC32 crc = new CRC32();
        ByteBuffer aggregateBuffer = ByteBuffer.allocate(container.b.remaining() + schemaContainer.b.remaining());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.