beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Halperin (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (BEAM-1831) Checking of containment in createdTables may have race condition in StreamingWriteFn
Date Thu, 18 May 2017 20:04:04 GMT

     [ https://issues.apache.org/jira/browse/BEAM-1831?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Daniel Halperin closed BEAM-1831.
---------------------------------
       Resolution: Not A Bug
    Fix Version/s: Not applicable

> Checking of containment in createdTables may have race condition in StreamingWriteFn
> ------------------------------------------------------------------------------------
>
>                 Key: BEAM-1831
>                 URL: https://issues.apache.org/jira/browse/BEAM-1831
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-gcp
>            Reporter: Ted Yu
>            Assignee: Reuven Lax
>            Priority: Minor
>             Fix For: Not applicable
>
>
> {code}
>   public TableReference getOrCreateTable(BigQueryOptions options, String tableSpec)
>       throws InterruptedException, IOException {
>     TableReference tableReference = BigQueryHelpers.parseTableSpec(tableSpec);
>     if (createDisposition != createDisposition.CREATE_NEVER
>         && !createdTables.contains(tableSpec)) {
>       synchronized (createdTables) {
>         // Another thread may have succeeded in creating the table in the meanwhile,
so
>         // check again. This check isn't needed for correctness, but we add it to prevent
>         // every thread from attempting a create and overwhelming our BigQuery quota.
>         DatasetService datasetService = bqServices.getDatasetService(options);
>         if (!createdTables.contains(tableSpec)) {
> {code}
> The first createdTables.contains() check is outside synchronized block.
> At least createdTables should be declared volatile for the double checked locking to
work.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message