Package org.voltdb

Examples of org.voltdb.ClientResponseImpl


            client = ClientFactory.createClient(clientConfig);
            client.createConnection("localhost");

            TableHelper.loadTable(client, t1);

            ClientResponseImpl response = (ClientResponseImpl) client.callProcedure(
                    "@UpdateApplicationCatalog", catBytes2, null);
            System.out.println(response.toJSONString());

            VoltTable t3 = client.callProcedure("@AdHoc", "select * from FOO").getResults()[0];
            t3 = TableHelper.sortTable(t3);

            // compute the migrated table entirely in Java for comparison purposes
View Full Code Here


            client.createConnection("localhost");

            TableHelper.loadTable(client, t1);

            if (alterText.trim().length() > 0) {
                ClientResponseImpl response = (ClientResponseImpl) client.callProcedure(
                        "@AdHoc", alterText, null);
                System.out.println(response.toJSONString());
            }

            VoltTable t3 = client.callProcedure("@AdHoc", "select * from FOO").getResults()[0];
            t3 = TableHelper.sortTable(t3);

View Full Code Here

        try {
            migrateSchema(schema1, schema2);
            fail();
        }
        catch (ProcCallException e) {
            ClientResponseImpl cri = (ClientResponseImpl) e.getClientResponse();
            assertEquals(cri.getStatus(), ClientResponse.GRACEFUL_FAILURE);
            assertTrue(cri.getStatusString().contains(pattern));
        }
        catch (Exception e) {
            e.printStackTrace();
            fail("Expected ProcCallException but got: " + e);
        }
View Full Code Here

                    nTruncates++;
                }
                shouldRollback = 0;
            }
            catch (ProcCallException e) {
                ClientResponseImpl cri = (ClientResponseImpl) e.getClientResponse();
                if (shouldRollback == 0) {
                    // this implies bad data and is fatal
                    if ((cri.getStatus() == ClientResponse.GRACEFUL_FAILURE) ||
                            (cri.getStatus() == ClientResponse.USER_ABORT)) {
                        // on exception, log and end the thread, but don't kill the process
                        log.error("TruncateTableLoader failed a TruncateTable ProcCallException call for table " + tableName, e);
                        Benchmark.printJStack();
                        System.exit(-1);
                    }
                }
            }
            catch (InterruptedIOException e) {
                // just need to fall through and get out
            }
            catch (Exception e) {
                // on exception, log and end the thread, but don't kill the process
                log.error("TruncateTableLoader failed a non-proc call exception for table " + tableName, e);
                try { Thread.sleep(3000); } catch (Exception e2) {}
            }

            // scan-agg table
            try {
                currentRowCount = getRowCount();
                log.debug("TruncateTableLoader scan agg table..." + tableName + " current row count is " + currentRowCount);
                shouldRollback = (byte) (r.nextInt(10) == 0 ? 1 : 0);
                long p = Math.abs(r.nextLong());
                String sp = this.scanAggProcedure;
                if (tableName == "trup")
                    sp += r.nextInt(100) < mpRatio * 100. ? "MP" : "SP";
                ClientResponse clientResponse = client.callProcedure(tableName.toUpperCase() + sp, p, shouldRollback);
                byte status = clientResponse.getStatus();
                if (status == ClientResponse.GRACEFUL_FAILURE ||
                        (shouldRollback == 0 && status == ClientResponse.USER_ABORT)) {
                    log.error("TruncateTableLoader gracefully failed to scan-agg table " + tableName + " and this shoudn't happen. Exiting.");
                    log.error(((ClientResponseImpl) clientResponse).toJSONString());
                    Benchmark.printJStack();
                    // stop the world
                    System.exit(-1);
                }
                if (status != ClientResponse.SUCCESS) {
                    // log what happened
                    log.error("TruncateTableLoader ungracefully failed to scan-agg table " + tableName);
                    log.error(((ClientResponseImpl) clientResponse).toJSONString());
                }
                shouldRollback = 0;
            }
            catch (ProcCallException e) {
                ClientResponseImpl cri = (ClientResponseImpl) e.getClientResponse();
                if (shouldRollback == 0) {
                    // this implies bad data and is fatal
                    if ((cri.getStatus() == ClientResponse.GRACEFUL_FAILURE) ||
                            (cri.getStatus() == ClientResponse.USER_ABORT)) {
                        // on exception, log and end the thread, but don't kill the process
                        log.error("TruncateTableLoader failed a ScanAgg ProcCallException call for table " + tableName, e);
                        Benchmark.printJStack();
                        System.exit(-1);
                    }
View Full Code Here

                    }
                }
                while (m_client.getConnectedHostList().size() == 0);
            }
            catch (ProcCallException e) {
                ClientResponseImpl cri = (ClientResponseImpl) e.getClientResponse();
                handleException(cri, e);
            }
            catch (UserProcCallException e) {
                ClientResponseImpl cri = e.cri;
                handleException(cri, e);
            }
            catch (InterruptedException e) {
                // just need to fall through and get out
            }
View Full Code Here

        Object params[] = task.getParams().toArray();
        if (params.length == 1) {
            return null;
        } else if (params.length == 2) {
            if (params[0] == null) {
                return new ClientResponseImpl(ClientResponseImpl.GRACEFUL_FAILURE,
                                              new VoltTable[0],
                                              "@SnapshotRestore parameter 0 was null",
                                              task.getClientHandle());
            }
            if (params[1] == null) {
                return new ClientResponseImpl(ClientResponseImpl.GRACEFUL_FAILURE,
                                              new VoltTable[0],
                                              "@SnapshotRestore parameter 1 was null",
                                              task.getClientHandle());
            }
            if (!(params[0] instanceof String)) {
                return new ClientResponseImpl(ClientResponseImpl.GRACEFUL_FAILURE,
                                              new VoltTable[0],
                                              "@SnapshotRestore param 0 (path) needs to be a string, but was type "
                                              + params[0].getClass().getSimpleName(),
                                              task.getClientHandle());
            }
            if (!(params[1] instanceof String)) {
                return new ClientResponseImpl(ClientResponseImpl.GRACEFUL_FAILURE,
                                              new VoltTable[0],
                                              "@SnapshotRestore param 1 (nonce) needs to be a string, but was type "
                                              + params[1].getClass().getSimpleName(),
                                              task.getClientHandle());
            }
            JSONObject jsObj = new JSONObject();
            try {
                jsObj.put(SnapshotUtil.JSON_PATH, params[0]);
                jsObj.put(SnapshotUtil.JSON_NONCE, params[1]);
            } catch (JSONException e) {
                Throwables.propagate(e);
            }
            task.setParams( jsObj.toString() );
            return null;
        } else {
            return new ClientResponseImpl(ClientResponseImpl.GRACEFUL_FAILURE,
                                          new VoltTable[0],
                                          "@SnapshotRestore supports a single json document parameter or two parameters (path, nonce), " +
                                          params.length + " parameters provided",
                                          task.getClientHandle());
        }
View Full Code Here

        while (m != null) {
            if (m instanceof Iv2InitiateTaskMessage) {
                // Send IGNORED response for all SPs
                Iv2InitiateTaskMessage task = (Iv2InitiateTaskMessage) m;
                final InitiateResponseMessage response = new InitiateResponseMessage(task);
                response.setResults(new ClientResponseImpl(ClientResponse.UNEXPECTED_FAILURE,
                            new VoltTable[0],
                            ClientResponseImpl.IGNORED_TRANSACTION));
                m_mailbox.send(response.getInitiatorHSId(), response);
            }
            m = m_replaySequencer.drain();
View Full Code Here

            // If it's a DR sentinel, send an acknowledgement
            if (sentinel && !commandLog) {
                MultiPartitionParticipantMessage mppm = (MultiPartitionParticipantMessage) message;
                final InitiateResponseMessage response = new InitiateResponseMessage(mppm);
                ClientResponseImpl clientResponse =
                        new ClientResponseImpl(ClientResponseImpl.UNEXPECTED_FAILURE,
                                new VoltTable[0], ClientResponseImpl.IGNORED_TRANSACTION);
                response.setResults(clientResponse);
                m_mailbox.send(response.getInitiatorHSId(), response);
            }
        }
View Full Code Here

            if (!(procName.equalsIgnoreCase("@LoadSinglepartitionTable") ||
                    procName.equalsIgnoreCase("@LoadMultipartitionTable")) &&
                    inTxnId <= m_lastSeenTxnId) {
                // already sequenced
                final InitiateResponseMessage resp = new InitiateResponseMessage(init);
                resp.setResults(new ClientResponseImpl(ClientResponseImpl.UNEXPECTED_FAILURE,
                        new VoltTable[0],
                        ClientResponseImpl.IGNORED_TRANSACTION));
                return resp;
            }
        }
View Full Code Here

                !spName.startsWith("@AdHoc") &&
                !spName.startsWith("@LoadMultipartitionTable") &&
                !spName.equals("@UpdateApplicationCatalog"))
        {
            InitiateResponseMessage errorResp = new InitiateResponseMessage(txn.m_initiationMsg);
            errorResp.setResults(new ClientResponseImpl(ClientResponse.UNEXPECTED_FAILURE,
                        new VoltTable[] {},
                        "Failure while running system procedure " + txn.m_initiationMsg.getStoredProcedureName() +
                        ", and system procedures can not be restarted."));
            txn.setNeedsRollback();
            completeInitiateTask(siteConnection);
View Full Code Here

TOP

Related Classes of org.voltdb.ClientResponseImpl

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.