Skip to content

Commit 1c1aae9

Browse files
deps: update dependency com.google.cloud:google-cloud-pubsublite-parent to v0.16.1 (#215)
* update * update * version bump Co-authored-by: Tianzi Cai <tianzi@google.com>
1 parent 349dc13 commit 1c1aae9

5 files changed

Lines changed: 28 additions & 26 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>com.google.cloud</groupId>
55
<artifactId>google-cloud-pubsublite-parent</artifactId>
6-
<version>0.16.0</version>
6+
<version>0.17.0</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<groupId>com.google.cloud</groupId>

src/main/java/com/google/cloud/pubsublite/spark/PslReadDataSourceOptions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ MultiPartitionCommitter newMultiPartitionCommitter(long topicPartitionCount) {
136136
.instantiate());
137137
}
138138

139+
@SuppressWarnings("CheckReturnValue")
139140
PartitionSubscriberFactory getSubscriberFactory() {
140141
return (partition, offset, consumer) -> {
141142
PubsubContext context = PubsubContext.of(Constants.FRAMEWORK);

src/main/java/com/google/cloud/pubsublite/spark/PslSparkUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ private static <T> void extractVal(
117117
}
118118
}
119119

120+
@SuppressWarnings("CheckReturnValue")
120121
public static Message toPubSubMessage(StructType inputSchema, InternalRow row) {
121122
Message.Builder builder = Message.builder();
122123
extractVal(

src/main/java/com/google/cloud/pubsublite/spark/internal/CachedPublishers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class CachedPublishers {
3434
private final Executor listenerExecutor = Executors.newSingleThreadExecutor();
3535

3636
@GuardedBy("this")
37-
private static final Map<PslWriteDataSourceOptions, Publisher<MessageMetadata>> publishers =
37+
private final Map<PslWriteDataSourceOptions, Publisher<MessageMetadata>> publishers =
3838
new HashMap<>();
3939

4040
public synchronized Publisher<MessageMetadata> getOrCreate(

src/main/java/com/google/cloud/pubsublite/spark/internal/MultiPartitionCommitterImpl.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.google.api.core.ApiFuture;
2020
import com.google.api.core.ApiFutureCallback;
2121
import com.google.api.core.ApiFutures;
22+
import com.google.cloud.pubsublite.Offset;
2223
import com.google.cloud.pubsublite.Partition;
2324
import com.google.cloud.pubsublite.internal.wire.Committer;
2425
import com.google.cloud.pubsublite.spark.PslSourceOffset;
@@ -115,30 +116,29 @@ private synchronized void cleanUpCommitterMap() {
115116
@Override
116117
public synchronized void commit(PslSourceOffset offset) {
117118
updateCommitterMap(offset);
118-
offset
119-
.partitionOffsetMap()
120-
.forEach(
121-
(p, o) -> {
122-
// Note we don't need to worry about commit offset disorder here since Committer
123-
// guarantees the ordering. Once commitOffset() returns, it's either already
124-
// sent to stream, or waiting for next connection to open to be sent in order.
125-
ApiFuture<Void> future = committerMap.get(p).commitOffset(o);
126-
ApiFutures.addCallback(
127-
future,
128-
new ApiFutureCallback<Void>() {
129-
@Override
130-
public void onFailure(Throwable t) {
131-
if (!future.isCancelled()) {
132-
log.atWarning().log("Failed to commit %s,%s.", p.value(), o.value(), t);
133-
}
134-
}
119+
for (Map.Entry<Partition, Offset> entry : offset.partitionOffsetMap().entrySet()) {
120+
// Note we don't need to worry about commit offset disorder here since Committer
121+
// guarantees the ordering. Once commitOffset() returns, it's either already
122+
// sent to stream, or waiting for next connection to open to be sent in order.
123+
ApiFuture<Void> future = committerMap.get(entry.getKey()).commitOffset(entry.getValue());
124+
ApiFutures.addCallback(
125+
future,
126+
new ApiFutureCallback<Void>() {
127+
@Override
128+
public void onFailure(Throwable t) {
129+
if (!future.isCancelled()) {
130+
log.atWarning().withCause(t).log(
131+
"Failed to commit %s,%s.", entry.getKey().value(), entry.getValue().value());
132+
}
133+
}
135134

136-
@Override
137-
public void onSuccess(Void result) {
138-
log.atInfo().log("Committed %s,%s.", p.value(), o.value());
139-
}
140-
},
141-
MoreExecutors.directExecutor());
142-
});
135+
@Override
136+
public void onSuccess(Void result) {
137+
log.atInfo().log(
138+
"Committed %s,%s.", entry.getKey().value(), entry.getValue().value());
139+
}
140+
},
141+
MoreExecutors.directExecutor());
142+
}
143143
}
144144
}

0 commit comments

Comments
 (0)