@Override public Map<ByteBuffer, List<ColumnOrSuperColumn>> multiget_slice(String kvsMethodName, TableReference tableRef, List<ByteBuffer> keys, SlicePredicate predicate, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { int numberOfKeys = keys.size(); int numberOfColumns = predicate.slice_range.count; long startTime = System.currentTimeMillis(); return KvsProfilingLogger.maybeLog( (KvsProfilingLogger.CallableCheckedException<Map<ByteBuffer, List<ColumnOrSuperColumn>>, TException>) () -> client.multiget_slice(kvsMethodName, tableRef, keys, predicate, consistency_level), (logger, timer) -> logger.log("CassandraClient.multiget_slice({}, {}, {}, {}) at time {}, on kvs.{} took {} ms", LoggingArgs.tableRef(tableRef), LoggingArgs.rowCount(numberOfKeys), LoggingArgs.columnCount(numberOfColumns), SafeArg.of("consistency", consistency_level.toString()), LoggingArgs.startTimeMillis(startTime), SafeArg.of("kvsMethodName", kvsMethodName), LoggingArgs.durationMillis(timer)), (logger, rowsToColumns) -> logger.log("and returned {} cells in {} rows with {} bytes", LoggingArgs.cellCount( rowsToColumns.values().stream().mapToInt(value -> value.size()).sum()), LoggingArgs.rowCount(rowsToColumns.size()), LoggingArgs.sizeInBytes(ThriftObjectSizeUtils.getApproximateSizeOfColsByKey(rowsToColumns)))); }
@Override public ColumnOrSuperColumn get(TableReference tableReference, ByteBuffer key, byte[] column, ConsistencyLevel consistency_level) throws InvalidRequestException, NotFoundException, UnavailableException, TimedOutException, TException { long startTime = System.currentTimeMillis(); return KvsProfilingLogger.maybeLog( (KvsProfilingLogger.CallableCheckedException<ColumnOrSuperColumn, TException>) () -> client.get(tableReference, key, column, consistency_level), (logger, timer) -> logger.log("CassandraClient.get({}, {}) at time {} took {} ms", LoggingArgs.tableRef(tableReference), SafeArg.of("consistency", consistency_level.toString()), LoggingArgs.startTimeMillis(startTime), LoggingArgs.durationMillis(timer))); }
@Override public void remove(String kvsMethodName, TableReference tableRef, byte[] row, long timestamp, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { long startTime = System.currentTimeMillis(); KvsProfilingLogger.maybeLog( (KvsProfilingLogger.CallableCheckedException<Void, TException>) () -> { client.remove(kvsMethodName, tableRef, row, timestamp, consistency_level); return null; }, (logger, timer) -> logger.log("CassandraClient.remove({}, {}, {}, {}) at time {}, on kvs.{} took {} ms", LoggingArgs.tableRef(tableRef), SafeArg.of("timestamp", timestamp), SafeArg.of("consistency", consistency_level.toString()), LoggingArgs.startTimeMillis(startTime), SafeArg.of("kvsMethodName", kvsMethodName), LoggingArgs.durationMillis(timer))); }
@Override public void batch_mutate(String kvsMethodName, Map<ByteBuffer, Map<String, List<Mutation>>> mutation_map, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { long startTime = System.currentTimeMillis(); KvsProfilingLogger.maybeLog( (KvsProfilingLogger.CallableCheckedException<Void, TException>) () -> { client.batch_mutate(kvsMethodName, mutation_map, consistency_level); return null; }, (logger, timer) -> { logger.log("CassandraClient.batch_mutate("); ThriftObjectSizeUtils.getSizeOfMutationPerTable(mutation_map).forEach((tableName, size) -> { logger.log("{} -> {}", LoggingArgs.safeInternalTableNameOrPlaceholder(tableName), LoggingArgs.sizeInBytes(size)); }); logger.log(") with consistency {} at time {}, on kvs.{} took {} ms", SafeArg.of("consistency", consistency_level.toString()), LoggingArgs.startTimeMillis(startTime), SafeArg.of("kvsMethodName", kvsMethodName), LoggingArgs.durationMillis(timer)); }); }
@Override public List<KeySlice> get_range_slices(String kvsMethodName, TableReference tableRef, SlicePredicate predicate, KeyRange range, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { int numberOfKeys = predicate.slice_range.count; int numberOfColumns = range.count; long startTime = System.currentTimeMillis(); return KvsProfilingLogger.maybeLog( (KvsProfilingLogger.CallableCheckedException<List<KeySlice>, TException>) () -> client.get_range_slices(kvsMethodName, tableRef, predicate, range, consistency_level), (logger, timer) -> logger.log("CassandraClient.get_range_slices({}, {}, {}, {}) at time {}, on kvs.{} took {} ms", LoggingArgs.tableRef(tableRef), LoggingArgs.rowCount(numberOfKeys), LoggingArgs.columnCount(numberOfColumns), SafeArg.of("consistency", consistency_level.toString()), LoggingArgs.startTimeMillis(startTime), SafeArg.of("kvsMethodName", kvsMethodName), LoggingArgs.durationMillis(timer)), (logger, rows) -> logger.log("and returned {} rows with {} bytes", LoggingArgs.rowCount(rows.size()), LoggingArgs.sizeInBytes(ThriftObjectSizeUtils.getApproximateSizeOfKeySlices(rows)))); }
System.out.println("Delete key: " + key); System.out .println("ConsistencyLevel=" + deleteConsistencyLevel.toString());
public Map<String, Object> toMap() throws CharacterCodingException { HashMap<String, Object> result = new HashMap<String, Object>(); result.put(LogEntryColumns.ROW.toString(), ByteBufferUtil.string(this.rowKey)); result.put(LogEntryColumns.HOST.toString(), this.host); result.put(LogEntryColumns.KS.toString(), this.keyspace); result.put(LogEntryColumns.CF.toString(), this.columnFamily); result.put(LogEntryColumns.STATUS.toString(), "" + this.status); result.put(LogEntryColumns.TIMESTAMP.toString(), "" + this.timestamp); result.put(LogEntryColumns.COLUMN_NAMES.toString(), this.columnNames); result.put(LogEntryColumns.CONSISTENCY_LEVEL.toString(), this.getConsistencyLevel().toString()); if(this.errors != null) { result.putAll(this.errors); } return result; }
System.out.println(); System.out .println("ConsistencyLevel=" + readConsistencyLevel.toString());
.println("ConsistencyLevel=" + writeConsistencyLevel.toString());
System.out.println(); System.out .println("ConsistencyLevel=" + scanConsistencyLevel.toString());
@Override public Map<ByteBuffer, List<ColumnOrSuperColumn>> multiget_slice(String kvsMethodName, TableReference tableRef, List<ByteBuffer> keys, SlicePredicate predicate, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { int numberOfKeys = keys.size(); int numberOfColumns = predicate.slice_range.count; long startTime = System.currentTimeMillis(); return KvsProfilingLogger.maybeLog( (KvsProfilingLogger.CallableCheckedException<Map<ByteBuffer, List<ColumnOrSuperColumn>>, TException>) () -> client.multiget_slice(kvsMethodName, tableRef, keys, predicate, consistency_level), (logger, timer) -> logger.log("CassandraClient.multiget_slice({}, {}, {}, {}) at time {}, on kvs.{} took {} ms", LoggingArgs.tableRef(tableRef), LoggingArgs.rowCount(numberOfKeys), LoggingArgs.columnCount(numberOfColumns), SafeArg.of("consistency", consistency_level.toString()), LoggingArgs.startTimeMillis(startTime), SafeArg.of("kvsMethodName", kvsMethodName), LoggingArgs.durationMillis(timer)), (logger, rowsToColumns) -> logger.log("and returned {} cells in {} rows with {} bytes", LoggingArgs.cellCount( rowsToColumns.values().stream().mapToInt(value -> value.size()).sum()), LoggingArgs.rowCount(rowsToColumns.size()), LoggingArgs.sizeInBytes(ThriftObjectSizeUtils.getApproximateSizeOfColsByKey(rowsToColumns)))); }
@Override public ColumnOrSuperColumn get(TableReference tableReference, ByteBuffer key, byte[] column, ConsistencyLevel consistency_level) throws InvalidRequestException, NotFoundException, UnavailableException, TimedOutException, TException { long startTime = System.currentTimeMillis(); return KvsProfilingLogger.maybeLog( (KvsProfilingLogger.CallableCheckedException<ColumnOrSuperColumn, TException>) () -> client.get(tableReference, key, column, consistency_level), (logger, timer) -> logger.log("CassandraClient.get({}, {}) at time {} took {} ms", LoggingArgs.tableRef(tableReference), SafeArg.of("consistency", consistency_level.toString()), LoggingArgs.startTimeMillis(startTime), LoggingArgs.durationMillis(timer))); }
@Override public void remove(String kvsMethodName, TableReference tableRef, byte[] row, long timestamp, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { long startTime = System.currentTimeMillis(); KvsProfilingLogger.maybeLog( (KvsProfilingLogger.CallableCheckedException<Void, TException>) () -> { client.remove(kvsMethodName, tableRef, row, timestamp, consistency_level); return null; }, (logger, timer) -> logger.log("CassandraClient.remove({}, {}, {}, {}) at time {}, on kvs.{} took {} ms", LoggingArgs.tableRef(tableRef), SafeArg.of("timestamp", timestamp), SafeArg.of("consistency", consistency_level.toString()), LoggingArgs.startTimeMillis(startTime), SafeArg.of("kvsMethodName", kvsMethodName), LoggingArgs.durationMillis(timer))); }
@Override public void batch_mutate(String kvsMethodName, Map<ByteBuffer, Map<String, List<Mutation>>> mutation_map, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { long startTime = System.currentTimeMillis(); KvsProfilingLogger.maybeLog( (KvsProfilingLogger.CallableCheckedException<Void, TException>) () -> { client.batch_mutate(kvsMethodName, mutation_map, consistency_level); return null; }, (logger, timer) -> { logger.log("CassandraClient.batch_mutate("); ThriftObjectSizeUtils.getSizeOfMutationPerTable(mutation_map).forEach((tableName, size) -> { logger.log("{} -> {}", LoggingArgs.safeInternalTableNameOrPlaceholder(tableName), LoggingArgs.sizeInBytes(size)); }); logger.log(") with consistency {} at time {}, on kvs.{} took {} ms", SafeArg.of("consistency", consistency_level.toString()), LoggingArgs.startTimeMillis(startTime), SafeArg.of("kvsMethodName", kvsMethodName), LoggingArgs.durationMillis(timer)); }); }
@Override public List<KeySlice> get_range_slices(String kvsMethodName, TableReference tableRef, SlicePredicate predicate, KeyRange range, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { int numberOfKeys = predicate.slice_range.count; int numberOfColumns = range.count; long startTime = System.currentTimeMillis(); return KvsProfilingLogger.maybeLog( (KvsProfilingLogger.CallableCheckedException<List<KeySlice>, TException>) () -> client.get_range_slices(kvsMethodName, tableRef, predicate, range, consistency_level), (logger, timer) -> logger.log("CassandraClient.get_range_slices({}, {}, {}, {}) at time {}, on kvs.{} took {} ms", LoggingArgs.tableRef(tableRef), LoggingArgs.rowCount(numberOfKeys), LoggingArgs.columnCount(numberOfColumns), SafeArg.of("consistency", consistency_level.toString()), LoggingArgs.startTimeMillis(startTime), SafeArg.of("kvsMethodName", kvsMethodName), LoggingArgs.durationMillis(timer)), (logger, rows) -> logger.log("and returned {} rows with {} bytes", LoggingArgs.rowCount(rows.size()), LoggingArgs.sizeInBytes(ThriftObjectSizeUtils.getApproximateSizeOfKeySlices(rows)))); }