Package org.voltdb.sysprocs.saverestore

Examples of org.voltdb.sysprocs.saverestore.TableSaveFile$Container


        int partition_id = context.getPartitionExecutor().getPartitionId();
        LOG.trace("Starting performLoadPartitionedTable " + tableName + " at partition - " + partition_id);

        String result_str = "SUCCESS";
        String error_msg = "";
        TableSaveFile savefile = null;

        /**
         * For partitioned tables
         */
        try {
            savefile = getTableSaveFile(getSaveFileForPartitionedTable(m_filePath, m_fileNonce, tableName,
                    catalog_host.getId(),
                    catalog_site.getId(),
                    catalog_partition.getId()),                            
                    3, null);
            assert (savefile.getCompleted());
        } catch (IOException e) {
            VoltTable result = constructResultsTable();
            result.addRow(m_hostId, hostname, m_siteId, tableName, -1, "FAILURE", "Unable to load table: " + tableName + " error: " + e.getMessage());
            return result;
        }

        try {

            while (savefile.hasMoreChunks()) {
                VoltTable table = null;
                final org.voltdb.utils.DBBPool.BBContainer c = savefile.getNextChunk();
                if (c == null) {
                    continue; // Should be equivalent to break
                }
                VoltTable old_table = PrivateVoltTableFactory.createVoltTableFromBuffer(c.b, true);
                Table new_catalog_table = getCatalogTable(tableName);
                table = SavedTableConverter.convertTable(old_table, new_catalog_table);
                c.discard();
                try {
                    LOG.trace("LoadTable " + tableName);

                    this.executor.loadTable(ts, context.getCluster().getTypeName(), context.getDatabase().getTypeName(), tableName, table, allowExport);
                } catch (VoltAbortException e) {
                    result_str = "FAILURE";
                    error_msg = e.getMessage();
                    break;
                }
            }

        } catch (Exception e) {
            VoltTable result = constructResultsTable();
            result.addRow(m_hostId, hostname, m_siteId, tableName, -1, "FAILURE", "Unable to load table: " + tableName + " error: " + e.getMessage());
            return result;
        }

        VoltTable result = constructResultsTable();
        result.addRow(m_hostId, hostname, m_siteId, tableName, -1, result_str, error_msg);
        try {
            savefile.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

View Full Code Here


                        }
                        if (f.canRead()) {
                            try {
                                FileInputStream savefile_input = new FileInputStream(f);
                                try {
                                    TableSaveFile savefile = new TableSaveFile(savefile_input.getChannel(), 1, null);
                                    String partitions = "";

                                    for (int partition : savefile.getPartitionIds()) {
                                        partitions = partitions + "," + partition;
                                    }

                                    if (partitions.startsWith(",")) {
                                        partitions = partitions.substring(1);
                                    }

                                    results.addRow(Integer.parseInt(context.getSite().getHost().getTypeName().replaceAll("[\\D]", "")), hostname, f.getParent(), f.getName(), savefile.getCreateTime(),
                                            savefile.getTableName(), savefile.getCompleted() ? "TRUE" : "FALSE", f.length(), savefile.isReplicated() ? "TRUE" : "FALSE", partitions,
                                            savefile.getTotalPartitions(), f.canRead() ? "TRUE" : "FALSE", "SUCCESS", "");
                                } catch (IOException e) {
                                    LOG.warn(e);
                                } finally {
                                    savefile_input.close();
                                }
View Full Code Here

                }
                if (f.canRead()) {
                    try {
                        FileInputStream savefile_input = new FileInputStream(f);
                        try {
                            TableSaveFile savefile =
                                new TableSaveFile(
                                        savefile_input,
                                        1,
                                        null);
                            String partitions = "";

                            for (int partition : savefile.getPartitionIds()) {
                                partitions = partitions + "," + partition;
                            }

                            if (partitions.startsWith(",")) {
                                partitions = partitions.substring(1);
                            }

                            results.addRow(
                                    m_messenger.getHostId(),
                                    m_hostname,
                                    f.getParent(),
                                    f.getName(),
                                    savefile.getTxnId(),
                                    org.voltdb.TransactionIdManager.getTimestampFromTransactionId(
                                        savefile.getTxnId()),
                                    savefile.getTableName(),
                                    savefile.getCompleted() ? "TRUE" : "FALSE",
                                    f.length(),
                                    savefile.isReplicated() ? "TRUE" : "FALSE",
                                    partitions,
                                    savefile.getTotalPartitions(),
                                    f.canRead() ? "TRUE" : "FALSE",
                                    "SUCCESS",
                                    ""
                                    );
                        } catch (IOException e) {
View Full Code Here

    public CSVTableSaveFile(File saveFile, char delimiter, Integer partitions[])
            throws IOException {
        m_delimiter = delimiter;
        final FileInputStream fis = new FileInputStream(saveFile);
        m_saveFile = new TableSaveFile(fis, 10, partitions);
        for (int ii = 0; ii < m_converterThreads.length; ii++) {
            m_converterThreads[ii] = new Thread(new ConverterThread());
            m_converterThreads[ii].start();
        }
    }
View Full Code Here

        return factory.createLocator(field);
    }

    private Object decorateContainer(final ClassLoader loader, final Field field) {
        final WebElement wrappedElement = proxyForLocator(loader, createLocator(field));
        final Container container = containerFactory.create((Class<? extends Container>) field.getType(), wrappedElement);

        PageFactory.initElements(new ExtendedFieldDecorator(wrappedElement), container);
        return container;
    }
View Full Code Here

TOP

Related Classes of org.voltdb.sysprocs.saverestore.TableSaveFile$Container

Copyright © 2018 www.massapicom. 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.