cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bened...@apache.org
Subject [4/6] cassandra git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Date Fri, 01 May 2015 10:34:13 GMT
Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
	CHANGES.txt
	src/java/org/apache/cassandra/db/Memtable.java


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

Branch: refs/heads/trunk
Commit: 4f9c9ce55fd9993d06bf6dc4d9193e973fb8515f
Parents: db127a1 f0c7a6f
Author: Benedict Elliott Smith <benedict@apache.org>
Authored: Fri May 1 11:33:40 2015 +0100
Committer: Benedict Elliott Smith <benedict@apache.org>
Committed: Fri May 1 11:33:40 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                    | 1 +
 src/java/org/apache/cassandra/db/Memtable.java | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/4f9c9ce5/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index c063368,dfdad51..59b1182
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,10 -1,5 +1,11 @@@
 -2.0.15:
 +2.1.6
 + * Fix PITR commitlog replay (CASSANDRA-9195)
 + * GCInspector logs very different times (CASSANDRA-9124)
 + * Fix deleting from an empty list (CASSANDRA-9198)
 + * Update tuple and collection types that use a user-defined type when that UDT
 +   is modified (CASSANDRA-9148, CASSANDRA-9192)
 +Merged from 2.0:
+  * Fix partition-level-delete-only workload accounting (CASSANDRA-9194)
   * Allow scrub to handle corrupted compressed chunks (CASSANDRA-9140)
   * Fix assertion error when resetlocalschema is run during repair (CASSANDRA-9249)
   * Disable single sstable tombstone compactions for DTCS by default (CASSANDRA-9234)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/4f9c9ce5/src/java/org/apache/cassandra/db/Memtable.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/Memtable.java
index eb04bea,897d94e..9a8596a
--- a/src/java/org/apache/cassandra/db/Memtable.java
+++ b/src/java/org/apache/cassandra/db/Memtable.java
@@@ -151,62 -182,45 +151,64 @@@ public class Memtabl
          }
      }
  
 -    public void updateLiveRatio() throws RuntimeException
 +    public boolean isLive()
      {
 -        if (!MemoryMeter.isInitialized())
 -        {
 -            // hack for openjdk.  we log a warning about this in the startup script too.
 -            logger.error("MemoryMeter uninitialized (jamm not specified as java agent);
assuming liveRatio of {}.  "
 -                         + " Usually this means cassandra-env.sh disabled jamm because you
are using a buggy JRE; "
 -                         + " upgrade to the Sun JRE instead", liveRatio);
 -            return;
 -        }
 +        return allocator.isLive();
 +    }
  
 -        if (!meteringInProgress.add(cfs))
 -        {
 -            logger.debug("Metering already pending or active for {}; skipping liveRatio
update", cfs);
 -            return;
 -        }
 +    public boolean isClean()
 +    {
 +        return rows.isEmpty();
 +    }
  
 -        meterExecutor.submit(new MeteringRunnable(cfs));
 +    public boolean isCleanAfter(ReplayPosition position)
 +    {
 +        return isClean() || (position != null && minReplayPosition.compareTo(position)
>= 0);
      }
  
 -    private long resolve(DecoratedKey key, ColumnFamily cf, SecondaryIndexManager.Updater
indexer)
 +    /**
 +     * @return true if this memtable is expired. Expiration time is determined by CF's memtable_flush_period_in_ms.
 +     */
 +    public boolean isExpired()
 +    {
 +        int period = cfs.metadata.getMemtableFlushPeriod();
 +        return period > 0 && (System.nanoTime() - creationNano >= TimeUnit.MILLISECONDS.toNanos(period));
 +    }
 +
 +    /**
 +     * Should only be called by ColumnFamilyStore.apply via Keyspace.apply, which supplies
the appropriate
 +     * OpOrdering.
 +     *
 +     * replayPosition should only be null if this is a secondary index, in which case it
is *expected* to be null
 +     */
 +    long put(DecoratedKey key, ColumnFamily cf, SecondaryIndexManager.Updater indexer, OpOrder.Group
opGroup)
      {
 -        AtomicSortedColumns previous = rows.get(key);
 +        AtomicBTreeColumns previous = rows.get(key);
  
+         long initialSize = 0;
          if (previous == null)
          {
 -            AtomicSortedColumns empty = cf.cloneMeShallow(AtomicSortedColumns.factory, false);
 +            AtomicBTreeColumns empty = cf.cloneMeShallow(AtomicBTreeColumns.factory, false);
 +            final DecoratedKey cloneKey = allocator.clone(key, opGroup);
              // We'll add the columns later. This avoids wasting works if we get beaten in
the putIfAbsent
 -            previous = rows.putIfAbsent(new DecoratedKey(key.token, allocator.clone(key.key)),
empty);
 +            previous = rows.putIfAbsent(cloneKey, empty);
              if (previous == null)
              {
                  previous = empty;
 -                initialSize += 1;
 +                // allocate the row overhead after the fact; this saves over allocating
and having to free after, but
 +                // means we can overshoot our declared limit.
 +                int overhead = (int) (cfs.partitioner.getHeapSizeOf(key.getToken()) + ROW_OVERHEAD_HEAP_SIZE);
 +                allocator.onHeap().allocate(overhead, opGroup);
++                initialSize = 8;
 +            }
 +            else
 +            {
 +                allocator.reclaimer().reclaimImmediately(cloneKey);
              }
          }
  
 -        final Pair<Long, Long> pair = previous.addAllWithSizeDelta(cf, allocator,
localCopyFunction, indexer);
 -        currentSize.addAndGet(initialSize + pair.left);
 +        final Pair<Long, Long> pair = previous.addAllWithSizeDelta(cf, allocator,
opGroup, indexer);
-         liveDataSize.addAndGet(pair.left);
++        liveDataSize.addAndGet(initialSize + pair.left);
          currentOperations.addAndGet(cf.getColumnCount() + (cf.isMarkedForDelete() ? 1 :
0) + cf.deletionInfo().rangeCount());
          return pair.right;
      }


Mime
View raw message