Skip to content

Commit 95c8ea8

Browse files
authored
---
yaml --- r: 19191 b: refs/heads/autosynth-bigquerystorage c: 1baa602 h: refs/heads/master i: 19189: fb12073 19187: c8570f5 19183: 2b8eebc
1 parent f31419b commit 95c8ea8

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

  • branches/autosynth-bigquerystorage/google-cloud-clients/google-cloud-bigtable/src

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ refs/tags/v0.69.0: 78f67a29e8b9c46ba01de566a2eae0fd1c03edea
124124
refs/heads/autosynth-asset: cd8251de8c40e239ad24dcf9ed93ea2708a3eed5
125125
refs/heads/autosynth-automl: 2a8b018cf05811fd472e5d1053e67a12ceec0b64
126126
refs/heads/autosynth-bigquerydatatransfer: 564833a85642d4194adc025f021e10e723154246
127-
refs/heads/autosynth-bigquerystorage: 81bdd008363130086ab4a328e28bfbe13ede8ed3
127+
refs/heads/autosynth-bigquerystorage: 1baa6023966a694c1ccd8ed8d5b47ece662b4fce
128128
refs/heads/autosynth-bigtable: 2fbcb15847e0e89e79d6dc07420e28d7dfcea894
129129
refs/heads/autosynth-bigtable-admin: 6379a2bc712f2736c83de0e009b4d26da4fa82ca
130130
refs/heads/autosynth-containeranalysis: 039ca5b8db725c76c16a965ff26b2774322b8ef8

branches/autosynth-bigquerystorage/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Mutation.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ public static Mutation createUnsafe() {
7373
return new Mutation(true);
7474
}
7575

76+
/**
77+
* Wraps the List of protobuf {@link com.google.bigtable.v2.Mutation}. This methods, like {@link
78+
* #createUnsafe()}, allows setCell operation to use server side timestamp. This is dangerous
79+
* because mutations will no longer be idempotent, which might cause multiple duplicate values to
80+
* be stored in Bigtable. This option should only be used for advanced usecases with extreme care.
81+
*/
82+
@BetaApi
83+
public static Mutation fromProtoUnsafe(List<com.google.bigtable.v2.Mutation> protos) {
84+
Mutation mutation = new Mutation(true);
85+
mutation.mutations.addAll(protos);
86+
return mutation;
87+
}
88+
7689
private Mutation(boolean allowServersideTimestamp) {
7790
this.allowServersideTimestamp = allowServersideTimestamp;
7891
}

branches/autosynth-bigquerystorage/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/MutationTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ public void setCellTest() {
9595
assertThat(actual.get(3).getSetCell().getValue())
9696
.isEqualTo(ByteString.copyFromUtf8("fake-value2"));
9797
assertThat(actual.get(3).getSetCell().getTimestampMicros()).isIn(expectedTimestampRange);
98+
99+
assertThat(Mutation.fromProtoUnsafe(actual).getMutations()).isEqualTo(actual);
98100
}
99101

100102
@Test

0 commit comments

Comments
 (0)