Codota Logo
DiskBoundaries
Code IndexAdd Codota to your IDE (free)

How to use
DiskBoundaries
in
org.apache.cassandra.db

Best Java code snippets using org.apache.cassandra.db.DiskBoundaries (Showing top 20 results out of 315)

  • Common ways to obtain DiskBoundaries
private void myMethod () {
DiskBoundaries d =
  • Codota IconColumnFamilyStore cfs;cfs.getDiskBoundaries()
  • Codota IconColumnFamilyStore columnFamilyStore;new DiskBoundaries(columnFamilyStore.getDirectories().getWriteableLocations(), BlacklistedDirectories.getDirectoriesVersion())
  • Codota IconDiskBoundaryManager diskBoundaryManager;ColumnFamilyStore columnFamilyStore;diskBoundaryManager.getDiskBoundaries(columnFamilyStore)
  • Smart code suggestions by Codota
}
origin: jsevellec/cassandra-unit

public int getDiskIndex(SSTableReader sstable)
{
  if (positions == null)
  {
    return getBoundariesFromSSTableDirectory(sstable);
  }
  int pos = Collections.binarySearch(positions, sstable.first);
  assert pos < 0; // boundaries are .minkeybound and .maxkeybound so they should never be equal
  return -pos - 1;
}
origin: org.apache.cassandra/cassandra-all

  public Directories.DataDirectory getCorrectDiskForSSTable(SSTableReader sstable)
  {
    return directories.get(getDiskIndex(sstable));
  }
}
origin: org.apache.cassandra/cassandra-all

public void invalidate()
{
  if (diskBoundaries != null)
    diskBoundaries.invalidate();
}
origin: org.apache.cassandra/cassandra-all

public DiskBoundaries getDiskBoundaries(ColumnFamilyStore cfs)
{
  if (!cfs.getPartitioner().splitter().isPresent())
    return new DiskBoundaries(cfs.getDirectories().getWriteableLocations(), BlacklistedDirectories.getDirectoriesVersion());
  if (diskBoundaries == null || diskBoundaries.isOutOfDate())
  {
    synchronized (this)
    {
      if (diskBoundaries == null || diskBoundaries.isOutOfDate())
      {
        logger.debug("Refreshing disk boundary cache for {}.{}", cfs.keyspace.getName(), cfs.getTableName());
        DiskBoundaries oldBoundaries = diskBoundaries;
        diskBoundaries = getDiskBoundaryValue(cfs);
        logger.debug("Updating boundaries from {} to {} for {}.{}", oldBoundaries, diskBoundaries, cfs.keyspace.getName(), cfs.getTableName());
      }
    }
  }
  return diskBoundaries;
}
origin: org.apache.cassandra/cassandra-all

/**
 * Checks if the disk boundaries changed and reloads the compaction strategies
 * to reflect the most up-to-date disk boundaries.
 *
 * This is typically called before acquiring the {@link this#readLock} to ensure the most up-to-date
 * disk locations and boundaries are used.
 *
 * This should *never* be called inside by a thread holding the {@link this#readLock}, since it
 * will potentially acquire the {@link this#writeLock} to update the compaction strategies
 * what can cause a deadlock.
 */
//TODO improve this to reload after receiving a notification rather than trying to reload on every operation
@VisibleForTesting
protected boolean maybeReloadDiskBoundaries()
{
  if (!currentBoundaries.isOutOfDate())
    return false;
  writeLock.lock();
  try
  {
    if (!currentBoundaries.isOutOfDate())
      return false;
    reload(params);
    return true;
  }
  finally
  {
    writeLock.unlock();
  }
}
origin: org.apache.cassandra/cassandra-all

  return new DiskBoundaries(dirs, null, ringVersion, directoriesVersion);
return new DiskBoundaries(dirs, positions, ringVersion, directoriesVersion);
origin: org.apache.cassandra/cassandra-all

this.destination = cfs.getDirectories().getLocationForDisk(cfs.getDiskBoundaries().getCorrectDiskForSSTable(sstable));
this.isCommutative = cfs.metadata.isCounter();
origin: jsevellec/cassandra-unit

public DiskBoundaries getDiskBoundaries(ColumnFamilyStore cfs)
{
  if (!cfs.getPartitioner().splitter().isPresent())
    return new DiskBoundaries(cfs.getDirectories().getWriteableLocations(), BlacklistedDirectories.getDirectoriesVersion());
  if (diskBoundaries == null || diskBoundaries.isOutOfDate())
  {
    synchronized (this)
    {
      if (diskBoundaries == null || diskBoundaries.isOutOfDate())
      {
        logger.debug("Refreshing disk boundary cache for {}.{}", cfs.keyspace.getName(), cfs.getTableName());
        DiskBoundaries oldBoundaries = diskBoundaries;
        diskBoundaries = getDiskBoundaryValue(cfs);
        logger.debug("Updating boundaries from {} to {} for {}.{}", oldBoundaries, diskBoundaries, cfs.keyspace.getName(), cfs.getTableName());
      }
    }
  }
  return diskBoundaries;
}
origin: jsevellec/cassandra-unit

/**
 * Checks if the disk boundaries changed and reloads the compaction strategies
 * to reflect the most up-to-date disk boundaries.
 *
 * This is typically called before acquiring the {@link this#readLock} to ensure the most up-to-date
 * disk locations and boundaries are used.
 *
 * This should *never* be called inside by a thread holding the {@link this#readLock}, since it
 * will potentially acquire the {@link this#writeLock} to update the compaction strategies
 * what can cause a deadlock.
 */
//TODO improve this to reload after receiving a notification rather than trying to reload on every operation
@VisibleForTesting
protected boolean maybeReloadDiskBoundaries()
{
  if (!currentBoundaries.isOutOfDate())
    return false;
  writeLock.lock();
  try
  {
    if (!currentBoundaries.isOutOfDate())
      return false;
    reload(params);
    return true;
  }
  finally
  {
    writeLock.unlock();
  }
}
origin: com.strapdata.cassandra/cassandra-all

  return new DiskBoundaries(dirs, null, ringVersion, directoriesVersion);
return new DiskBoundaries(dirs, positions, ringVersion, directoriesVersion);
origin: jsevellec/cassandra-unit

this.destination = cfs.getDirectories().getLocationForDisk(cfs.getDiskBoundaries().getCorrectDiskForSSTable(sstable));
this.isCommutative = cfs.metadata.isCounter();
origin: jsevellec/cassandra-unit

  public Directories.DataDirectory getCorrectDiskForSSTable(SSTableReader sstable)
  {
    return directories.get(getDiskIndex(sstable));
  }
}
origin: com.strapdata.cassandra/cassandra-all

public DiskBoundaries getDiskBoundaries(ColumnFamilyStore cfs)
{
  if (!cfs.getPartitioner().splitter().isPresent())
    return new DiskBoundaries(cfs.getDirectories().getWriteableLocations(), BlacklistedDirectories.getDirectoriesVersion());
  if (diskBoundaries == null || diskBoundaries.isOutOfDate())
  {
    synchronized (this)
    {
      if (diskBoundaries == null || diskBoundaries.isOutOfDate())
      {
        logger.debug("Refreshing disk boundary cache for {}.{}", cfs.keyspace.getName(), cfs.getTableName());
        DiskBoundaries oldBoundaries = diskBoundaries;
        diskBoundaries = getDiskBoundaryValue(cfs);
        logger.debug("Updating boundaries from {} to {} for {}.{}", oldBoundaries, diskBoundaries, cfs.keyspace.getName(), cfs.getTableName());
      }
    }
  }
  return diskBoundaries;
}
origin: com.strapdata.cassandra/cassandra-all

/**
 * Checks if the disk boundaries changed and reloads the compaction strategies
 * to reflect the most up-to-date disk boundaries.
 *
 * This is typically called before acquiring the {@link this#readLock} to ensure the most up-to-date
 * disk locations and boundaries are used.
 *
 * This should *never* be called inside by a thread holding the {@link this#readLock}, since it
 * will potentially acquire the {@link this#writeLock} to update the compaction strategies
 * what can cause a deadlock.
 */
//TODO improve this to reload after receiving a notification rather than trying to reload on every operation
@VisibleForTesting
protected boolean maybeReloadDiskBoundaries()
{
  if (!currentBoundaries.isOutOfDate())
    return false;
  writeLock.lock();
  try
  {
    if (!currentBoundaries.isOutOfDate())
      return false;
    reload(params);
    return true;
  }
  finally
  {
    writeLock.unlock();
  }
}
origin: jsevellec/cassandra-unit

public void invalidate()
{
  if (diskBoundaries != null)
    diskBoundaries.invalidate();
}
origin: org.apache.cassandra/cassandra-all

public int getDiskIndex(SSTableReader sstable)
{
  if (positions == null)
  {
    return getBoundariesFromSSTableDirectory(sstable);
  }
  int pos = Collections.binarySearch(positions, sstable.first);
  assert pos < 0; // boundaries are .minkeybound and .maxkeybound so they should never be equal
  return -pos - 1;
}
origin: jsevellec/cassandra-unit

  return new DiskBoundaries(dirs, null, ringVersion, directoriesVersion);
return new DiskBoundaries(dirs, positions, ringVersion, directoriesVersion);
origin: com.strapdata.cassandra/cassandra-all

this.destination = cfs.getDirectories().getLocationForDisk(cfs.getDiskBoundaries().getCorrectDiskForSSTable(sstable));
this.isCommutative = cfs.metadata.isCounter();
origin: com.strapdata.cassandra/cassandra-all

  public Directories.DataDirectory getCorrectDiskForSSTable(SSTableReader sstable)
  {
    return directories.get(getDiskIndex(sstable));
  }
}
origin: org.apache.cassandra/cassandra-all

/**
 * Reload the compaction strategies
 *
 * Called after changing configuration and at startup.
 * @param newCompactionParams
 */
private void reload(CompactionParams newCompactionParams)
{
  boolean enabledWithJMX = enabled && !shouldBeEnabled();
  boolean disabledWithJMX = !enabled && shouldBeEnabled();
  if (currentBoundaries != null)
  {
    if (!newCompactionParams.equals(schemaCompactionParams))
      logger.debug("Recreating compaction strategy - compaction parameters changed for {}.{}", cfs.keyspace.getName(), cfs.getTableName());
    else if (currentBoundaries.isOutOfDate())
      logger.debug("Recreating compaction strategy - disk boundaries are out of date for {}.{}.", cfs.keyspace.getName(), cfs.getTableName());
  }
  if (currentBoundaries == null || currentBoundaries.isOutOfDate())
    currentBoundaries = boundariesSupplier.get();
  setStrategy(newCompactionParams);
  schemaCompactionParams = cfs.metadata.params.compaction;
  if (disabledWithJMX || !shouldBeEnabled() && !enabledWithJMX)
    disable();
  else
    enable();
  startup();
}
org.apache.cassandra.dbDiskBoundaries

Most used methods

  • <init>
  • getBoundariesFromSSTableDirectory
    Try to figure out location based on sstable directory
  • getCorrectDiskForSSTable
  • getDiskIndex
  • invalidate
  • isOutOfDate
    check if the given disk boundaries are out of date due not being set or to having too old diskVersio

Popular in Java

  • Updating database using SQL prepared statement
  • setScale (BigDecimal)
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now