Package org.voltdb.processtools

Examples of org.voltdb.processtools.ProcessSetManager$OutputLine


        this.self = Thread.currentThread();
        this.hstore_conf = HStoreConf.singleton();
        if (catalogContext != null) this.initializeCatalog(catalogContext);
       
        // Setup ProcessSetManagers...
        this.clientPSM = new ProcessSetManager(hstore_conf.client.log_dir,
                                               hstore_conf.client.log_backup,
                                               0,
                                               this.failure_observer);
        this.sitePSM = new ProcessSetManager(hstore_conf.site.log_dir,
                                             hstore_conf.site.log_backup,
                                             config.client_initialPollingDelay,
                                             this.failure_observer);

        Map<String, Field> builderFields = new HashMap<String, Field>();
View Full Code Here


    @Override
    public void run() {
        this.finished = false;
        final Database catalog_db = CatalogUtil.getDatabase(controller.getCatalog());
        final CountDownLatch resultsToRead = controller.getResultsToReadLatch();
        final ProcessSetManager clientPSM = controller.getClientProcessSetManager();

        while (resultsToRead.getCount() > 0) {
            ProcessSetManager.OutputLine line = clientPSM.nextBlocking();
            if (line == null) {
                continue;
            }
            // Print stderr back-out to the console
            else if (line.stream == ProcessSetManager.StreamType.STDERR) {
                String prefix = String.format("(%s): ", line.processName);
                System.err.println(StringUtil.prefix(line.value, prefix));
                continue;
            }
            // General Debug Output
            else if (line.value.startsWith(BenchmarkComponent.CONTROL_MESSAGE_PREFIX) == false) {
                String prefix = String.format("(%s): ", line.processName);
                System.out.println(StringUtil.prefix(line.value, prefix));
                continue;
            }
           
            // BenchmarkController Coordination Message
            // split the string on commas and strip whitespace
            String control_line = line.value.substring(BenchmarkComponent.CONTROL_MESSAGE_PREFIX.length());
            String[] parts = control_line.split(",");
            for (int i = 0; i < parts.length; i++)
                parts[i] = parts[i].trim();

            // expect at least time and status
            if (parts.length < 2) {
                if (line.value.startsWith("Listening for transport dt_socket at address:") ||
                        line.value.contains("Attempting to load") ||
                        line.value.contains("Successfully loaded native VoltDB library")) {
                    LOG.info(line.processName + ": " + control_line + "\n");
                    continue;
                }
//                m_clientPSM.killProcess(line.processName);
//                LogKeys logkey =
//                    LogKeys.benchmark_BenchmarkController_ProcessReturnedMalformedLine;
//                LOG.l7dlog( Level.ERROR, logkey.name(),
//                        new Object[] { line.processName, line.value }, null);
                continue;
            }

            int clientId = -1;
            long time = -1;
            try {
                clientId = Integer.parseInt(parts[0]);
                time = Long.parseLong(parts[1]);
            } catch (NumberFormatException ex) {
                LOG.warn("Failed to parse line '" + control_line + "'", ex);
                continue; // IGNORE
            }
            final String clientName = BenchmarkControllerUtil.getClientName(line.processName, clientId);
            final ControlState status = ControlState.get(parts[2]);
            assert(status != null) : "Unexpected ControlStatus '" + parts[2] + "'";
           
            if (debug.val)
                LOG.debug(String.format("Client %s -> %s", clientName, status));
           
            // Make sure that we never go back in time!
            Long lastTimestamp = this.lastTimestamps.get(clientName);
            if (lastTimestamp != null) assert(time >= lastTimestamp) :
                String.format("New message from %s is in the past [newTime=%d, lastTime=%d]", clientName, time, lastTimestamp);

            switch (status) {
                // ----------------------------------------------------------------------------
                // READY
                // ----------------------------------------------------------------------------
                case READY: {
                    if (debug.val) LOG.debug(String.format("Got ready message for '%s'.", line.processName));
                    controller.clientIsReady(clientName);
                    break;
                }
                // ----------------------------------------------------------------------------
                // ERROR
                // ----------------------------------------------------------------------------
                case ERROR: {
                    clientPSM.killProcess(line.processName);
                    LOG.error(String.format("(%s) Returned error message:\n\"%s\"", line.processName, parts[2]));
                    break;
                }
                // ----------------------------------------------------------------------------
                // DUMPING
View Full Code Here

TOP

Related Classes of org.voltdb.processtools.ProcessSetManager$OutputLine

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.