context.output(new Delete(context.element().getRow())
.addColumn(
CellUtil.cloneFamily(cell), CellUtil.cloneQualifier(cell), cell.getTimestamp()));
context.output(new Put(context.element().getRow())
.addColumn(CellUtil.cloneFamily(cell), newColumn.getBytes(),
cell.getTimestamp(), newValue.build().toByteArray()));
Is this guaranteed to be row atomic....is it possible that the delete happens but the put does not?
If the same were to happen across column families, will it still remain row atomic?
I am using beam 2.1.0
and bigtable-hbase-beam 1.0.0
@StartBundle
public synchronized void getBufferedMutator(StartBundleContext context)
throws IOException {
this.mutator = getConnection().getBufferedMutator([Your table]);
}
/**
* Performs an asynchronous mutation via {@link BufferedMutator#mutate(Mutation)}.
*/
@ProcessElement
public void processElement(ProcessContext context) throws Exception {
Mutation mutation = new RowMutation(...)
mutator.mutate(mutation);
}
/**
* Closes the {@link BufferedMutator} and {@link Connection}.
*/
@FinishBundle
public synchronized void finishBundle(FinishBundleContext context) throws Exception {
try {
if (mutator != null) {
mutator.close();
mutator = null;
}
} catch (RetriesExhaustedWithDetailsException exception) {
rethrowException(exception);
}
}
}
This is not guaranteed to be row atomic. You want a RowMutations for atomic Put+Delete combinations. Unfortunately, We don't support RowMutations in CloudBigtableIO yet.As of now, there are a couple of things you can do.1) extends AbstractCloudBigtableTableDoFn and do something like this:
@StartBundle
public synchronized void getBufferedMutator(StartBundleContext context)
throws IOException {
this.mutator = getConnection().getBufferedMutator([Your table]);
}
/**
* Performs an asynchronous mutation via {@link BufferedMutator#mutate(Mutation)}.
*/
@ProcessElement
public void processElement(ProcessContext context) throws Exception {
Mutation mutation = new RowMutation(...)
mutator.mutate(mutation);
}
/**
* Closes the {@link BufferedMutator} and {@link Connection}.
*/
@FinishBundle
public synchronized void finishBundle(FinishBundleContext context) throws Exception {
try {
if (mutator != null) {
mutator.close();
mutator = null;
}
} catch (RetriesExhaustedWithDetailsException exception) {
rethrowException(exception);
}
}
}
2) Use BigtableIO instead, which should allow both delete and SetCell mutations.
| Solomon Duskis | | Google Cloud Bigtable Tech Lead | | sdu...@google.com | | 914-462-0531 |
--
You received this message because you are subscribed to the Google Groups "Google Cloud Bigtable Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-bigtabl...@googlegroups.com.
To post to this group, send email to google-cloud-b...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-bigtable-discuss/4ad96d3d-ac8b-48e3-8f69-bc4de561c380%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.