Merge branch 'cassandra-2.2' into cassandra-3.0

Conflicts:
        CHANGES.txt
        src/java/org/apache/cassandra/db/compaction/CompactionManager.java
        src/java/org/apache/cassandra/utils/FBUtilities.java


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/99d5c396
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/99d5c396
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/99d5c396

Branch: refs/heads/cassandra-3.0
Commit: 99d5c39668cb0855ffee6b5511147c92ff4aa35f
Parents: 351c7ca d769fcb
Author: Benedict Elliott Smith <bened...@apache.org>
Authored: Tue Sep 8 13:45:18 2015 +0100
Committer: Benedict Elliott Smith <bened...@apache.org>
Committed: Tue Sep 8 13:45:18 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  3 ++
 .../db/compaction/CompactionManager.java        | 42 ++++++--------------
 .../org/apache/cassandra/utils/FBUtilities.java | 19 +++++++--
 .../org/apache/cassandra/utils/Throwables.java  | 16 ++++++++
 4 files changed, 47 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/99d5c396/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index b7c6669,fdba8ed..a1c66a2
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,31 -1,6 +1,34 @@@
 -<<<<<<< HEAD
 -2.2.2
 - * Handle missing RoleManager in config after upgrade to 2.2 
(CASSANDRA-10209) 
 +3.0.0-rc1
 + * Small optimizations of sstable index serialization (CASSANDRA-10232)
 + * Support for both encrypted and unencrypted native transport connections 
(CASSANDRA-9590)
 +Merged from 2.2:
 + * Handle missing RoleManager in config after upgrade to 2.2 (CASSANDRA-10209)
++Merged from 2.1:
++ * Scrub, Cleanup and Upgrade do not unmark compacting until all operations
++   have completed, regardless of the occurence of exceptions (CASSANDRA-10274)
 +
 +
 +3.0.0-beta2
 + * Fix columns returned by AbstractBtreePartitions (CASSANDRA-10220)
 + * Fix backward compatibility issue due to AbstractBounds serialization bug 
(CASSANDRA-9857)
 + * Fix startup error when upgrading nodes (CASSANDRA-10136)
 + * Base table PRIMARY KEY can be assumed to be NOT NULL in MV creation 
(CASSANDRA-10147)
 + * Improve batchlog write patch (CASSANDRA-9673)
 + * Re-apply MaterializedView updates on commitlog replay (CASSANDRA-10164)
 + * Require AbstractType.isByteOrderComparable declaration in constructor 
(CASSANDRA-9901)
 + * Avoid digest mismatch on upgrade to 3.0 (CASSANDRA-9554)
 + * Fix Materialized View builder when adding multiple MVs (CASSANDRA-10156)
 + * Choose better poolingOptions for protocol v4 in cassandra-stress 
(CASSANDRA-10182)
 + * Fix LWW bug affecting Materialized Views (CASSANDRA-10197)
 + * Ensures frozen sets and maps are always sorted (CASSANDRA-10162)
 + * Don't deadlock when flushing CFS backed custom indexes (CASSANDRA-10181)
 + * Fix double flushing of secondary index tables (CASSANDRA-10180)
 + * Fix incorrect handling of range tombstones in thrift (CASSANDRA-10046)
 + * Only use batchlog when paired materialized view replica is remote 
(CASSANDRA-10061)
 + * Reuse TemporalRow when updating multiple MaterializedViews 
(CASSANDRA-10060)
 + * Validate gc_grace_seconds for batchlog writes and MVs (CASSANDRA-9917)
 + * Fix sstablerepairedset (CASSANDRA-10132)
 +Merged from 2.2:
   * Retry snapshot deletion after compaction and gc on Windows 
(CASSANDRA-10222)
   * Fix failure to start with space in directory path on Windows 
(CASSANDRA-10239)
   * Fix repair hang when snapshot failed (CASSANDRA-10057)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/99d5c396/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/99d5c396/src/java/org/apache/cassandra/utils/FBUtilities.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/utils/FBUtilities.java
index 4f7a97a,b41bdab..6d31d8c
--- a/src/java/org/apache/cassandra/utils/FBUtilities.java
+++ b/src/java/org/apache/cassandra/utils/FBUtilities.java
@@@ -330,15 -334,23 +330,28 @@@ public class FBUtilitie
          return System.currentTimeMillis() * 1000;
      }
  
 +    public static int nowInSeconds()
 +    {
 +        return (int) (System.currentTimeMillis() / 1000);
 +    }
 +
-     public static void waitOnFutures(Iterable<Future<?>> futures)
+     public static <T> List<T> waitOnFutures(Iterable<? extends Future<? 
extends T>> futures)
      {
-         for (Future f : futures)
-             waitOnFuture(f);
+         List<T> results = new ArrayList<>();
+         Throwable fail = null;
+         for (Future<? extends T> f : futures)
+         {
+             try
+             {
+                 results.add(f.get());
+             }
 -            catch (InterruptedException | ExecutionException e)
++            catch (Throwable t)
+             {
 -                fail = Throwables.merge(fail, e);
++                fail = Throwables.merge(fail, t);
+             }
+         }
+         Throwables.maybeFail(fail);
+         return results;
      }
  
      public static <T> T waitOnFuture(Future<T> future)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/99d5c396/src/java/org/apache/cassandra/utils/Throwables.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/utils/Throwables.java
index a5170ff,a895f31..8c5e3ec
--- a/src/java/org/apache/cassandra/utils/Throwables.java
+++ b/src/java/org/apache/cassandra/utils/Throwables.java
@@@ -46,99 -31,23 +46,115 @@@ public final class Throwable
  
      public static void maybeFail(Throwable fail)
      {
 -        if (fail != null)
 -            com.google.common.base.Throwables.propagate(fail);
 +        if (failIfCanCast(fail, null))
 +            throw new RuntimeException(fail);
 +    }
 +
 +    public static <T extends Throwable> void maybeFail(Throwable fail, 
Class<T> checked) throws T
 +    {
 +        if (failIfCanCast(fail, checked))
 +            throw new RuntimeException(fail);
 +    }
 +
 +    public static <T extends Throwable> boolean failIfCanCast(Throwable fail, 
Class<T> checked) throws T
 +    {
 +        if (fail == null)
 +            return false;
 +
 +        if (fail instanceof Error)
 +            throw (Error) fail;
 +
 +        if (fail instanceof RuntimeException)
 +            throw (RuntimeException) fail;
 +
 +        if (checked != null && checked.isInstance(fail))
 +            throw checked.cast(fail);
 +
 +        return true;
 +    }
 +
 +    @SafeVarargs
 +    public static <E extends Exception> void perform(DiscreteAction<? extends 
E> ... actions) throws E
 +    {
 +        perform(Arrays.stream(actions));
 +    }
 +
 +    @SuppressWarnings("unchecked")
 +    public static <E extends Exception> void perform(Stream<DiscreteAction<? 
extends E>> actions) throws E
 +    {
 +        Throwable fail = perform(null, actions);
 +        if (failIfCanCast(fail, null))
 +            throw (E) fail;
 +    }
 +
 +    public static Throwable perform(Throwable accumulate, Stream<? extends 
DiscreteAction<?>> actions)
 +    {
 +        return perform(accumulate, actions.iterator());
 +    }
 +
 +    public static Throwable perform(Throwable accumulate, Iterator<? extends 
DiscreteAction<?>> actions)
 +    {
 +        while (actions.hasNext())
 +        {
 +            DiscreteAction<?> action = actions.next();
 +            try
 +            {
 +                action.perform();
 +            }
 +            catch (Throwable t)
 +            {
 +                accumulate = merge(accumulate, t);
 +            }
 +        }
 +        return accumulate;
 +    }
 +
 +    @SafeVarargs
 +    public static void perform(File against, FileOpType opType, 
DiscreteAction<? extends IOException> ... actions)
 +    {
 +        perform(against.getPath(), opType, actions);
 +    }
 +
 +    @SafeVarargs
 +    public static void perform(String filePath, FileOpType opType, 
DiscreteAction<? extends IOException> ... actions)
 +    {
 +        maybeFail(perform(null, filePath, opType, actions));
 +    }
 +
 +    @SafeVarargs
 +    public static Throwable perform(Throwable accumulate, String filePath, 
FileOpType opType, DiscreteAction<? extends IOException> ... actions)
 +    {
 +        return perform(accumulate, filePath, opType, Arrays.stream(actions));
 +    }
 +
 +    public static Throwable perform(Throwable accumulate, String filePath, 
FileOpType opType, Stream<DiscreteAction<? extends IOException>> actions)
 +    {
 +        return perform(accumulate, actions.map((action) -> () ->
 +        {
 +            try
 +            {
 +                action.perform();
 +            }
 +            catch (IOException e)
 +            {
 +                throw (opType == FileOpType.WRITE) ? new FSWriteError(e, 
filePath) : new FSReadError(e, filePath);
 +            }
 +        }));
      }
+ 
+     public static Throwable close(Throwable accumulate, Iterable<? extends 
AutoCloseable> closeables)
+     {
+         for (AutoCloseable closeable : closeables)
+         {
+             try
+             {
+                 closeable.close();
+             }
+             catch (Throwable t)
+             {
+                 accumulate = merge(accumulate, t);
+             }
+         }
+         return accumulate;
+     }
  }

Reply via email to