Commits

Jonathan Ellis  committed c98edc3 Merge

merge from 1.0

  • Participants
  • Parent commits c598687, 9ca8478

Comments (0)

Files changed (5)

 
 
 1.0.8
+ * fix race between cleanup and flush on secondary index CFSes (CASSANDRA-3712)
  * avoid including non-queried nodes in rangeslice read repair
    (CASSANDRA-3843)
  * Only snapshot CF being compacted for snapshot_before_compaction 

File src/java/org/apache/cassandra/db/Table.java

      *
      * (Enabling fairness in the RRWL is observed to decrease throughput, so we leave it off.)
      */
-    static final ReentrantReadWriteLock switchLock = new ReentrantReadWriteLock();
+    public static final ReentrantReadWriteLock switchLock = new ReentrantReadWriteLock();
 
     // It is possible to call Table.open without a running daemon, so it makes sense to ensure
     // proper directories here as well as in CassandraDaemon.

File src/java/org/apache/cassandra/db/compaction/CompactionManager.java

                     }
                     else
                     {
-                                              
                         cfs.invalidateCachedRow(row.getKey());
-                                                
+
                         if (!indexedColumns.isEmpty() || isCommutative)
                         {
                             if (indexedColumnsInRow != null)
                                 indexedColumnsInRow.clear();
-                            
+
                             while (row.hasNext())
                             {
                                 IColumn column = row.next();
                                 {
                                     if (indexedColumnsInRow == null)
                                         indexedColumnsInRow = new ArrayList<IColumn>();
-                                    
+
                                     indexedColumnsInRow.add(column);
                                 }
                             }
-                            
+
                             if (indexedColumnsInRow != null && !indexedColumnsInRow.isEmpty())
-                                cfs.indexManager.deleteFromIndexes(row.getKey(), indexedColumnsInRow);
+                            {
+                                // acquire memtable lock here because secondary index deletion may cause a race. See CASSANDRA-3712
+                                Table.switchLock.readLock().lock();
+                                try
+                                {
+                                    cfs.indexManager.deleteFromIndexes(row.getKey(), indexedColumnsInRow);
+                                }
+                                finally
+                                {
+                                    Table.switchLock.readLock().unlock();
+                                }
+                            }
                         }
                     }
                 }
             {
                 scanner.close();
                 executor.finishCompaction(ci);
-                executor.finishCompaction(ci);
             }
 
             List<SSTableReader> results = new ArrayList<SSTableReader>();
 
             // flush to ensure we don't lose the tombstones on a restart, since they are not commitlog'd         
             cfs.indexManager.flushIndexesBlocking();
-           
 
             cfs.replaceCompactedSSTables(Arrays.asList(sstable), results);
         }
                 holder.stop();
         }
     }
-}
+}

File src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java

         if (o == null)
             return (ByteBuffer)o;
         if (o instanceof java.lang.String)
-            return new ByteBuffer.wrap(DataByteArray((String)o).get());
+            return ByteBuffer.wrap(new DataByteArray((String)o).get());
         if (o instanceof Integer)
-            return IntegerType.instance.decompose((BigInteger)o);
+            return Int32Type.instance.decompose((Integer)o);
         if (o instanceof Long)
             return LongType.instance.decompose((Long)o);
         if (o instanceof Float)
             return DoubleType.instance.decompose((Double)o);
         if (o instanceof UUID)
             return ByteBuffer.wrap(UUIDGen.decompose((UUID) o));
-        return null;
+        return ByteBuffer.wrap(((DataByteArray) o).get());
     }
 
     public void putNext(Tuple t) throws ExecException, IOException

File src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java

                 {
                     select();
                 }
+                try
+                {
+                    selector.close(); // CASSANDRA-3867
+                }
+                catch (IOException e)
+                {
+                    // ignore this exception.
+                }
             } 
             catch (Throwable t)
             {