public static void store(Batch batch) { store(batch, true); }
public static void store(Batch batch) { store(batch, true); }
public static void store(Batch batch) { store(batch, true); }
public void doVerb(MessageIn<Batch> message, int id) { BatchlogManager.store(message.payload); MessagingService.instance().sendReply(WriteResponse.createMessage(), id, message.from); } }
public void doVerb(MessageIn<Batch> message, int id) { BatchlogManager.store(message.payload); MessagingService.instance().sendReply(WriteResponse.createMessage(), id, message.from); } }
public void doVerb(MessageIn<Batch> message, int id) { BatchlogManager.store(message.payload); MessagingService.instance().sendReply(WriteResponse.createMessage(), id, message.from); } }
private static void syncWriteToBatchlog(WriteResponseHandler<?> handler, Batch batch, Collection<InetAddress> endpoints) throws WriteTimeoutException, WriteFailureException { MessageOut<Batch> message = new MessageOut<>(MessagingService.Verb.BATCH_STORE, batch, Batch.serializer); for (InetAddress target : endpoints) { logger.trace("Sending batchlog store request {} to {} for {} mutations", batch.id, target, batch.size()); if (canDoLocalRequest(target)) performLocally(Stage.MUTATION, Optional.empty(), () -> BatchlogManager.store(batch), handler); else MessagingService.instance().sendRR(message, target, handler); } }
private static void syncWriteToBatchlog(WriteResponseHandler<?> handler, Batch batch, Collection<InetAddress> endpoints) throws WriteTimeoutException, WriteFailureException { MessageOut<Batch> message = new MessageOut<>(MessagingService.Verb.BATCH_STORE, batch, Batch.serializer); for (InetAddress target : endpoints) { logger.trace("Sending batchlog store request {} to {} for {} mutations", batch.id, target, batch.size()); if (canDoLocalRequest(target)) performLocally(Stage.MUTATION, Optional.empty(), () -> BatchlogManager.store(batch), handler); else MessagingService.instance().sendRR(message, target, handler); } }
private static void syncWriteToBatchlog(WriteResponseHandler<?> handler, Batch batch, Collection<InetAddress> endpoints) throws WriteTimeoutException, WriteFailureException { MessageOut<Batch> message = new MessageOut<>(MessagingService.Verb.BATCH_STORE, batch, Batch.serializer); for (InetAddress target : endpoints) { logger.trace("Sending batchlog store request {} to {} for {} mutations", batch.id, target, batch.size()); if (canDoLocalRequest(target)) performLocally(Stage.MUTATION, Optional.empty(), () -> BatchlogManager.store(batch), handler); else MessagingService.instance().sendRR(message, target, handler); } }
private static boolean apply(UntypedResultSet.Row row, long counter) { UUID id = row.getUUID("id"); long timestamp = id.version() == 1 ? UUIDGen.unixTimestamp(id) : row.getLong("written_at"); int version = row.has("version") ? row.getInt("version") : MessagingService.VERSION_12; if (id.version() != 1) id = UUIDGen.getTimeUUID(timestamp, counter); logger.trace("Converting mutation at {}", timestamp); try (DataInputBuffer in = new DataInputBuffer(row.getBytes("data"), false)) { int numMutations = in.readInt(); List<Mutation> mutations = new ArrayList<>(numMutations); for (int i = 0; i < numMutations; i++) mutations.add(Mutation.serializer.deserialize(in, version)); BatchlogManager.store(Batch.createLocal(id, TimeUnit.MILLISECONDS.toMicros(timestamp), mutations)); return true; } catch (Throwable t) { logger.error("Failed to convert mutation {} at timestamp {}", id, timestamp, t); return false; } }
private static boolean apply(UntypedResultSet.Row row, long counter) { UUID id = row.getUUID("id"); long timestamp = id.version() == 1 ? UUIDGen.unixTimestamp(id) : row.getLong("written_at"); int version = row.has("version") ? row.getInt("version") : MessagingService.VERSION_12; if (id.version() != 1) id = UUIDGen.getTimeUUID(timestamp, counter); logger.trace("Converting mutation at {}", timestamp); try (DataInputBuffer in = new DataInputBuffer(row.getBytes("data"), false)) { int numMutations = in.readInt(); List<Mutation> mutations = new ArrayList<>(numMutations); for (int i = 0; i < numMutations; i++) mutations.add(Mutation.serializer.deserialize(in, version)); BatchlogManager.store(Batch.createLocal(id, TimeUnit.MILLISECONDS.toMicros(timestamp), mutations)); return true; } catch (Throwable t) { logger.error("Failed to convert mutation {} at timestamp {}", id, timestamp, t); return false; } }
private static boolean apply(UntypedResultSet.Row row, long counter) { UUID id = row.getUUID("id"); long timestamp = id.version() == 1 ? UUIDGen.unixTimestamp(id) : row.getLong("written_at"); int version = row.has("version") ? row.getInt("version") : MessagingService.VERSION_12; if (id.version() != 1) id = UUIDGen.getTimeUUID(timestamp, counter); logger.trace("Converting mutation at {}", timestamp); try (DataInputBuffer in = new DataInputBuffer(row.getBytes("data"), false)) { int numMutations = in.readInt(); List<Mutation> mutations = new ArrayList<>(numMutations); for (int i = 0; i < numMutations; i++) mutations.add(Mutation.serializer.deserialize(in, version)); BatchlogManager.store(Batch.createLocal(id, TimeUnit.MILLISECONDS.toMicros(timestamp), mutations)); return true; } catch (Throwable t) { logger.error("Failed to convert mutation {} at timestamp {}", id, timestamp, t); return false; } }