<p dir="auto"><strong>Is this a request for help?</strong> (If yes, you should use our troubleshooting guide and community support channels, see <a href="http://kubernetes.io/docs/troubleshooting/" rel="nofollow">http://kubernetes.io/docs/troubleshooting/</a>.): No</p>
<p dir="auto"><strong>What keywords did you search in Kubernetes issues before filing this one?</strong> (If you have found any duplicates, you should instead reply there.): etcd watcher</p>
<hr>
<p dir="auto"><strong>Is this a BUG REPORT or FEATURE REQUEST?</strong> (choose one): Bug report</p>

<p dir="auto"><strong>Kubernetes version</strong> (use <code class="notranslate">kubectl version</code>): HEAD / commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/kubernetes/kubernetes/commit/8b5264e095251aa4ffa546390e2ef785061dc5e8/hovercard" href="https://github.com/kubernetes/kubernetes/commit/8b5264e095251aa4ffa546390e2ef785061dc5e8"><tt>8b5264e</tt></a></p>
<p dir="auto"><strong>Environment</strong>:</p>
<ul dir="auto">
<li><strong>Cloud provider or hardware configuration</strong>: local VM</li>
<li><strong>OS</strong> (e.g. from /etc/os-release): Fedora 24</li>
<li><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>): Linux localhost.localdomain 4.7.7-200.fc24.x86_64 <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="35192559" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubernetes/issues/1" data-hovercard-type="issue" data-hovercard-url="/kubernetes/kubernetes/issues/1/hovercard" href="https://github.com/kubernetes/kubernetes/issues/1">#1</a> SMP Sat Oct 8 00:21:59 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux</li>
<li><strong>Install tools</strong>: N/A</li>
<li><strong>Others</strong>: N/A</li>
</ul>
<p dir="auto"><strong>What happened</strong>:</p>
<p dir="auto">If you do a watch from resource version "0" using etcd_watcher.go (the etcd v2 client code), it initially performs a get of the key in question and returns Added or Modified events, based on a comparison of each node's createdIndex and modifiedIndex. This works all the time.</p>
<p dir="auto">If you do a watch from resource version "0" using watcher.go (the etcd v3 client code), it attempts to get <code class="notranslate">kv.modifiedIndex - 1</code> for each kv returned, in an attempt to provide both the previous and current versions of each kv/object. This works as long as <code class="notranslate">kv.modifiedIndex - 1</code> has not been compacted. If compaction has occurred, the initial <code class="notranslate">sync()</code> will fail, and it's not possible to watch from "0"' for this particular key.</p>
<p dir="auto"><strong>What you expected to happen</strong>:</p>
<p dir="auto">Either:</p>
<ol dir="auto">
<li>The v3 watcher should not change the behavior from the v2 watcher; namely, it should not attempt to get the previous revision of each object and instead just return the current version as a <code class="notranslate">watch.Added</code> event</li>
<li>We agree that it's ok to change the behavior, and in the event that the database has been compacted and the previous revision of an object cannot be retrieved, that object is sent as a <code class="notranslate">watch.Added</code> event instead of <code class="notranslate">watch.Modified</code>.</li>
</ol>
<p dir="auto"><strong>How to reproduce it</strong> (as minimally and precisely as possible): I'm working on a unit test and fix.</p>
<p dir="auto"><strong>Anything else do we need to know</strong>:</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/wojtek-t/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/wojtek-t">@wojtek-t</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/hongchaodeng/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/hongchaodeng">@hongchaodeng</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/xiang90/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/xiang90">@xiang90</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/smarterclayton/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/smarterclayton">@smarterclayton</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/liggitt/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/liggitt">@liggitt</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/deads2k/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/deads2k">@deads2k</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/derekwaynecarr/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/derekwaynecarr">@derekwaynecarr</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/sttts/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/sttts">@sttts</a></p>
<p dir="auto"><strong>Is this a request for help?</strong> (If yes, you should use our troubleshooting guide and community support channels, see <a href="http://kubernetes.io/docs/troubleshooting/" rel="nofollow">http://kubernetes.io/docs/troubleshooting/</a>.):</p>
<p dir="auto"><strong>What keywords did you search in Kubernetes issues before filing this one?</strong> (If you have found any duplicates, you should instead reply there.):</p>
<hr>
<p dir="auto"><strong>Is this a BUG REPORT or FEATURE REQUEST?</strong> (choose one):</p>

<p dir="auto"><strong>Kubernetes version</strong> (use <code class="notranslate">kubectl version</code>):</p>
<p dir="auto"><strong>Environment</strong>:</p>
<ul dir="auto">
<li><strong>Cloud provider or hardware configuration</strong>:</li>
<li><strong>OS</strong> (e.g. from /etc/os-release):</li>
<li><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>):</li>
<li><strong>Install tools</strong>:</li>
<li><strong>Others</strong>:</li>
</ul>
<p dir="auto"><strong>What happened</strong>:</p>
<p dir="auto"><strong>What you expected to happen</strong>:</p>
<p dir="auto"><strong>How to reproduce it</strong> (as minimally and precisely as possible):</p>
<p dir="auto"><strong>Anything else do we need to know</strong>:</p>