title: Questions on TWCS compaction in Cassandra
body: <ol>
  <li><p>In order to use TWCS in C* 2.2, I built jar from the <a href="https://github.com/jeffjirsa/twcs" rel="nofollow noreferrer">https://github.com/jeffjirsa/twcs</a> codeline and added it to my lib directory. Cqlsh works fine with TWCS, but looks like the python driver doesn't recognize the new class and config options. I set the CLASSPATH in <code>cassandra-env.sh</code> to the lib directory. </p>
  
  <pre><code>import ssl
  from cassandra.cluster import Cluster
  from cassandra.auth import PlainTextAuthProvider
  
  ap = PlainTextAuthProvider(username='cassandra', password='cassandra')
  ip = '127.0.0.1'
  ca_path = '/a/ca.pem'
  cluster = Cluster(contact_points=[ip], port=9042, protocol_version=2, auth_provider=ap, ssl_options={'ca_certs': ca_path, 'cert_reqs': ssl.CERT_REQUIRED})
  session = cluster.connect()
  
  create_statement = "CREATE TABLE IF NOT EXISTS test.agg_errors(time timestamp, timeid uuid, datacenter text,app_name text, error_message text, PRIMARY KEY(time,timeid))  WITH CLUSTERING ORDER BY (timeid DESC)  AND  default_time_to_live = 86400 AND compaction = { 'class':'com.jeffjirsa.cassandra.db.compaction.TimeWindowCompactionStrategy','compaction_window_unit': 'HOURS','compaction_window_size': '1' , 'unchecked_tombstone_compaction':'true'} AND gc_grace_seconds = '43200'"
  
  session.execute(create_statement)
  </code></pre></li>
  </ol>
  
  <p>I get an error as :</p>
  
  <pre><code>    ConfigurationException: Failed to validate compaction options: {compaction_window_unit=HOURS, compaction_window_size=2}
  </code></pre>
  
  <p>Also, on further debugging, I noticed that this behavior is not consistent. The above script works fine once in ten runs, rest of the execution throws above error.</p>
  
  <ol start="2">
  <li><p>Can I add the subproperties of STCS to TWCS, for tuning STCS behavior within a window?</p></li>
  <li><p>My window size is considerably lesser than ttl, lets say window 1 hour and ttl 1 day, in that case are the expired SStables after 1 day removed from disk? What interval is this check for expired SStables done? </p></li>
  <li><p>I have read in a blog post about <code>exprired_sstable_check_frequency_seconds</code> for controlling the above behavior? Can this be used to control the frequency of checks?</p></li>
  <li><p>Any suggestions based on which I can choose optimal compaction_window_size relative to the ttl of the table?</p></li>
  </ol>
  
  <p>Note:My Cassandr version 2.2.4. Version present in patch is for 2.2.5, I hope this should not be a problem.</p>