title: Cassandra query failure (Tombstones)
body: <p>So this is driving me crazy. i tried querying one of my table in Cassandra and it showed query failure. i tried digging dip in to the reason behind it and found that it was because of tombstone. i changed GC_GRACE_SECONDS to Zero and triggered Compaction using nodetool, And when i queried again it worked fine. however on a subsequent calls query failed again with a same reason. i am using cassandra-nodejs driver.
  This is my data model.</p>
  <pre><code>CREATE TABLE my_table (
      firstname text,
      lastname text,
      email text,
      mobile text,
      date timeuuid,
      value float,
      PRIMARY KEY (firstname, lastname, email, mobile)
  ) WITH CLUSTERING ORDER BY (lastname ASC, email ASC, mobile ASC);
  </code></pre>
  <p>this is the query i want to perform on that data model.</p>
  <pre><code>SELECT firstname, email, toDate(date) as date, mobile, value FROM my_table  WHERE date &gt;= minTimeuuid('2017-03-25 00:00:00+0000') AND date &lt;= minTimeuuid('2017-03-28 23:59:59+0000') ALLOW FILTERING;
  </code></pre>
  <p>the result will have approx 40k rows.
  <a href="http://www.datastax.com/dev/blog/cassandra-anti-patterns-queues-and-queue-like-datasets" rel="nofollow noreferrer">this</a> shows that if we delete something it will be marked as tombstone and will get deleted After GC_GRACE_SECONDS setted for given table. If i understand it correctly then.</p>
  <ol>
  <li>how come there be tombstone problem when i never delete any row of table?</li>
  <li>Is that true a row will be marked as Tombstone if and only if we delete a row?</li>
  <li>clearing tombstones and then querying the same works sometimes and sometimes it does not, why is so?.</li>
  <li>is it a good idea to increase <strong>tombstone_failure_threshold</strong> value? (single node cluster application)</li>
  </ol>
  <p>I am using cassandra 3.5, with cqlsh version 5.0.1. And the query works fine with terminal, but gives error when we execute using external client (express app using nodejs driver for cassandra). i have a single node cluster app.</p>
  <h3>EDIT 1</h3>
  <p>This is the log of my Inserted null value in field (i inserted only name and timestamp);</p>
  <pre><code>  activity                                                                                        | timestamp                  | source        | source_elapsed
  -------------------------------------------------------------------------------------------------+----------------------------+---------------+----------------
                                                                                Execute CQL3 query | 2017-03-29 10:28:27.342000 | 172.31.34.179 |              0
                     Parsing select * FROM testtomb WHERE name = 'Dhaval45'; [SharedPool-Worker-2] | 2017-03-29 10:28:27.342000 | 172.31.34.179 |             64
                                                         Preparing statement [SharedPool-Worker-2] | 2017-03-29 10:28:27.342000 | 172.31.34.179 |            101
                                Executing single-partition query on testtomb [SharedPool-Worker-3] | 2017-03-29 10:28:27.342000 | 172.31.34.179 |            210
                                                Acquiring sstable references [SharedPool-Worker-3] | 2017-03-29 10:28:27.342000 | 172.31.34.179 |            223
   Skipped 0/0 non-slice-intersecting sstables, included 0 due to tombstones [SharedPool-Worker-3] | 2017-03-29 10:28:27.342000 | 172.31.34.179 |            243
                                   Merged data from memtables and 0 sstables [SharedPool-Worker-3] | 2017-03-29 10:28:27.342000 | 172.31.34.179 |            288
                                           Read 2 live and 0 tombstone cells [SharedPool-Worker-3] | 2017-03-29 10:28:27.342001 | 172.31.34.179 |            310
                                   Merged data from memtables and 0 sstables [SharedPool-Worker-3] | 2017-03-29 10:28:27.342001 | 172.31.34.179 |            323
                                                                                  Request complete | 2017-03-29 10:28:27.342385 | 172.31.34.179 |            385
  </code></pre>
  <p>And this is the log when i query on filed which i have executed a delete query. Initially  user <strong>Dhaval15</strong> has firstname 'aaaa' and then i the cell aaa. then again executing select query on same user gave me this log.</p>
  <pre><code>       activity                                                                                        | timestamp                  | source        | source_elapsed
  -------------------------------------------------------------------------------------------------+----------------------------+---------------+----------------
                                                                                Execute CQL3 query | 2017-03-29 10:35:18.581000 | 172.31.34.179 |              0
                     Parsing select * FROM testtomb WHERE name = 'Dhaval15'; [SharedPool-Worker-1] | 2017-03-29 10:35:18.581000 | 172.31.34.179 |             65
                                                         Preparing statement [SharedPool-Worker-1] | 2017-03-29 10:35:18.581000 | 172.31.34.179 |            113
                                Executing single-partition query on testtomb [SharedPool-Worker-3] | 2017-03-29 10:35:18.581000 | 172.31.34.179 |            223
                                                Acquiring sstable references [SharedPool-Worker-3] | 2017-03-29 10:35:18.581000 | 172.31.34.179 |            235
   Skipped 0/0 non-slice-intersecting sstables, included 0 due to tombstones [SharedPool-Worker-3] | 2017-03-29 10:35:18.581000 | 172.31.34.179 |            256
                                   Merged data from memtables and 0 sstables [SharedPool-Worker-3] | 2017-03-29 10:35:18.581001 | 172.31.34.179 |            305
                                           Read 1 live and 1 tombstone cells [SharedPool-Worker-3] | 2017-03-29 10:35:18.581001 | 172.31.34.179 |            338
                                   Merged data from memtables and 0 sstables [SharedPool-Worker-3] | 2017-03-29 10:35:18.581001 | 172.31.34.179 |            351
                                                                                  Request complete | 2017-03-29 10:35:18.581430 | 172.31.34.179 |            430
  </code></pre>