You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by aw...@apache.org on 2019/01/15 16:02:07 UTC

[cassandra] branch cassandra-3.11 updated (5ede581 -> 62f0280)

This is an automated email from the ASF dual-hosted git repository.

aweisberg pushed a change to branch cassandra-3.11
in repository https://gitbox.apache.org/repos/asf/cassandra.git.


    from 5ede581  Merge branch 'cassandra-3.0' into cassandra-3.11
     new ddbcff3  If SizeEstimatesRecorder misses a 'onDropTable' notification, the size_estimates table will never be cleared for that table.
     new 62f0280  Merge branch 'cassandra-3.0' into cassandra-3.11

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGES.txt                                        |  1 +
 .../org/apache/cassandra/db/SystemKeyspace.java    | 26 ++++++++++++++++++++++
 .../apache/cassandra/service/CassandraDaemon.java  | 17 ++++++++------
 .../apache/cassandra/service/StorageService.java   | 23 +++++++++++++++++++
 .../cassandra/service/StorageServiceMBean.java     |  5 +++++
 5 files changed, 65 insertions(+), 7 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


[cassandra] 01/01: Merge branch 'cassandra-3.0' into cassandra-3.11

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aweisberg pushed a commit to branch cassandra-3.11
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 62f02802704d80496675fd3d198fac43ff24dcf7
Merge: 5ede581 ddbcff3
Author: Ariel Weisberg <aw...@apple.com>
AuthorDate: Mon Jan 14 18:25:17 2019 -0500

    Merge branch 'cassandra-3.0' into cassandra-3.11

 CHANGES.txt                                        |  1 +
 .../org/apache/cassandra/db/SystemKeyspace.java    | 26 ++++++++++++++++++++++
 .../apache/cassandra/service/CassandraDaemon.java  | 17 ++++++++------
 .../apache/cassandra/service/StorageService.java   | 23 +++++++++++++++++++
 .../cassandra/service/StorageServiceMBean.java     |  5 +++++
 5 files changed, 65 insertions(+), 7 deletions(-)

diff --cc CHANGES.txt
index c72e89d,bb8b54c..477afd8
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,7 -1,5 +1,8 @@@
 -3.0.18
 +3.11.4
 + * Make stop-server.bat wait for Cassandra to terminate (CASSANDRA-14829)
 + * Correct sstable sorting for garbagecollect and levelled compaction (CASSANDRA-14870)
 +Merged from 3.0:
+  * If SizeEstimatesRecorder misses a 'onDropTable' notification, the size_estimates table will never be cleared for that table. (CASSANDRA-14905)
   * Counters fail to increment in 2.1/2.2 to 3.X mixed version clusters (CASSANDRA-14958)
   * Streaming needs to synchronise access to LifecycleTransaction (CASSANDRA-14554)
   * Fix cassandra-stress write hang with default options (CASSANDRA-14616)
diff --cc src/java/org/apache/cassandra/db/SystemKeyspace.java
index 973538f,541dd34..812659c
--- a/src/java/org/apache/cassandra/db/SystemKeyspace.java
+++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java
@@@ -1277,6 -1236,32 +1277,32 @@@ public final class SystemKeyspac
          executeInternal(cql, keyspace, table);
      }
  
+     /**
+      * Clears size estimates for a keyspace (used to manually clean when we miss a keyspace drop)
+      */
+     public static void clearSizeEstimates(String keyspace)
+     {
 -        String cql = String.format("DELETE FROM %s.%s WHERE keyspace_name = ?", NAME, SIZE_ESTIMATES);
++        String cql = String.format("DELETE FROM %s.%s WHERE keyspace_name = ?", SchemaConstants.SYSTEM_KEYSPACE_NAME, SIZE_ESTIMATES);
+         executeInternal(cql, keyspace);
+     }
+ 
+     /**
+      * @return A multimap from keyspace to table for all tables with entries in size estimates
+      */
+ 
+     public static synchronized SetMultimap<String, String> getTablesWithSizeEstimates()
+     {
+         SetMultimap<String, String> keyspaceTableMap = HashMultimap.create();
 -        String cql = String.format("SELECT keyspace_name, table_name FROM %s.%s", NAME, SIZE_ESTIMATES);
++        String cql = String.format("SELECT keyspace_name, table_name FROM %s.%s", SchemaConstants.SYSTEM_KEYSPACE_NAME, SIZE_ESTIMATES);
+         UntypedResultSet rs = executeInternal(cql);
+         for (UntypedResultSet.Row row : rs)
+         {
+             keyspaceTableMap.put(row.getString("keyspace_name"), row.getString("table_name"));
+         }
+ 
+         return keyspaceTableMap;
+     }
+ 
      public static synchronized void updateAvailableRanges(String keyspace, Collection<Range<Token>> completedRanges)
      {
          String cql = "UPDATE system.%s SET ranges = ranges + ? WHERE keyspace_name = ?";
diff --cc src/java/org/apache/cassandra/service/CassandraDaemon.java
index fbafd35,9a3a414..b593190
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@@ -337,10 -308,56 +337,19 @@@ public class CassandraDaemo
          // migrate any legacy (pre-3.0) batch entries from system.batchlog to system.batches (new table format)
          LegacyBatchlogMigrator.migrate();
  
 -        // enable auto compaction
 -        for (Keyspace keyspace : Keyspace.all())
 -        {
 -            for (ColumnFamilyStore cfs : keyspace.getColumnFamilyStores())
 -            {
 -                for (final ColumnFamilyStore store : cfs.concatWithIndexes())
 -                {
 -                    if (store.getCompactionStrategyManager().shouldBeEnabled())
 -                        store.enableAutoCompaction();
 -                }
 -            }
 -        }
 -
 -        Runnable viewRebuild = new Runnable()
 -        {
 -            @Override
 -            public void run()
 -            {
 -                for (Keyspace keyspace : Keyspace.all())
 -                {
 -                    keyspace.viewManager.buildAllViews();
 -                }
 -                logger.debug("Completed submission of build tasks for any materialized views defined at startup");
 -            }
 -        };
 -
 -        ScheduledExecutors.optionalTasks.schedule(viewRebuild, StorageService.RING_DELAY, TimeUnit.MILLISECONDS);
 -
          SystemKeyspace.finishStartup();
  
+         // Clean up system.size_estimates entries left lying around from missed keyspace drops (CASSANDRA-14905)
+         StorageService.instance.cleanupSizeEstimates();
+ 
+         // schedule periodic dumps of table size estimates into SystemKeyspace.SIZE_ESTIMATES_CF
+         // set cassandra.size_recorder_interval to 0 to disable
+         int sizeRecorderInterval = Integer.getInteger("cassandra.size_recorder_interval", 5 * 60);
+         if (sizeRecorderInterval > 0)
+             ScheduledExecutors.optionalTasks.scheduleWithFixedDelay(SizeEstimatesRecorder.instance, 30, sizeRecorderInterval, TimeUnit.SECONDS);
+ 
 -        // start server internals
 -        StorageService.instance.registerDaemon(this);
 -        try
 -        {
 -            StorageService.instance.initServer();
 -        }
 -        catch (ConfigurationException e)
 -        {
 -            System.err.println(e.getMessage() + "\nFatal configuration error; unable to start server.  See log for stacktrace.");
 -            exitOrFail(1, "Fatal configuration error", e);
 -        }
 +        // Prepared statements
 +        QueryProcessor.preloadPreparedStatement();
  
          // Metrics
          String metricsReporterConfigFile = System.getProperty("cassandra.metricsReporterConfigFile");
@@@ -643,7 -612,7 +646,7 @@@
          catch (Throwable e)
          {
              boolean logStackTrace =
--                    e instanceof ConfigurationException ? ((ConfigurationException)e).logStackTrace : true;
++            e instanceof ConfigurationException ? ((ConfigurationException)e).logStackTrace : true;
  
              System.out.println("Exception (" + e.getClass().getName() + ") encountered during startup: " + e.getMessage());
  


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org