Examples of VoltLogger


Examples of org.voltcore.logging.VoltLogger

                          procName + " contains a non-final SQLStmt field.";
                }
                if (compiler != null)
                    throw compiler.new VoltCompilerException(msg);
                else
                    new VoltLogger("HOST").warn(msg);
            }

            f.setAccessible(true);

            SQLStmt stmt = null;
View Full Code Here

Examples of org.voltcore.logging.VoltLogger

            try {
                ss.socket().bind(addr);
                ss.configureBlocking(false);
                ss.register(selector, SelectionKey.OP_ACCEPT);
            } catch (IOException e) {
                MiscUtils.printPortsInUse(new VoltLogger("HOST"));
                String msg = "ZooKeeper service unable to bind to port : " + addr.getPort();
                VoltDB.crashLocalVoltDB(msg, false, e);
            }
        }
View Full Code Here

Examples of org.voltcore.logging.VoltLogger

        // PRE-LOAD ALL HTML TEMPLATES (one for now)
        try {
            loadTemplate(HTTPAdminListener.class, "admintemplate.html");
        }
        catch (Exception e) {
            VoltLogger logger = new VoltLogger("HOST");
            logger.error("Unable to load HTML templates from jar for admin pages.", e);
            throw e;
        }

        // NOW START SocketConnector and create Jetty server but dont start.
        SocketConnector connector = null;
View Full Code Here

Examples of org.voltcore.logging.VoltLogger

        @Override
        public void handle(String target, Request baseRequest,
                           HttpServletRequest request, HttpServletResponse response)
                            throws IOException, ServletException {
            VoltLogger logger = new VoltLogger("HOST");
            super.handle(target, baseRequest, request, response);
            try{

                // if this is an internal jetty retry, then just tell
                // jetty we're still working on it. There is a risk of
                // masking other errors in doing this, but it's probably
                // low compared with the default policy of retrys.
                AsyncContinuation cont = baseRequest.getAsyncContinuation();
                // this is set to false on internal jetty retrys
                if (!cont.isInitial()) {
                    // The continuation object has been woken up by the
                    // retry. Tell it to go back to sleep.
                    cont.suspend();
                    return;
                }

                //Special handling for API as they continue and setHandled differently
                if (baseRequest.getRequestURI().contains("/api/1.0/")) {
                    baseRequest.setHandled(false);
                    return;
                }
                //Send old /studio back to "/"
                if (baseRequest.getRequestURI().contains("/studio")) {
                    response.sendRedirect("/");
                    baseRequest.setHandled(true);
                    return;
                }
                // redirect the base dir
                if (target.equals("/")) target = "/index.htm";
                // check if a file exists
                URL url = VoltDB.class.getResource("dbmonitor" + target);
                if (url == null) {
                    // write 404
                    String msg = "404: Resource not found.\n"+url.toString();
                    response.setContentType("text/plain;charset=utf-8");
                    response.setStatus(HttpServletResponse.SC_NOT_FOUND);
                    baseRequest.setHandled(true);
                    response.getWriter().print(msg);
                    return;
                }

                // read the template
                InputStream is = VoltDB.class.getResourceAsStream("dbmonitor" + target);

                if (target.endsWith("/index.htm")) {

                    // set the headers
                    response.setContentType("text/html;charset=utf-8");
                    response.setStatus(HttpServletResponse.SC_OK);
                    baseRequest.setHandled(true);

                    OutputStream os = response.getOutputStream();
                    BufferedInputStream bis = new BufferedInputStream(is);

                    int c = -1;
                    while ((c = bis.read()) != -1) {
                        os.write(c);
                    }
                }
                else {
                    // set the mime type in a giant hack
                    String mime = "text/html;charset=utf-8";
                    if (target.endsWith(".js"))
                        mime = "application/x-javascript;charset=utf-8";
                    if (target.endsWith(".css"))
                        mime = "text/css;charset=utf-8";
                    if (target.endsWith(".gif"))
                        mime = "image/gif";
                    if (target.endsWith(".png"))
                        mime = "image/png";
                    if ((target.endsWith(".jpg")) || (target.endsWith(".jpeg")))
                        mime = "image/jpeg";

                    // set the headers
                    response.setContentType(mime);
                    response.setStatus(HttpServletResponse.SC_OK);
                    baseRequest.setHandled(true);

                    // write the file out
                    BufferedInputStream bis = new BufferedInputStream(is);
                    OutputStream os = response.getOutputStream();
                    int c = -1;
                    while ((c = bis.read()) != -1) {
                        os.write(c);
                    }
                }
            }catch(Exception ex){
                logger.error("Error servicing url: " + baseRequest.getRequestURI() + " Details: "+ ex.getMessage());
            }
        }
View Full Code Here

Examples of org.voltcore.logging.VoltLogger

        @Override
        public void handle(String target, Request baseRequest,
                           HttpServletRequest request, HttpServletResponse response)
                            throws IOException, ServletException {
            VoltLogger logger = new VoltLogger("HOST");
            super.handle(target, baseRequest, request, response);
            try {
                // http://www.ietf.org/rfc/rfc4627.txt dictates this mime type
                response.setContentType("application/json;charset=utf-8");
                if (m_jsonEnabled) {
                    httpClientInterface.process(baseRequest, response);

                    // used for perf testing of the http interface
                    /*String msg = "{\"status\":1,\"appstatus\":-128,\"statusstring\":null,\"appstatusstring\":null,\"exception\":null,\"results\":[{\"status\":-128,\"schema\":[{\"name\":\"SVAL1\",\"type\":9},{\"name\":\"SVAL2\",\"type\":9},{\"name\":\"SVAL3\",\"type\":9}],\"data\":[[\"FOO\",\"BAR\",\"BOO\"]]}]}";
                    response.setStatus(HttpServletResponse.SC_OK);
                    baseRequest.setHandled(true);
                    response.getWriter().print(msg);*/
                } else {
                    response.setStatus(HttpServletResponse.SC_FORBIDDEN);
                    baseRequest.setHandled(true);
                    response.getWriter().println("JSON API IS CURRENTLY DISABLED");
                }

            } catch(Exception ex){
                logger.error("Error servicing url: " + baseRequest.getRequestURI() + " Details: "+ ex.getMessage());
            }
        }
View Full Code Here

Examples of org.voltcore.logging.VoltLogger

        rss = getRSSFromProcFS();
        if (rss > 0) mode = GetRSSMode.PROCFS;

        // notify users if stats collection might be slow
        if (mode == GetRSSMode.PS) {
            VoltLogger logger = new VoltLogger("HOST");
            logger.warn("System statistics will be collected in a sub-optimal "
                    + "manner because either procfs couldn't be read from or "
                    + "the native library couldn't be loaded.");
        }
    }
View Full Code Here

Examples of org.voltcore.logging.VoltLogger

        m_clock = clock;

        // warn if running with a simulated clock skew
        // this should only be used for testing
        if (m_timestampTestingSalt != 0) {
            VoltLogger log = new VoltLogger("HOST");
            log.warn(String.format("Partition (id=%d) running in test mode with non-zero timestamp testing value: %d",
                     partitionId, timestampTestingSalt));
        }
    }
View Full Code Here

Examples of org.voltcore.logging.VoltLogger

                /*
                 * Time moved backwards, if was less than three seconds, spin to let it catch up
                 * otherwise calculate an offset to add to the system clock in order to use it to
                 * continue moving forward
                 */
                VoltLogger log = new VoltLogger("HOST");
                double diffSeconds = (lastUsedTime - currentTime) / 1000.0;
                String msg = String.format("UniqueIdGenerator time moved backwards from: %d to %d, a difference of %.2f seconds.",
                        lastUsedTime, currentTime, diffSeconds);
                log.error(msg);
                System.err.println(msg);
                // if the diff is less than some specified amount of time, wait a bit
                if ((lastUsedTime - currentTime) < BACKWARD_TIME_FORGIVENESS_WINDOW_MS) {
                    log.info("This node will delay any stored procedures sent to it.");
                    log.info(String.format("This node will resume full operation in  %.2f seconds.", diffSeconds));

                    long count = BACKWARD_TIME_FORGIVENESS_WINDOW_MS;
                    // note, the loop should stop once lastUsedTime is PASSED, not current
                    while ((currentTime <= lastUsedTime) && (count-- > 0)) {
                        try {
                            m_clock.sleep(1);
                        } catch (InterruptedException e) {}
                        currentTime = m_clock.get();
                    }
                    // if the loop above ended because it ran too much, time is pretty darn wonky.
                    // Going to let it crash in this instance
                    if (count < 0) {
                        VoltDB.crashLocalVoltDB("VoltDB was unable to recover after the system time was externally negatively adusted. " +
                                "It is possible that there is a serious system time or NTP error. ", false, null);
                    }
                }
                // Calculate an offset that will keep time moving forward at the rate of the system clock
                // but at the current time, not the time the system clock shifted back too.
                else {
                    m_backwardsTimeAdjustmentOffset = lastUsedTime - currentTime + 1;
                    //Since we calculated a new offset, recalculate the current time + the offset
                    currentTimePlusOffset = currentTime + m_backwardsTimeAdjustmentOffset;
                    //Should satisfy this constraint now
                    assert(currentTimePlusOffset > lastUsedTime);
                    double offsetSeconds = m_backwardsTimeAdjustmentOffset / 1000.0;
                    msg = String.format(
                            "Continuing operation by adding an offset of %.2f to system time. " +
                            "This means the time and unique IDs provided by VoltProcedure " +
                            " (getUniqueId, getTransactionId, getTransactionTime) " +
                            "will not correctly reflect wall clock time as reported by the system clock." +
                            " For severe shifts you could see duplicate " +
                            "IDs or time moving backwards when the server is" +
                            " restarted causing the offset to be discarded.",
                            offsetSeconds);
                    log.error(msg);
                    System.err.println(msg);
                }
            } else if (currentTime > lastUsedTime && m_backwardsTimeAdjustmentOffset != 0) {
                //Actual wall clock time is correct, blast away the offset
                //and switch to current time
                m_backwardsTimeAdjustmentOffset = 0;
                currentTimePlusOffset = currentTime;
                VoltLogger log = new VoltLogger("HOST");
                log.error("Host clock seems to have adjusted again to make the offset unecessary");
                System.err.println("Host clock seems to have adjusted again to make the offset unecessary");
            }
            currentTime = currentTimePlusOffset;
            lastUsedTime = currentTime;
            counterValue = 0;
View Full Code Here

Examples of org.voltcore.logging.VoltLogger

        m_context = voltdb.getCatalogContext();
        m_tracker = null;//VoltDB.instance().getSiteTracker();
        final int partitionId = m_tracker.getPartitionForSite(m_siteId);
        String txnlog_name = ExecutionSite.class.getName() + "." + m_siteId;
        m_txnlog = new VoltLogger(txnlog_name);
        m_rejoining = recovering;
        //lastCommittedTxnId = txnId;

        // initialize the DR gateway
        m_partitionDRGateway =
View Full Code Here

Examples of org.voltcore.logging.VoltLogger

        if (!voltSharedLibraryLoaded) {
            if (VoltDB.getLoadLibVOLTDB()) {
                test64bit();

                try {
                    final VoltLogger hostLog = new VoltLogger("HOST");
                    String versionString = VoltDB.instance().getEELibraryVersionString();
                    // this fallback is for test code only
                    if (versionString == null) {
                        versionString = VoltDB.instance().getVersionString();
                    }
                    assert(versionString != null);
                    final String libname = "voltdb-" + versionString;
                    hostLog.info("Loading native VoltDB code ("+libname+"). A confirmation message will follow if the loading is successful.");
                    System.loadLibrary(libname);
                    voltSharedLibraryLoaded = true;
                    hostLog.info("Successfully loaded native VoltDB library " + libname + ".");
                } catch (Throwable e) {
                    if (mustSuccede) {
                        String msg = "Library VOLTDB JNI shared library loading failed. Library path " +
                                System.getProperty("java.library.path") + "\n";
                        msg += "The library may have failed to load because it can't be found in your " +
                                "load library path, or because it is not compatible with the current " +
                                "platform.\n";
                        msg +=  "VoltDB provides builds on our website for 64-bit OSX systems >= 10.6, " +
                                "and 64-bit Linux systems with kernels >= 2.6.18.";
                        VoltDB.crashLocalVoltDB(msg, false, null);
                    } else {
                        hostLog.info("Library VOLTDB JNI shared library loading failed. Library path "
                                + System.getProperty("java.library.path"));
                    }
                    return false;
                }
            } else {
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.