/** * This method intentionally swallows ordered execution issues. For some reason, our Time UUID ordering does * not agree with the cassandra comparator as our micros get very close * @param query * @param <K> * @param <UUID> * @param <V> * @return */ protected static <K, UUID, V> List<HColumn<UUID, V>> swallowOrderedExecution( final SliceQuery<K, UUID, V> query ) { try { return query.execute().get().getColumns(); } catch ( HInvalidRequestException e ) { //invalid request. Occasionally we get order issues when there shouldn't be, disregard them. final Throwable invalidRequestException = e.getCause(); if ( invalidRequestException instanceof InvalidRequestException //we had a range error && ( ( InvalidRequestException ) invalidRequestException ).getWhy().contains( "range finish must come after start in the order of traversal" )) { return Collections.emptyList(); } throw e; } }
public static boolean columnFamilyExist(String columnfamilyName, String keyspaceName) { try { client.set_keyspace(keyspaceName); client.system_add_column_family(new CfDef(keyspaceName, columnfamilyName)); } catch (InvalidRequestException irex) { StringBuilder builder = new StringBuilder("^Cannot add already existing (?:column family|table) .*$"); if (irex.getWhy() != null && irex.getWhy().matches(builder.toString())) { return true; } return false; } catch (SchemaDisagreementException e) { return false; } catch (TException e) { return false; } return true; }
public static boolean columnFamilyExist(String columnfamilyName, String keyspaceName) { try { client.set_keyspace(keyspaceName); client.system_add_column_family(new CfDef(keyspaceName, columnfamilyName)); } catch (InvalidRequestException irex) { StringBuilder builder = new StringBuilder("Cannot add already existing column family "); if (irex.getWhy() != null && irex.getWhy().contains(builder.toString())) { return true; } return false; } catch (SchemaDisagreementException e) { return false; } catch (TException e) { return false; } return true; }
String why = ((org.apache.cassandra.thrift.InvalidRequestException) original).getWhy(); if (why != null && why.contains("bootstrap")) { he = new HUnavailableException(original);
public Object getFieldValue(_Fields field) { switch (field) { case WHY: return getWhy(); } throw new IllegalStateException(); }
public Object getFieldValue(_Fields field) { switch (field) { case WHY: return getWhy(); } throw new IllegalStateException(); }
public Object getFieldValue(_Fields field) { switch (field) { case WHY: return getWhy(); } throw new IllegalStateException(); }
public static void processStatementInteractive(String query) { try { cliClient.executeCLIStatement(query); } catch (Exception e) { String errorTemplate = sessionState.inFileMode() ? "Line " + lineNumber + " => " : ""; Throwable exception = (e.getCause() == null) ? e : e.getCause(); String message = (exception instanceof InvalidRequestException) ? ((InvalidRequestException) exception).getWhy() : e.getMessage(); sessionState.err.println(errorTemplate + message); if (sessionState.debug || !(e instanceof RuntimeException)) e.printStackTrace(sessionState.err); if (sessionState.batch || sessionState.inFileMode()) { System.exit(4); } } finally { lineNumber++; } }
private void executeDescribeCluster() { if (!CliMain.isConnected()) return; sessionState.out.println("Cluster Information:"); try { sessionState.out.println(" Name: " + thriftClient.describe_cluster_name()); sessionState.out.println(" Snitch: " + thriftClient.describe_snitch()); sessionState.out.println(" Partitioner: " + thriftClient.describe_partitioner()); sessionState.out.println(" Schema versions: "); Map<String,List<String>> versions = thriftClient.describe_schema_versions(); for (String version : versions.keySet()) { sessionState.out.println(String.format("\t%s: %s%n", version, versions.get(version))); } } catch (Exception e) { String message = (e instanceof InvalidRequestException) ? ((InvalidRequestException) e).getWhy() : e.getMessage(); sessionState.err.println("Error retrieving data: " + message); } }
throw new SQLSyntaxErrorException(e.getWhy()+"\n'"+cql+"'",e);
throw new SQLSyntaxErrorException(e.getWhy() + "\n'" + cql + "'", e);
String why = ((org.apache.cassandra.thrift.InvalidRequestException) original).getWhy(); if (why != null && why.contains("bootstrap")) { he = new HUnavailableException(original);
String why = ((org.apache.cassandra.thrift.InvalidRequestException) original).getWhy(); if (why != null && why.contains("bootstrap")) { return new HUnavailableException(original);