| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc --> |
| <title>QueryChangeStreamAction (Apache Beam 2.38.0-SNAPSHOT)</title> |
| <link rel="stylesheet" type="text/css" href="../../../../../../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../../../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="QueryChangeStreamAction (Apache Beam 2.38.0-SNAPSHOT)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":10}; |
| var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/action/HeartbeatRecordAction.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.action"><span class="typeNameLink">Prev Class</span></a></li> |
| <li>Next Class</li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../../../../../index.html?org/apache/beam/sdk/io/gcp/spanner/changestreams/action/QueryChangeStreamAction.html" target="_top">Frames</a></li> |
| <li><a href="QueryChangeStreamAction.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.beam.sdk.io.gcp.spanner.changestreams.action</div> |
| <h2 title="Class QueryChangeStreamAction" class="title">Class QueryChangeStreamAction</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li>java.lang.Object</li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.beam.sdk.io.gcp.spanner.changestreams.action.QueryChangeStreamAction</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>public class <span class="typeNameLabel">QueryChangeStreamAction</span> |
| extends java.lang.Object</pre> |
| <div class="block">Main action class for querying a partition change stream. This class will perform the change |
| stream query and depending on the record type received, it will dispatch the processing of it to |
| one of the following: <a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/action/ChildPartitionsRecordAction.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.action"><code>ChildPartitionsRecordAction</code></a>, <a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/action/HeartbeatRecordAction.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.action"><code>HeartbeatRecordAction</code></a> or |
| <a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/action/DataChangeRecordAction.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.action"><code>DataChangeRecordAction</code></a>. |
| |
| <p>This class will also make sure to mirror the current watermark (event timestamp processed) in |
| the Connector's metadata tables, by registering a bundle after commit action. |
| |
| <p>When the change stream query for the partition is finished, this class will update the state |
| of the partition in the metadata tables as FINISHED, indicating completion.</div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../../../../../../org/apache/beam/sdk/transforms/DoFn.ProcessContinuation.html" title="class in org.apache.beam.sdk.transforms">DoFn.ProcessContinuation</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/action/QueryChangeStreamAction.html#run-org.apache.beam.sdk.io.gcp.spanner.changestreams.model.PartitionMetadata-org.apache.beam.sdk.transforms.splittabledofn.RestrictionTracker-org.apache.beam.sdk.transforms.DoFn.OutputReceiver-org.apache.beam.sdk.transforms.splittabledofn.ManualWatermarkEstimator-org.apache.beam.sdk.transforms.DoFn.BundleFinalizer-">run</a></span>(<a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/model/PartitionMetadata.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.model">PartitionMetadata</a> partition, |
| <a href="../../../../../../../../../org/apache/beam/sdk/transforms/splittabledofn/RestrictionTracker.html" title="class in org.apache.beam.sdk.transforms.splittabledofn">RestrictionTracker</a><<a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/restriction/TimestampRange.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.restriction">TimestampRange</a>,com.google.cloud.Timestamp> tracker, |
| <a href="../../../../../../../../../org/apache/beam/sdk/transforms/DoFn.OutputReceiver.html" title="interface in org.apache.beam.sdk.transforms">DoFn.OutputReceiver</a><<a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/model/DataChangeRecord.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.model">DataChangeRecord</a>> receiver, |
| <a href="../../../../../../../../../org/apache/beam/sdk/transforms/splittabledofn/ManualWatermarkEstimator.html" title="interface in org.apache.beam.sdk.transforms.splittabledofn">ManualWatermarkEstimator</a><<a href="https://static.javadoc.io/joda-time/joda-time/2.10.10/org/joda/time/Instant.html?is-external=true" title="class or interface in org.joda.time">Instant</a>> watermarkEstimator, |
| <a href="../../../../../../../../../org/apache/beam/sdk/transforms/DoFn.BundleFinalizer.html" title="interface in org.apache.beam.sdk.transforms">DoFn.BundleFinalizer</a> bundleFinalizer)</code> |
| <div class="block">This method will dispatch a change stream query for the given partition, it delegate the |
| processing of the records to one of the corresponding action classes registered and it will |
| keep the state of the partition up to date in the Connector's metadata table.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.Object</h3> |
| <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="run-org.apache.beam.sdk.io.gcp.spanner.changestreams.model.PartitionMetadata-org.apache.beam.sdk.transforms.splittabledofn.RestrictionTracker-org.apache.beam.sdk.transforms.DoFn.OutputReceiver-org.apache.beam.sdk.transforms.splittabledofn.ManualWatermarkEstimator-org.apache.beam.sdk.transforms.DoFn.BundleFinalizer-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>run</h4> |
| <pre>public <a href="../../../../../../../../../org/apache/beam/sdk/transforms/DoFn.ProcessContinuation.html" title="class in org.apache.beam.sdk.transforms">DoFn.ProcessContinuation</a> run(<a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/model/PartitionMetadata.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.model">PartitionMetadata</a> partition, |
| <a href="../../../../../../../../../org/apache/beam/sdk/transforms/splittabledofn/RestrictionTracker.html" title="class in org.apache.beam.sdk.transforms.splittabledofn">RestrictionTracker</a><<a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/restriction/TimestampRange.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.restriction">TimestampRange</a>,com.google.cloud.Timestamp> tracker, |
| <a href="../../../../../../../../../org/apache/beam/sdk/transforms/DoFn.OutputReceiver.html" title="interface in org.apache.beam.sdk.transforms">DoFn.OutputReceiver</a><<a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/model/DataChangeRecord.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.model">DataChangeRecord</a>> receiver, |
| <a href="../../../../../../../../../org/apache/beam/sdk/transforms/splittabledofn/ManualWatermarkEstimator.html" title="interface in org.apache.beam.sdk.transforms.splittabledofn">ManualWatermarkEstimator</a><<a href="https://static.javadoc.io/joda-time/joda-time/2.10.10/org/joda/time/Instant.html?is-external=true" title="class or interface in org.joda.time">Instant</a>> watermarkEstimator, |
| <a href="../../../../../../../../../org/apache/beam/sdk/transforms/DoFn.BundleFinalizer.html" title="interface in org.apache.beam.sdk.transforms">DoFn.BundleFinalizer</a> bundleFinalizer)</pre> |
| <div class="block">This method will dispatch a change stream query for the given partition, it delegate the |
| processing of the records to one of the corresponding action classes registered and it will |
| keep the state of the partition up to date in the Connector's metadata table. |
| |
| <p>The algorithm is as follows: |
| |
| <ol> |
| <li>A change stream query for the partition is performed. |
| <li>For each record, we check the type of the record and dispatch the processing to one of |
| the actions registered. |
| <li>If an <code>Optional</code> with a <a href="../../../../../../../../../org/apache/beam/sdk/transforms/DoFn.ProcessContinuation.html#stop--"><code>DoFn.ProcessContinuation.stop()</code></a> is returned from the |
| actions, we stop processing and return. |
| <li>Before returning we register a bundle finalizer callback to update the watermark of the |
| partition in the metadata tables to the latest processed timestamp. |
| <li>When a change stream query finishes successfully (no more records) we update the |
| partition state to FINISHED. |
| </ol> |
| |
| There might be cases where due to a split at the exact end timestamp of a partition's change |
| stream query, this function could process a residual with an invalid timestamp. In this case, |
| the error is ignored and no work is done for the residual.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>partition</code> - the current partition being processed</dd> |
| <dd><code>tracker</code> - the restriction tracker of the <a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/dofn/ReadChangeStreamPartitionDoFn.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.dofn"><code>ReadChangeStreamPartitionDoFn</code></a> SDF</dd> |
| <dd><code>receiver</code> - the output receiver of the <a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/dofn/ReadChangeStreamPartitionDoFn.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.dofn"><code>ReadChangeStreamPartitionDoFn</code></a> SDF</dd> |
| <dd><code>watermarkEstimator</code> - the watermark estimator of the <a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/dofn/ReadChangeStreamPartitionDoFn.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.dofn"><code>ReadChangeStreamPartitionDoFn</code></a> SDF</dd> |
| <dd><code>bundleFinalizer</code> - the bundle finalizer for <a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/dofn/ReadChangeStreamPartitionDoFn.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.dofn"><code>ReadChangeStreamPartitionDoFn</code></a> SDF |
| bundles</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a <a href="../../../../../../../../../org/apache/beam/sdk/transforms/DoFn.ProcessContinuation.html#stop--"><code>DoFn.ProcessContinuation.stop()</code></a> if a record timestamp could not be claimed or if |
| the partition processing has finished</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../../../../../org/apache/beam/sdk/io/gcp/spanner/changestreams/action/HeartbeatRecordAction.html" title="class in org.apache.beam.sdk.io.gcp.spanner.changestreams.action"><span class="typeNameLink">Prev Class</span></a></li> |
| <li>Next Class</li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../../../../../index.html?org/apache/beam/sdk/io/gcp/spanner/changestreams/action/QueryChangeStreamAction.html" target="_top">Frames</a></li> |
| <li><a href="QueryChangeStreamAction.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </body> |
| </html> |