You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "mutianf (via GitHub)" <gi...@apache.org> on 2023/04/10 18:13:08 UTC

[GitHub] [beam] mutianf opened a new pull request, #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

mutianf opened a new pull request, #26205:
URL: https://github.com/apache/beam/pull/26205

   Fix for issue: https://github.com/apache/beam/issues/26166
   
   **Please** add a meaningful description for your change here
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/get-started-contributing/#make-the-reviewers-job-easier).
   
   To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/workflows/Python%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/workflows/Java%20Tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Go tests](https://github.com/apache/beam/workflows/Go%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI.
   


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] igorbernstein2 commented on a diff in pull request #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

Posted by "igorbernstein2 (via GitHub)" <gi...@apache.org>.
igorbernstein2 commented on code in PR #26205:
URL: https://github.com/apache/beam/pull/26205#discussion_r1161960876


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableServiceFactory.java:
##########
@@ -44,111 +43,120 @@
 class BigtableServiceFactory implements Serializable {
 
   private static final Logger LOG = LoggerFactory.getLogger(BigtableServiceFactory.class);
-
-  static final BigtableServiceFactory FACTORY_INSTANCE = new BigtableServiceFactory();
-
-  private transient int nextId = 0;
-
-  private transient Map<ConfigId, BigtableServiceEntry> entries = new HashMap<>();
+  private static final ConcurrentHashMap<UUID, BigtableServiceEntry> entries =
+      new ConcurrentHashMap<>();
+  private static final ConcurrentHashMap<UUID, AtomicInteger> refCounts = new ConcurrentHashMap<>();
+  private static final Object lock = new Object();
 
   @AutoValue
   abstract static class ConfigId implements Serializable {
 
-    abstract int id();
+    abstract UUID id();
 
-    static ConfigId create(int id) {
-      return new AutoValue_BigtableServiceFactory_ConfigId(id);
+    static ConfigId create() {
+      return new AutoValue_BigtableServiceFactory_ConfigId(UUID.randomUUID());
     }
   }
 
   @AutoValue
   abstract static class BigtableServiceEntry implements Serializable, AutoCloseable {
 
-    abstract BigtableServiceFactory getServiceFactory();
-
     abstract ConfigId getConfigId();
 
     abstract BigtableService getService();
 
-    abstract AtomicInteger getRefCount();
-
-    static BigtableServiceEntry create(
-        BigtableServiceFactory factory,
-        ConfigId configId,
-        BigtableService service,
-        AtomicInteger refCount) {
-      return new AutoValue_BigtableServiceFactory_BigtableServiceEntry(
-          factory, configId, service, refCount);
+    static BigtableServiceEntry create(ConfigId configId, BigtableService service) {
+      return new AutoValue_BigtableServiceFactory_BigtableServiceEntry(configId, service);
     }
 
     @Override
     public void close() {
-      getServiceFactory().releaseService(this);
+      int refCount =
+          refCounts.getOrDefault(getConfigId().id(), new AtomicInteger(0)).decrementAndGet();

Review Comment:
   if refCounts doesnt contain the configId or the ref count is already < 0, please log an error



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] Abacn commented on pull request #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on PR #26205:
URL: https://github.com/apache/beam/pull/26205#issuecomment-1503382180

   @jrmccluskey This is known issue #25207. It was causing the whole GCP_IO test suite time out before I added test timeout of 10min per test. From the log the suspected cause is some racing condition that temp file gets deleted when the test run and then test hanging. It happens occassionally but recently becomes more frequent. Possibly because other tests get added to GCP_IO then the order that junit running these test changed.


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] jrmccluskey commented on pull request #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

Posted by "jrmccluskey (via GitHub)" <gi...@apache.org>.
jrmccluskey commented on PR #26205:
URL: https://github.com/apache/beam/pull/26205#issuecomment-1503372360

   It looks like there's a somewhat consistent timeout in `testTriggeredFileLoadsWithTempTablesToExistingNullSchemaTable`:
   
   ```
   17:37:22 org.apache.beam.sdk.io.gcp.bigquery.BigQueryIOWriteTest > testTriggeredFileLoadsWithTempTablesToExistingNullSchemaTable[1] FAILED
   17:37:22     org.junit.runners.model.TestTimedOutException at BigQueryIOWriteTest.java:729
   17:45:55 
   17:45:55 1645 tests completed, 1 failed, 124 skipped
   ```
   
   Is this a matter of needing higher bounds on the direct runner?


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] jrmccluskey commented on pull request #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

Posted by "jrmccluskey (via GitHub)" <gi...@apache.org>.
jrmccluskey commented on PR #26205:
URL: https://github.com/apache/beam/pull/26205#issuecomment-1502239000

   Run Java_GCP_IO_Direct PreCommit


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] github-actions[bot] commented on pull request #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26205:
URL: https://github.com/apache/beam/pull/26205#issuecomment-1502223347

   Assigning reviewers. If you would like to opt out of this review, comment `assign to next reviewer`:
   
   R: @robertwb for label java.
   R: @ahmedabu98 for label io.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
   
   The PR bot will only process comments in the main thread (not review comments).


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] igorbernstein2 commented on a diff in pull request #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

Posted by "igorbernstein2 (via GitHub)" <gi...@apache.org>.
igorbernstein2 commented on code in PR #26205:
URL: https://github.com/apache/beam/pull/26205#discussion_r1161958924


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableConfigTranslator.java:
##########
@@ -180,10 +180,18 @@ private static BigtableDataSettings configureWriteSettings(
         settings.stubSettings().bulkMutateRowsSettings();
     RetrySettings.Builder retrySettings = callSettings.getRetrySettings().toBuilder();
     BatchingSettings.Builder batchingSettings = callSettings.getBatchingSettings().toBuilder();
+
+    // The default attempt timeout for version <= 2.46.0 is 6 minutes. Reset the timeout to align
+    // with the old behavior.
+    retrySettings
+        .setInitialRpcTimeout(Duration.ofMinutes(6))
+        .setMaxRpcTimeout(Duration.ofMinutes(6));
+
     if (writeOptions.getAttemptTimeout() != null) {

Review Comment:
   Might be nice to clean this up a bit:
   
   ```
   Duration attemptTimeout = Duration.ofMinutes(6);
   
   if (writeOptions.getAttemptTimeout() != null) {
     attemptTimeout = Duration.ofMillis(writeOptions.getAttemptTimeout().getMillis());
   }
   retrySettings.setInitialRpcTimeout(attemptTimeout).setMaxRpcTime(attemptTimeout);
   
   ```



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] jrmccluskey commented on pull request #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

Posted by "jrmccluskey (via GitHub)" <gi...@apache.org>.
jrmccluskey commented on PR #26205:
URL: https://github.com/apache/beam/pull/26205#issuecomment-1503902487

   Ah noted. In that case I'm comfortable merging this, the Java 11 examples passed but the PR didn't get updated


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] Abacn commented on pull request #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on PR #26205:
URL: https://github.com/apache/beam/pull/26205#issuecomment-1502340992

   Run Java_GCP_IO_Direct PreCommit


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] jrmccluskey merged pull request #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

Posted by "jrmccluskey (via GitHub)" <gi...@apache.org>.
jrmccluskey merged PR #26205:
URL: https://github.com/apache/beam/pull/26205


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] jrmccluskey commented on pull request #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

Posted by "jrmccluskey (via GitHub)" <gi...@apache.org>.
jrmccluskey commented on PR #26205:
URL: https://github.com/apache/beam/pull/26205#issuecomment-1503891105

   Hmm still getting that Spanner IO failure. I don't have reason to believe it's related to this PR  though. CC: @johnjcasey 


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] Abacn commented on pull request #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on PR #26205:
URL: https://github.com/apache/beam/pull/26205#issuecomment-1503897198

   > Hmm still getting that Spanner IO failure. I don't have reason to believe it's related to this PR though. CC: @johnjcasey
   
   That is #26208 unrelated to Beam 


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] jrmccluskey commented on pull request #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

Posted by "jrmccluskey (via GitHub)" <gi...@apache.org>.
jrmccluskey commented on PR #26205:
URL: https://github.com/apache/beam/pull/26205#issuecomment-1503389048

   retest this please


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] jrmccluskey commented on pull request #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

Posted by "jrmccluskey (via GitHub)" <gi...@apache.org>.
jrmccluskey commented on PR #26205:
URL: https://github.com/apache/beam/pull/26205#issuecomment-1503802412

   Run Java_Examples_Dataflow_Java17 PreCommit


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] jrmccluskey commented on pull request #26205: fix: Fix BigtableIO to share one BigtableService per worker and increase default attempt timeout

Posted by "jrmccluskey (via GitHub)" <gi...@apache.org>.
jrmccluskey commented on PR #26205:
URL: https://github.com/apache/beam/pull/26205#issuecomment-1503802705

   Run Java_GCP_IO_Direct PreCommit


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org