| <!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 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>KeySequenceNumber (Storm 2.3.0 API)</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="KeySequenceNumber (Storm 2.3.0 API)"; |
| } |
| } |
| 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="class-use/KeySequenceNumber.html">Use</a></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/storm/blobstore/KeyFilter.html" title="interface in org.apache.storm.blobstore"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/storm/blobstore/ListHDFS.html" title="class in org.apache.storm.blobstore"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/storm/blobstore/KeySequenceNumber.html" target="_top">Frames</a></li> |
| <li><a href="KeySequenceNumber.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><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </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.storm.blobstore</div> |
| <h2 title="Class KeySequenceNumber" class="title">Class KeySequenceNumber</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.storm.blobstore.KeySequenceNumber</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>public class <span class="typeNameLabel">KeySequenceNumber</span> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre> |
| <div class="block"><p>Class hands over the key sequence number which implies the number of updates made to a blob. The information regarding the keys and the sequence number which represents the number of updates are stored within the zookeeper in the following format. /storm/blobstore/key_name/nimbushostport-sequencenumber Example: If there are two nimbodes with nimbus.seeds:leader,non-leader are set, then the state inside the zookeeper is eventually stored as: /storm/blobstore/key1/leader:8080-1 /storm/blobstore/key1/non-leader:8080-1 indicates that a new blob with the name key1 has been created on the leader nimbus and the non-leader nimbus syncs after a call back is triggered by attempting to download the blob and finally updates its state inside the zookeeper.</p><p><p>A watch is placed on the /storm/blobstore/key1 and the znodes leader:8080-1 and non-leader:8080-1 are ephemeral which implies that these nodes exist only until the connection between the corresponding nimbus and the zookeeper persist. If in case the nimbus crashes the node disappears under /storm/blobstore/key1.</p><p><p>The sequence number for the keys are handed over based on the following scenario: Lets assume there are three nimbodes up and running, one being the leader and the other being the non-leader.</p><p><p>1. Create is straight forward. Check whether the znode -> /storm/blobstore/key1 has been created or not. It implies the blob has not been created yet. If not created, it creates it and updates the zookeeper states under /storm/blobstore/key1 and /storm/blobstoremaxkeysequencenumber/key1. The znodes it creates on these nodes are /storm/blobstore/key1/leader:8080-1, /storm/blobstore/key1/non-leader:8080-1 and /storm/blobstoremaxkeysequencenumber/key1/1. The latter holds the global sequence number across all nimbodes more like a static variable indicating the true value of number of updates for a blob. This node helps to maintain sanity in case leadership changes due to crashing.</p><p><p>2. Delete does not require to hand over the sequence number.</p><p><p>3. Finally, the update has few scenarios.</p><p><p>The class implements a TreeSet. The basic idea is if all the nimbodes have the same sequence number for the blob, then the number of elements in the set is 1 which holds the latest value of sequence number. If the number of elements are greater than 1 then it implies that there is sequence mismatch and there is need for syncing the blobs across nimbodes.</p><p><p>The logic for handing over sequence numbers based on the state are described as follows Here consider Nimbus-1 alias as N1 and Nimbus-2 alias as N2. Scenario 1: Example: Normal create/update scenario Operation Nimbus-1:state Nimbus-2:state Seq-Num-Nimbus-1 Seq-Num-Nimbus-2 Max-Seq-Num Create-Key1 alive - Leader alive 1 1 Sync alive - Leader alive 1 1 (callback -> download) 1 Update-Key1 alive - Leader alive 2 1 2 Sync alive - Leader alive 2 2 (callback -> download) 2</p><p><p>Scenario 2: Example: Leader nimbus crash followed by leader election, update and ex-leader restored again Operation Nimbus-1:state Nimbus-2:state Seq-Num-Nimbus-1 Seq-Num-Nimbus-2 Max-Seq-Num Create alive - Leader alive 1 1 Sync alive - Leader alive 1 1 (callback -> download) 1 Update alive - Leader alive 2 1 2 Sync alive - Leader alive 2 2 (callback -> download) 2 Update alive - Leader alive 3 2 3 Crash crash - Leader alive 3 2 3 New - Leader crash alive - Leader 3 (Invalid) 2 3 Update crash alive - Leader 3 (Invalid) 4 (max-seq-num + 1) 4 N1-Restored alive alive - Leader 0 4 4 Sync alive alive - Leader 4 4 4</p><p><p>Scenario 3: Example: Leader nimbus crash followed by leader election, update and ex-leader restored again Operation Nimbus-1:state Nimbus-2:state Seq-Num-Nimbus-1 Seq-Num-Nimbus-2 Max-Seq-Num Create alive - Leader alive 1 1 Sync alive - Leader alive 1 1 (callback -> download) 1 Update alive - Leader alive 2 1 2 Sync alive - Leader alive 2 2 (callback -> download) 2 Update alive - Leader alive 3 2 3 Crash crash - Leader alive 3 2 3 Elect Leader crash alive - Leader 3 (Invalid) 2 3 N1-Restored alive alive - Leader 3 2 3 Read/Update alive alive - Leader 3 4 (Downloads from N1) 4 Sync alive alive - Leader 4 (callback) 4 4 Here the download is triggered whenever an operation corresponding to the blob is triggered on the nimbus like a read or update operation. Here, in the read/update call it is hard to know which call is read or update. Hence, by incrementing the sequence number to max-seq-num + 1 we ensure that the synchronization happens appropriately and all nimbodes have the same blob.</p></div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colOne" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/storm/blobstore/KeySequenceNumber.html#KeySequenceNumber-java.lang.String-org.apache.storm.nimbus.NimbusInfo-">KeySequenceNumber</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key, |
| <a href="../../../../org/apache/storm/nimbus/NimbusInfo.html" title="class in org.apache.storm.nimbus">NimbusInfo</a> nimbusInfo)</code> </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== 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>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/storm/blobstore/KeySequenceNumber.html#getKeySequenceNumber-org.apache.storm.shade.org.apache.curator.framework.CuratorFramework-">getKeySequenceNumber</a></span>(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zkClient)</code> </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.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="KeySequenceNumber-java.lang.String-org.apache.storm.nimbus.NimbusInfo-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>KeySequenceNumber</h4> |
| <pre>public KeySequenceNumber(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key, |
| <a href="../../../../org/apache/storm/nimbus/NimbusInfo.html" title="class in org.apache.storm.nimbus">NimbusInfo</a> nimbusInfo)</pre> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="getKeySequenceNumber-org.apache.storm.shade.org.apache.curator.framework.CuratorFramework-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>getKeySequenceNumber</h4> |
| <pre>public int getKeySequenceNumber(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zkClient) |
| throws <a href="../../../../org/apache/storm/generated/KeyNotFoundException.html" title="class in org.apache.storm.generated">KeyNotFoundException</a></pre> |
| <dl> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../../org/apache/storm/generated/KeyNotFoundException.html" title="class in org.apache.storm.generated">KeyNotFoundException</a></code></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="class-use/KeySequenceNumber.html">Use</a></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 class="aboutLanguage"><script type="text/javascript" src="../../../../highlight.pack.js"></script> |
| <script type="text/javascript"><!-- |
| hljs.initHighlightingOnLoad(); |
| //--></script></div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../org/apache/storm/blobstore/KeyFilter.html" title="interface in org.apache.storm.blobstore"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/storm/blobstore/ListHDFS.html" title="class in org.apache.storm.blobstore"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/storm/blobstore/KeySequenceNumber.html" target="_top">Frames</a></li> |
| <li><a href="KeySequenceNumber.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><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2021 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </body> |
| </html> |