blob: cc831a8fc47eb257631df20c7fe1f6e61256adbb [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>SplitAssigner</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../../jquery/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../../../jquery/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="../../../../../../jquery/jquery-ui.min.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SplitAssigner";
}
}
catch(err) {
}
//-->
var data = {"i0":18,"i1":6,"i2":6,"i3":18,"i4":6,"i5":6,"i6":6,"i7":18,"i8":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],16:["t5","Default Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../index.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" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.apache.iceberg.flink.source.assigner</a></div>
<h2 title="Interface SplitAssigner" class="title">Interface SplitAssigner</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><code>java.lang.AutoCloseable</code>, <code>java.io.Closeable</code></dd>
</dl>
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><code><a href="SimpleSplitAssigner.html" title="class in org.apache.iceberg.flink.source.assigner">SimpleSplitAssigner</a></code></dd>
</dl>
<hr>
<pre>public interface <span class="typeNameLabel">SplitAssigner</span>
extends java.io.Closeable</pre>
<div class="block">SplitAssigner interface is extracted out as a separate component so that we can plug in different
split assignment strategy for different requirements. E.g.
<ul>
<li>Simple assigner with no ordering guarantee or locality aware optimization.
<li>Locality aware assigner that prefer splits that are local.
<li>Snapshot aware assigner that assign splits based on the order they are committed.
<li>Event time alignment assigner that assign splits satisfying certain time ordering within a
single source or across sources.
</ul>
<p>Assigner implementation needs to be thread safe. Enumerator call the assigner APIs mostly from
the coordinator thread. But enumerator may call the <a href="#pendingSplitCount()"><code>pendingSplitCount()</code></a>
from the I/O threads.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<section>
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t5" class="tableTab"><span><a href="javascript:show(16);">Default Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>default void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#close()">close</a></span>()</code></th>
<td class="colLast">
<div class="block">Some assigners may need to perform certain actions when their corresponding enumerators are
closed</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code><a href="GetSplitResult.html" title="class in org.apache.iceberg.flink.source.assigner">GetSplitResult</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getNext(java.lang.String)">getNext</a></span>&#8203;(java.lang.String&nbsp;hostname)</code></th>
<td class="colLast">
<div class="block">Request a new split from the assigner when enumerator trying to assign splits to awaiting
readers.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>java.util.concurrent.CompletableFuture&lt;java.lang.Void&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isAvailable()">isAvailable</a></span>()</code></th>
<td class="colLast">
<div class="block">Enumerator can get a notification via CompletableFuture when the assigner has more splits
available later.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>default void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#onCompletedSplits(java.util.Collection)">onCompletedSplits</a></span>&#8203;(java.util.Collection&lt;java.lang.String&gt;&nbsp;completedSplitIds)</code></th>
<td class="colLast">
<div class="block">Some assigner (like event time alignment) may rack in-progress splits to advance watermark upon
completed splits</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#onDiscoveredSplits(java.util.Collection)">onDiscoveredSplits</a></span>&#8203;(java.util.Collection&lt;<a href="../split/IcebergSourceSplit.html" title="class in org.apache.iceberg.flink.source.split">IcebergSourceSplit</a>&gt;&nbsp;splits)</code></th>
<td class="colLast">
<div class="block">Add new splits discovered by enumerator</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#onUnassignedSplits(java.util.Collection)">onUnassignedSplits</a></span>&#8203;(java.util.Collection&lt;<a href="../split/IcebergSourceSplit.html" title="class in org.apache.iceberg.flink.source.split">IcebergSourceSplit</a>&gt;&nbsp;splits)</code></th>
<td class="colLast">
<div class="block">Forward addSplitsBack event (for failed reader) to assigner</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#pendingSplitCount()">pendingSplitCount</a></span>()</code></th>
<td class="colLast">
<div class="block">Return the number of pending splits that haven't been assigned yet.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>default void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#start()">start</a></span>()</code></th>
<td class="colLast">
<div class="block">Some assigners may need to start background threads or perform other activity such as
registering as listeners to updates from other event sources e.g., watermark tracker.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>java.util.Collection&lt;<a href="../split/IcebergSourceSplitState.html" title="class in org.apache.iceberg.flink.source.split">IcebergSourceSplitState</a>&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#state()">state</a></span>()</code></th>
<td class="colLast">
<div class="block">Get assigner state for checkpointing.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<section>
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="start()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>start</h4>
<pre class="methodSignature">default&nbsp;void&nbsp;start()</pre>
<div class="block">Some assigners may need to start background threads or perform other activity such as
registering as listeners to updates from other event sources e.g., watermark tracker.</div>
</li>
</ul>
<a id="close()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>close</h4>
<pre class="methodSignature">default&nbsp;void&nbsp;close()</pre>
<div class="block">Some assigners may need to perform certain actions when their corresponding enumerators are
closed</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>close</code>&nbsp;in interface&nbsp;<code>java.lang.AutoCloseable</code></dd>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>close</code>&nbsp;in interface&nbsp;<code>java.io.Closeable</code></dd>
</dl>
</li>
</ul>
<a id="getNext(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNext</h4>
<pre class="methodSignature"><a href="GetSplitResult.html" title="class in org.apache.iceberg.flink.source.assigner">GetSplitResult</a>&nbsp;getNext&#8203;(@Nullable
java.lang.String&nbsp;hostname)</pre>
<div class="block">Request a new split from the assigner when enumerator trying to assign splits to awaiting
readers.
<p>If enumerator wasn't able to assign the split (e.g., reader disconnected), enumerator should
call <a href="#onUnassignedSplits(java.util.Collection)"><code>onUnassignedSplits(java.util.Collection&lt;org.apache.iceberg.flink.source.split.IcebergSourceSplit&gt;)</code></a> to return the split.</div>
</li>
</ul>
<a id="onDiscoveredSplits(java.util.Collection)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onDiscoveredSplits</h4>
<pre class="methodSignature">void&nbsp;onDiscoveredSplits&#8203;(java.util.Collection&lt;<a href="../split/IcebergSourceSplit.html" title="class in org.apache.iceberg.flink.source.split">IcebergSourceSplit</a>&gt;&nbsp;splits)</pre>
<div class="block">Add new splits discovered by enumerator</div>
</li>
</ul>
<a id="onUnassignedSplits(java.util.Collection)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onUnassignedSplits</h4>
<pre class="methodSignature">void&nbsp;onUnassignedSplits&#8203;(java.util.Collection&lt;<a href="../split/IcebergSourceSplit.html" title="class in org.apache.iceberg.flink.source.split">IcebergSourceSplit</a>&gt;&nbsp;splits)</pre>
<div class="block">Forward addSplitsBack event (for failed reader) to assigner</div>
</li>
</ul>
<a id="onCompletedSplits(java.util.Collection)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onCompletedSplits</h4>
<pre class="methodSignature">default&nbsp;void&nbsp;onCompletedSplits&#8203;(java.util.Collection&lt;java.lang.String&gt;&nbsp;completedSplitIds)</pre>
<div class="block">Some assigner (like event time alignment) may rack in-progress splits to advance watermark upon
completed splits</div>
</li>
</ul>
<a id="state()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>state</h4>
<pre class="methodSignature">java.util.Collection&lt;<a href="../split/IcebergSourceSplitState.html" title="class in org.apache.iceberg.flink.source.split">IcebergSourceSplitState</a>&gt;&nbsp;state()</pre>
<div class="block">Get assigner state for checkpointing. This is a super-set API that works for all currently
imagined assigners.</div>
</li>
</ul>
<a id="isAvailable()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isAvailable</h4>
<pre class="methodSignature">java.util.concurrent.CompletableFuture&lt;java.lang.Void&gt;&nbsp;isAvailable()</pre>
<div class="block">Enumerator can get a notification via CompletableFuture when the assigner has more splits
available later. Enumerator should schedule assignment in the thenAccept action of the future.
<p>Assigner will return the same future if this method is called again before the previous
future is completed.
<p>The future can be completed from other thread, e.g. the coordinator thread from another
thread for event time alignment.
<p>If enumerator need to trigger action upon the future completion, it may want to run it in
the coordinator thread using <code>SplitEnumeratorContext.runInCoordinatorThread(Runnable)</code>.</div>
</li>
</ul>
<a id="pendingSplitCount()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>pendingSplitCount</h4>
<pre class="methodSignature">int&nbsp;pendingSplitCount()</pre>
<div class="block">Return the number of pending splits that haven't been assigned yet.
<p>The enumerator can poll this API to publish a metric on the number of pending splits.
<p>The enumerator can also use this information to throttle split discovery for streaming read.
If there are already many pending splits tracked by the assigner, it is undesirable to discover
more splits and track them in the assigner. That will increase the memory footprint and
enumerator checkpoint size.
<p>Throttling works better together with <a href="../ScanContext.html#maxPlanningSnapshotCount()"><code>ScanContext.maxPlanningSnapshotCount()</code></a>.
Otherwise, the next split discovery after throttling will just discover all non-enumerated
snapshots and splits, which defeats the purpose of throttling.</div>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../index.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" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses.html">All&nbsp;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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
</footer>
</body>
</html>