Class AbstractAllocatorMemtable

    • Method Detail

      • shouldSwitch

        public boolean shouldSwitch​(ColumnFamilyStore.FlushReason reason)
        Description copied from interface: Memtable
        Decides whether the memtable should be switched/flushed for the passed reason. Normally this will return true, but e.g. persistent memtables may choose not to flush. Returning false will trigger further action for some reasons: - SCHEMA_CHANGE will be followed by metadataUpdated(). - OWNED_RANGES_CHANGE will be followed by localRangesUpdated(). - SNAPSHOT will be followed by performSnapshot(). - STREAMING/REPAIR will be followed by creating a FlushSet for the streamed/repaired ranges. This data will be used to create sstables, which will be streamed and then deleted. This will not be called to perform truncation or drop (in that case the memtable is unconditionally dropped), but a flush may nevertheless be requested in that case to prepare a snapshot.
      • performSnapshot

        public void performSnapshot​(java.lang.String snapshotName)
        Description copied from interface: Memtable
        If the memtable needs to do some special action for snapshots (e.g. because it is persistent and does not want to flush), it should return false on the above with reason SNAPSHOT and implement this method.
      • discard

        public void discard()
        Description copied from interface: Memtable
        This memtable is no longer in use or required for outstanding flushes or operations. All held memory must be released.
        Specified by:
        discard in interface Memtable
        Overrides:
        discard in class AbstractMemtableWithCommitlog
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • addMemoryUsageTo

        public void addMemoryUsageTo​(Memtable.MemoryUsage stats)
        Description copied from interface: Memtable
        Add this memtable's used memory to the given usage object. This can be used to retrieve a single memtable's usage as well as to combine the ones of related sstables (e.g. a table and its table-based secondary indexes).
      • markExtraOnHeapUsed

        public void markExtraOnHeapUsed​(long additionalSpace,
                                        OpOrder.Group opGroup)
        Description copied from interface: Memtable
        Adjust the used on-heap space by the given size (e.g. to reflect memory used by a non-table-based index). This operation may block until enough memory is available in the memory pool.
        Parameters:
        additionalSpace - the number of allocated bytes
        opGroup - write operation group, used to permit the operation to complete if it is needed to complete a flush to free space.
      • markExtraOffHeapUsed

        public void markExtraOffHeapUsed​(long additionalSpace,
                                         OpOrder.Group opGroup)
        Description copied from interface: Memtable
        Adjust the used off-heap space by the given size (e.g. to reflect memory used by a non-table-based index). This operation may block until enough memory is available in the memory pool.
        Parameters:
        additionalSpace - the number of allocated bytes
        opGroup - write operation group, used to permit the operation to complete if it is needed to complete a flush to free space.
      • flushLargestMemtable

        public static Future<java.lang.Boolean> flushLargestMemtable()
        Finds the largest memtable, as a percentage of *either* on- or off-heap memory limits, and immediately queues it for flushing. If the memtable selected is flushed before this completes, no work is done.