TheNeuralBit commented on a change in pull request #17125:
URL: https://github.com/apache/beam/pull/17125#discussion_r831364221
##########
File path:
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
##########
@@ -573,7 +573,7 @@ class BeamModulePlugin implements Plugin<Project> {
google_cloud_datastore_v1_proto_client :
"com.google.cloud.datastore:datastore-v1-proto-client:2.1.3",
google_cloud_firestore :
"com.google.cloud:google-cloud-firestore", //
google_cloud_platform_libraries_bom sets version
google_cloud_pubsub :
"com.google.cloud:google-cloud-pubsub", // google_cloud_platform_libraries_bom
sets version
- google_cloud_pubsublite :
"com.google.cloud:google-cloud-pubsublite", //
google_cloud_platform_libraries_bom sets version
+ google_cloud_pubsublite :
"com.google.cloud:google-cloud-pubsublite:1.5.0", //
google_cloud_platform_libraries_bom sets version
Review comment:
Is there a `google_cloud_platform_libraries_bom` version that will
update this client to 1.5.0 instead?
If not I think we should document that this override should be dropped when
one is available
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsublite/internal/MemoryBufferedSubscriber.java
##########
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.io.gcp.pubsublite.internal;
+
+import com.google.api.core.ApiFuture;
+import com.google.api.core.ApiService;
+import com.google.api.gax.rpc.ApiException;
+import com.google.cloud.pubsublite.Offset;
+import com.google.cloud.pubsublite.proto.SequencedMessage;
+import java.util.Optional;
+
+interface MemoryBufferedSubscriber extends ApiService {
Review comment:
It seems there's just two implementations of this interface, one impl
and one `FakeSubscriber` used in a `mockito.spy` for testing. Do we actually
need the interface?
It seems like we could just have a concrete `MemoryBufferedSubscriber` that
is mocked for testing.
##########
File path:
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
##########
@@ -662,14 +662,14 @@ class BeamModulePlugin implements Plugin<Project> {
proto_google_cloud_datastore_v1 :
"com.google.api.grpc:proto-google-cloud-datastore-v1", //
google_cloud_platform_libraries_bom sets version
proto_google_cloud_firestore_v1 :
"com.google.api.grpc:proto-google-cloud-firestore-v1", //
google_cloud_platform_libraries_bom sets version
proto_google_cloud_pubsub_v1 :
"com.google.api.grpc:proto-google-cloud-pubsub-v1", //
google_cloud_platform_libraries_bom sets version
- proto_google_cloud_pubsublite_v1 :
"com.google.api.grpc:proto-google-cloud-pubsublite-v1", //
google_cloud_platform_libraries_bom sets version
+ proto_google_cloud_pubsublite_v1 :
"com.google.api.grpc:proto-google-cloud-pubsublite-v1:1.5.0", //
google_cloud_platform_libraries_bom sets version
proto_google_cloud_spanner_v1 :
"com.google.api.grpc:proto-google-cloud-spanner-v1", //
google_cloud_platform_libraries_bom sets version
proto_google_cloud_spanner_admin_database_v1:
"com.google.api.grpc:proto-google-cloud-spanner-admin-database-v1", //
google_cloud_platform_libraries_bom sets version
proto_google_common_protos :
"com.google.api.grpc:proto-google-common-protos", //
google_cloud_platform_libraries_bom sets version
slf4j_api :
"org.slf4j:slf4j-api:$slf4j_version",
slf4j_simple :
"org.slf4j:slf4j-simple:$slf4j_version",
slf4j_jdk14 :
"org.slf4j:slf4j-jdk14:$slf4j_version",
- slf4j_log4j12 :
"org.slf4j:slf4j-log4j12:$slf4j_version",
+ slf4j_log4j12 :
"org.slf4j:ssslf4j-log4j12:$slf4j_version",
Review comment:
this looks like a typo
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsublite/internal/MemoryLimiter.java
##########
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.io.gcp.pubsublite.internal;
+
+/**
+ * A class which tracks blocks of memory which have been given out, and tries
to limit total memory
+ * size.
+ */
+interface MemoryLimiter {
Review comment:
Same question here, do we need this interface?
##########
File path:
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/pubsublite/internal/SubscriptionPartitionProcessorImplTest.java
##########
@@ -63,24 +60,23 @@
import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.Spy;
-import org.mockito.stubbing.Answer;
@RunWith(JUnit4.class)
@SuppressWarnings("initialization.fields.uninitialized")
public class SubscriptionPartitionProcessorImplTest {
+ private static final SubscriptionPartition PARTITION =
+ SubscriptionPartition.of(example(SubscriptionPath.class),
example(Partition.class));
+
@Spy RestrictionTracker<OffsetByteRange, OffsetByteProgress> tracker;
@Mock OutputReceiver<SequencedMessage> receiver;
- @Mock Function<Consumer<List<SequencedMessage>>, Subscriber>
subscriberFactory;
+ @Mock Supplier<MemoryBufferedSubscriber> subscriberFactory;
@Rule public Timeout globalTimeout = Timeout.seconds(30);
- abstract static class FakeSubscriber extends FakeApiService implements
Subscriber {}
Review comment:
I guess maybe the interface/implementation is following an existing
pattern used with `Subscriber` here?
I still think it's worth considering if we actually need the new interfaces
though
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]