You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2012/02/27 11:16:00 UTC
[3/28] [3649] Strip end of line whitespace
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
index f51be46..996dcf8 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
@@ -37,32 +37,32 @@ import org.slf4j.LoggerFactory;
/**
* Abstract base class for different types of secondary indexes.
- *
+ *
* Do not extend this directly, please pick from PerColumnSecondaryIndex or PerRowSecondaryIndex
*/
public abstract class SecondaryIndex
{
-
+
private static final Logger logger = LoggerFactory.getLogger(SecondaryIndex.class);
-
+
public static final String CUSTOM_INDEX_OPTION_NAME = "class_name";
/**
* Base CF that has many indexes
*/
protected ColumnFamilyStore baseCfs;
-
-
+
+
/**
* The column definitions which this index is responsible for
*/
protected final Set<ColumnDefinition> columnDefs = Collections.newSetFromMap(new ConcurrentHashMap<ColumnDefinition,Boolean>());
-
+
/**
* Perform any initialization work
*/
public abstract void init();
-
+
/**
* Validates the index_options passed in the ColumnDef
* @throws ConfigurationException
@@ -73,20 +73,20 @@ public abstract class SecondaryIndex
* @return The name of the index
*/
abstract public String getIndexName();
-
-
+
+
/**
* Return the unique name for this index and column
* to be stored in the SystemTable that tracks if each column is built
- *
+ *
* @param columnName the name of the column
* @return the unique name
*/
abstract public String getNameForSystemTable(ByteBuffer columnName);
-
+
/**
* Checks if the index for specified column is fully built
- *
+ *
* @param columnName the column
* @return true if the index is fully built
*/
@@ -94,7 +94,7 @@ public abstract class SecondaryIndex
{
return SystemTable.isIndexBuilt(baseCfs.table.name, getNameForSystemTable(columnName));
}
-
+
public void setIndexBuilt(ByteBuffer columnName)
{
SystemTable.setIndexBuilt(baseCfs.table.name, getNameForSystemTable(columnName));
@@ -104,7 +104,7 @@ public abstract class SecondaryIndex
{
SystemTable.setIndexRemoved(baseCfs.table.name, getNameForSystemTable(columnName));
}
-
+
/**
* Called at query time
* Creates a implementation specific searcher instance for this index type
@@ -112,7 +112,7 @@ public abstract class SecondaryIndex
* @return the secondary index search impl
*/
protected abstract SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns);
-
+
/**
* Forces this indexes in memory data to disk
* @throws IOException
@@ -123,14 +123,14 @@ public abstract class SecondaryIndex
* Get current amount of memory this index is consuming (in bytes)
*/
public abstract long getLiveSize();
-
+
/**
* Allow access to the underlying column family store if there is one
* @return the underlying column family store or null
*/
public abstract ColumnFamilyStore getIndexCfs();
-
-
+
+
/**
* Delete all files and references to this index
* @param columnName the indexed column to remove
@@ -148,7 +148,7 @@ public abstract class SecondaryIndex
* @param truncatedAt The truncation timestamp, all data before that timestamp should be rejected.
*/
public abstract void truncate(long truncatedAt);
-
+
/**
* Builds the index using the data in the underlying CFS
* Blocks till it's complete
@@ -159,7 +159,7 @@ public abstract class SecondaryIndex
getIndexName(), StringUtils.join(baseCfs.getSSTables(), ", ")));
SortedSet<ByteBuffer> columnNames = new TreeSet<ByteBuffer>();
-
+
for (ColumnDefinition cdef : columnDefs)
columnNames.add(cdef.name);
@@ -172,7 +172,7 @@ public abstract class SecondaryIndex
{
future.get();
forceBlockingFlush();
-
+
// Mark all indexed columns as built
if (this instanceof PerRowSecondaryIndex)
{
@@ -199,11 +199,11 @@ public abstract class SecondaryIndex
logger.info("Index build of " + getIndexName() + " complete");
}
-
+
/**
* Builds the index using the data in the underlying CF, non blocking
- *
- *
+ *
+ *
* @return A future object which the caller can block on (optional)
*/
public Future<?> buildIndexAsync()
@@ -218,10 +218,10 @@ public abstract class SecondaryIndex
break;
}
}
-
+
if (allAreBuilt)
return null;
-
+
// build it asynchronously; addIndex gets called by CFS open and schema update, neither of which
// we want to block for a long period. (actual build is serialized on CompactionManager.)
Runnable runnable = new Runnable()
@@ -240,11 +240,11 @@ public abstract class SecondaryIndex
{
throw new AssertionError(e);
}
-
+
try
{
buildIndexBlocking();
- }
+ }
catch (IOException e)
{
throw new RuntimeException(e);
@@ -252,11 +252,11 @@ public abstract class SecondaryIndex
}
};
FutureTask<?> f = new FutureTask<Object>(runnable, null);
-
+
new Thread(f, "Creating index: " + getIndexName()).start();
return f;
}
-
+
public ColumnFamilyStore getBaseCfs()
{
return baseCfs;
@@ -276,7 +276,7 @@ public abstract class SecondaryIndex
{
columnDefs.add(columnDef);
}
-
+
void removeColumnDef(ByteBuffer name)
{
Iterator<ColumnDefinition> it = columnDefs.iterator();
@@ -286,11 +286,11 @@ public abstract class SecondaryIndex
it.remove();
}
}
-
+
/**
* This is the primary way to create a secondary index instance for a CF column.
* It will validate the index_options before initializing.
- *
+ *
* @param baseCfs the source of data for the Index
* @param cdef the meta information about this column (index_type, index_options, name, etc...)
*
@@ -300,33 +300,33 @@ public abstract class SecondaryIndex
public static SecondaryIndex createInstance(ColumnFamilyStore baseCfs, ColumnDefinition cdef) throws ConfigurationException
{
SecondaryIndex index;
-
+
switch (cdef.getIndexType())
{
- case KEYS:
+ case KEYS:
index = new KeysIndex();
break;
- case CUSTOM:
+ case CUSTOM:
assert cdef.getIndexOptions() != null;
String class_name = cdef.getIndexOptions().get(CUSTOM_INDEX_OPTION_NAME);
assert class_name != null;
try
{
index = (SecondaryIndex) Class.forName(class_name).newInstance();
- }
+ }
catch (Exception e)
{
throw new RuntimeException(e);
- }
+ }
break;
default:
throw new RuntimeException("Unknown index type: " + cdef.getIndexName());
}
-
+
index.addColumnDef(cdef);
index.validateOptions();
index.setBaseCfs(baseCfs);
-
+
return index;
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/index/SecondaryIndexBuilder.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndexBuilder.java b/src/java/org/apache/cassandra/db/index/SecondaryIndexBuilder.java
index a90d101..1408ff1 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndexBuilder.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexBuilder.java
@@ -37,7 +37,7 @@ public class SecondaryIndexBuilder extends CompactionInfo.Holder
private final ColumnFamilyStore cfs;
private final SortedSet<ByteBuffer> columns;
private final ReducingKeyIterator iter;
-
+
public SecondaryIndexBuilder(ColumnFamilyStore cfs, SortedSet<ByteBuffer> columns, ReducingKeyIterator iter)
{
this.cfs = cfs;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
index 257e626..4f345fe 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
@@ -49,16 +49,16 @@ public class SecondaryIndexManager
* Organizes the indexes by column name
*/
private final ConcurrentNavigableMap<ByteBuffer, SecondaryIndex> indexesByColumn;
-
-
+
+
/**
* Keeps a single instance of a SecondaryIndex for many columns when the index type
* has isRowLevelIndex() == true
- *
+ *
* This allows updates to happen to an entire row at once
*/
private final Map<Class<? extends SecondaryIndex>,SecondaryIndex> rowLevelIndexMap;
-
+
/**
* The underlying column family containing the source data for these indexes
@@ -69,13 +69,13 @@ public class SecondaryIndexManager
{
indexesByColumn = new ConcurrentSkipListMap<ByteBuffer, SecondaryIndex>();
rowLevelIndexMap = new HashMap<Class<? extends SecondaryIndex>, SecondaryIndex>();
-
+
this.baseCfs = baseCfs;
}
/**
* Drops and adds new indexes associated with the underlying CF
- * @throws IOException
+ * @throws IOException
*/
public void reload() throws IOException
{
@@ -100,8 +100,8 @@ public class SecondaryIndexManager
cfs.reload();
}
}
-
-
+
+
/**
* Does a full, blocking rebuild of the indexes specified by columns from the sstables.
* Does nothing if columns is empty.
@@ -110,7 +110,7 @@ public class SecondaryIndexManager
*
* @param sstables the data to build from
* @param columns the list of columns to index, ordered by comparator
- * @throws IOException
+ * @throws IOException
*/
public void maybeBuildSecondaryIndexes(Collection<SSTableReader> sstables, SortedSet<ByteBuffer> columns) throws IOException
{
@@ -170,15 +170,15 @@ public class SecondaryIndexManager
/**
* Removes a existing index
* @param column the indexed column to remove
- * @throws IOException
+ * @throws IOException
*/
public void removeIndexedColumn(ByteBuffer column) throws IOException
{
SecondaryIndex index = indexesByColumn.remove(column);
-
+
if (index == null)
return;
-
+
// Remove this column from from row level index map
if (index instanceof PerRowSecondaryIndex)
{
@@ -200,13 +200,13 @@ public class SecondaryIndexManager
*/
public synchronized Future<?> addIndexedColumn(ColumnDefinition cdef)
{
-
+
if (indexesByColumn.containsKey(cdef.name))
return null;
-
+
assert cdef.getIndexType() != null;
logger.info("Creating new index : {}",cdef);
-
+
SecondaryIndex index;
try
{
@@ -214,14 +214,14 @@ public class SecondaryIndexManager
} catch (ConfigurationException e)
{
throw new RuntimeException(e);
- }
-
+ }
+
// Keep a single instance of the index per-cf for row level indexes
// since we want all columns to be under the index
if (index instanceof PerRowSecondaryIndex)
{
SecondaryIndex currentIndex = rowLevelIndexMap.get(index.getClass());
-
+
if (currentIndex == null)
{
rowLevelIndexMap.put(index.getClass(), index);
@@ -231,20 +231,20 @@ public class SecondaryIndexManager
{
index = currentIndex;
index.addColumnDef(cdef);
- }
+ }
}
else
{
index.init();
}
-
+
// link in indexedColumns. this means that writes will add new data to
// the index immediately,
// so we don't have to lock everything while we do the build. it's up to
// the operator to wait
// until the index is actually built before using in queries.
indexesByColumn.put(cdef.name, index);
-
+
// if we're just linking in the index to indexedColumns on an
// already-built index post-restart, we're done
if (index.isIndexBuilt(cdef.name))
@@ -254,7 +254,7 @@ public class SecondaryIndexManager
}
/**
- *
+ *
* @param column the name of indexes column
* @return the index
*/
@@ -282,7 +282,7 @@ public class SecondaryIndexManager
for (Map.Entry<ByteBuffer, SecondaryIndex> entry : indexesByColumn.entrySet())
entry.getValue().forceBlockingFlush();
}
-
+
/**
* Returns the decoratedKey for a column value
* @param name column name
@@ -293,38 +293,38 @@ public class SecondaryIndexManager
{
return new DecoratedKey<LocalToken>(new LocalToken(baseCfs.metadata.getColumnDefinition(name).getValidator(), value), value);
}
-
-
+
+
/**
* @return all built indexes (ready to use)
*/
public List<String> getBuiltIndexes()
{
List<String> indexList = new ArrayList<String>();
-
+
for (Map.Entry<ByteBuffer, SecondaryIndex> entry : indexesByColumn.entrySet())
{
SecondaryIndex index = entry.getValue();
-
- if (index.isIndexBuilt(entry.getKey()))
+
+ if (index.isIndexBuilt(entry.getKey()))
{
indexList.add(entry.getValue().getIndexName());
}
}
-
+
return indexList;
}
-
+
public ByteBuffer getColumnByIdxName(String idxName)
- {
+ {
for (Map.Entry<ByteBuffer, SecondaryIndex> entry : indexesByColumn.entrySet())
{
- if (entry.getValue().getIndexName().equals(idxName))
+ if (entry.getValue().getIndexName().equals(idxName))
return entry.getKey();
}
throw new RuntimeException("Unknown Index Name: " + idxName);
}
-
+
/**
* @return all CFS from indexes which use a backing CFS internally (KEYS)
*/
@@ -335,14 +335,14 @@ public class SecondaryIndexManager
for (Map.Entry<ByteBuffer, SecondaryIndex> entry : indexesByColumn.entrySet())
{
ColumnFamilyStore cfs = entry.getValue().getIndexCfs();
-
+
if (cfs != null)
- cfsList.add(cfs);
+ cfsList.add(cfs);
}
-
+
return cfsList;
}
-
+
/**
* @return all indexes which do *not* use a backing CFS internally
*/
@@ -355,11 +355,11 @@ public class SecondaryIndexManager
for (Map.Entry<ByteBuffer, SecondaryIndex> entry : indexesByColumn.entrySet())
{
ColumnFamilyStore cfs = entry.getValue().getIndexCfs();
-
+
if (cfs == null)
- indexList.put(entry.getValue(), null);
+ indexList.put(entry.getValue(), null);
}
-
+
return indexList.keySet();
}
@@ -383,7 +383,7 @@ public class SecondaryIndexManager
public long getTotalLiveSize()
{
long total = 0;
-
+
// we use identity map because per row indexes use same instance
// across many columns
IdentityHashMap<SecondaryIndex, Object> indexList = new IdentityHashMap<SecondaryIndex, Object>();
@@ -391,65 +391,65 @@ public class SecondaryIndexManager
for (Map.Entry<ByteBuffer, SecondaryIndex> entry : indexesByColumn.entrySet())
{
SecondaryIndex index = entry.getValue();
-
+
if (indexList.put(index, index) == null)
total += index.getLiveSize();
}
-
+
return total;
}
-
+
/**
* Removes obsolete index entries and creates new ones for the given row key
* and mutated columns.
- *
+ *
* For columns whos underlying index type has the isRowLevelIndex() flag set to true this function will
- * call the
- *
+ * call the
+ *
* @param rowKey the row key
* @param cf the current rows data
* @param mutatedIndexedColumns the set of columns that were changed or added
* @param oldIndexedColumns the columns what were deleted
- * @throws IOException
+ * @throws IOException
*/
public void applyIndexUpdates(ByteBuffer rowKey,
ColumnFamily cf,
SortedSet<ByteBuffer> mutatedIndexedColumns,
ColumnFamily oldIndexedColumns) throws IOException
{
-
+
// Identify the columns with PerRowSecondaryIndexes
// we need to make sure this is only called once
- Set<Class<? extends SecondaryIndex>> appliedRowLevelIndexes = null;
-
+ Set<Class<? extends SecondaryIndex>> appliedRowLevelIndexes = null;
+
// remove the old index entries
if (oldIndexedColumns != null)
{
for (ByteBuffer columnName : oldIndexedColumns.getColumnNames())
{
-
+
IColumn column = oldIndexedColumns.getColumn(columnName);
-
+
if (column == null)
continue;
-
+
//this was previously deleted so should not be in index
if (column.isMarkedForDelete())
- continue;
-
+ continue;
+
SecondaryIndex index = getIndexForColumn(columnName);
if (index == null)
{
logger.debug("Looks like index got dropped mid-update. Skipping");
continue;
}
-
+
// Update entire row if we encounter a row level index
if (index instanceof PerRowSecondaryIndex)
{
if (appliedRowLevelIndexes == null)
appliedRowLevelIndexes = new HashSet<Class<? extends SecondaryIndex>>();
-
+
if (appliedRowLevelIndexes.add(index.getClass()))
((PerRowSecondaryIndex)index).applyIndexUpdates(rowKey, cf, mutatedIndexedColumns, oldIndexedColumns);
}
@@ -461,7 +461,7 @@ public class SecondaryIndexManager
}
}
}
-
+
//insert new columns
for (ByteBuffer columnName : mutatedIndexedColumns)
{
@@ -481,19 +481,19 @@ public class SecondaryIndexManager
{
if (appliedRowLevelIndexes == null)
appliedRowLevelIndexes = new HashSet<Class<? extends SecondaryIndex>>();
-
+
if (appliedRowLevelIndexes.add(index.getClass()))
((PerRowSecondaryIndex)index).applyIndexUpdates(rowKey, cf, mutatedIndexedColumns, oldIndexedColumns);
}
else
{
DecoratedKey<LocalToken> valueKey = getIndexKeyFor(columnName, column.value());
-
- ((PerColumnSecondaryIndex)index).insertColumn(valueKey, rowKey, column);
+
+ ((PerColumnSecondaryIndex)index).insertColumn(valueKey, rowKey, column);
}
}
}
-
+
/**
* Delete all columns from all indexes for this row
* @param key the row key
@@ -501,36 +501,36 @@ public class SecondaryIndexManager
*/
public void deleteFromIndexes(DecoratedKey<?> key, List<IColumn> indexedColumnsInRow) throws IOException
{
-
- // Identify the columns with isRowLevelIndex == true
+
+ // Identify the columns with isRowLevelIndex == true
// we need to make sure this is only called once
- Set<Class<? extends SecondaryIndex>> cleanedRowLevelIndexes = null;
-
+ Set<Class<? extends SecondaryIndex>> cleanedRowLevelIndexes = null;
+
for (IColumn column : indexedColumnsInRow)
{
SecondaryIndex index = indexesByColumn.get(column.name());
-
+
if (index == null)
continue;
-
+
//Update entire row if we encounter a row level index
if (index instanceof PerRowSecondaryIndex)
{
if (cleanedRowLevelIndexes == null)
cleanedRowLevelIndexes = new HashSet<Class<? extends SecondaryIndex>>();
-
+
if (cleanedRowLevelIndexes.add(index.getClass()))
- ((PerRowSecondaryIndex)index).deleteFromIndex(key, indexedColumnsInRow);
+ ((PerRowSecondaryIndex)index).deleteFromIndex(key, indexedColumnsInRow);
}
else
{
DecoratedKey<LocalToken> valueKey = getIndexKeyFor(column.name(), column.value());
((PerColumnSecondaryIndex) index).deleteColumn(valueKey, key.key, column);
}
- }
+ }
}
-
-
+
+
/**
* Get a list of IndexSearchers from the union of expression index types
* @param clause the query clause
@@ -539,27 +539,27 @@ public class SecondaryIndexManager
private List<SecondaryIndexSearcher> getIndexSearchersForQuery(List<IndexExpression> clause)
{
Map<String, Set<ByteBuffer>> groupByIndexType = new HashMap<String, Set<ByteBuffer>>();
-
-
+
+
//Group columns by type
for (IndexExpression ix : clause)
{
SecondaryIndex index = getIndexForColumn(ix.column_name);
-
+
if (index == null)
continue;
-
+
Set<ByteBuffer> columns = groupByIndexType.get(index.getClass().getCanonicalName());
-
+
if (columns == null)
{
columns = new HashSet<ByteBuffer>();
groupByIndexType.put(index.getClass().getCanonicalName(), columns);
}
-
- columns.add(ix.column_name);
+
+ columns.add(ix.column_name);
}
-
+
List<SecondaryIndexSearcher> indexSearchers = new ArrayList<SecondaryIndexSearcher>(groupByIndexType.size());
//create searcher per type
@@ -567,14 +567,14 @@ public class SecondaryIndexManager
{
indexSearchers.add( getIndexForColumn(entry.getValue().iterator().next()).createSecondaryIndexSearcher(entry.getValue()) );
}
-
+
return indexSearchers;
}
-
+
/**
* Performs a search across a number of column indexes
* TODO: add support for querying across index types
- *
+ *
* @param clause the index query clause
* @param range the row range to restrict to
* @param dataFilter the column range to restrict to
@@ -583,15 +583,15 @@ public class SecondaryIndexManager
public List<Row> search(List<IndexExpression> clause, AbstractBounds<RowPosition> range, int maxResults, IFilter dataFilter, boolean maxIsColumns)
{
List<SecondaryIndexSearcher> indexSearchers = getIndexSearchersForQuery(clause);
-
+
if (indexSearchers.isEmpty())
return Collections.emptyList();
-
+
//We currently don't support searching across multiple index types
if (indexSearchers.size() > 1)
throw new RuntimeException("Unable to search across multiple secondary index types");
-
-
+
+
return indexSearchers.get(0).search(clause, range, maxResults, dataFilter, maxIsColumns);
}
@@ -600,7 +600,7 @@ public class SecondaryIndexManager
for (ByteBuffer colName : indexes)
indexesByColumn.get(colName).setIndexBuilt(colName);
}
-
+
public void setIndexRemoved(Collection<ByteBuffer> indexes)
{
for (ByteBuffer colName : indexes)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java b/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java
index f7f3a54..bbd1c83 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java
@@ -30,7 +30,7 @@ public abstract class SecondaryIndexSearcher
protected final SecondaryIndexManager indexManager;
protected final Set<ByteBuffer> columns;
protected final ColumnFamilyStore baseCfs;
-
+
public SecondaryIndexSearcher(SecondaryIndexManager indexManager, Set<ByteBuffer> columns)
{
this.indexManager = indexManager;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/index/keys/KeysIndex.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/keys/KeysIndex.java b/src/java/org/apache/cassandra/db/index/keys/KeysIndex.java
index 8d7b8e8..bac84d2 100644
--- a/src/java/org/apache/cassandra/db/index/keys/KeysIndex.java
+++ b/src/java/org/apache/cassandra/db/index/keys/KeysIndex.java
@@ -46,10 +46,10 @@ public class KeysIndex extends PerColumnSecondaryIndex
private static final Logger logger = LoggerFactory.getLogger(KeysIndex.class);
private ColumnFamilyStore indexCfs;
- public KeysIndex()
+ public KeysIndex()
{
}
-
+
public void init()
{
assert baseCfs != null && columnDefs != null;
@@ -74,7 +74,7 @@ public class KeysIndex extends PerColumnSecondaryIndex
{
if (column.isMarkedForDelete())
return;
-
+
int localDeletionTime = (int) (System.currentTimeMillis() / 1000);
ColumnFamily cfi = ColumnFamily.create(indexCfs.metadata);
cfi.addTombstone(rowKey, localDeletionTime, column.timestamp());
@@ -97,30 +97,30 @@ public class KeysIndex extends PerColumnSecondaryIndex
}
if (logger.isDebugEnabled())
logger.debug("applying index row {} in {}", indexCfs.metadata.getKeyValidator().getString(valueKey.key), cfi);
-
+
indexCfs.apply(valueKey, cfi);
}
-
+
public void updateColumn(DecoratedKey<?> valueKey, ByteBuffer rowKey, IColumn col)
- {
- insertColumn(valueKey, rowKey, col);
+ {
+ insertColumn(valueKey, rowKey, col);
}
public void removeIndex(ByteBuffer columnName) throws IOException
- {
+ {
indexCfs.invalidate();
}
public void forceBlockingFlush() throws IOException
- {
+ {
try
{
indexCfs.forceBlockingFlush();
- }
+ }
catch (ExecutionException e)
{
throw new IOException(e);
- }
+ }
catch (InterruptedException e)
{
throw new IOException(e);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java b/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
index c8173ab..e205528 100644
--- a/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
+++ b/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
@@ -37,12 +37,12 @@ import org.slf4j.LoggerFactory;
public class KeysSearcher extends SecondaryIndexSearcher
{
private static final Logger logger = LoggerFactory.getLogger(KeysSearcher.class);
-
+
public KeysSearcher(SecondaryIndexManager indexManager, Set<ByteBuffer> columns)
{
super(indexManager, columns);
}
-
+
private IndexExpression highestSelectivityPredicate(List<IndexExpression> clause)
{
IndexExpression best = null;
@@ -52,7 +52,7 @@ public class KeysSearcher extends SecondaryIndexSearcher
//skip columns belonging to a different index type
if(!columns.contains(expression.column_name))
continue;
-
+
SecondaryIndex index = indexManager.getIndexForColumn(expression.column_name);
if (index == null || (expression.op != IndexOperator.EQ))
continue;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/marshal/AbstractType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/AbstractType.java b/src/java/org/apache/cassandra/db/marshal/AbstractType.java
index 5dd18f9..af80116 100644
--- a/src/java/org/apache/cassandra/db/marshal/AbstractType.java
+++ b/src/java/org/apache/cassandra/db/marshal/AbstractType.java
@@ -89,9 +89,9 @@ public abstract class AbstractType<T> implements Comparator<ByteBuffer>
}
};
}
-
+
public abstract T compose(ByteBuffer bytes);
-
+
public abstract ByteBuffer decompose(T value);
/** get a string representation of the bytes suitable for log messages */
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/marshal/BooleanType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/BooleanType.java b/src/java/org/apache/cassandra/db/marshal/BooleanType.java
index e7a68b6..aeaede4 100644
--- a/src/java/org/apache/cassandra/db/marshal/BooleanType.java
+++ b/src/java/org/apache/cassandra/db/marshal/BooleanType.java
@@ -36,7 +36,7 @@ public class BooleanType extends AbstractType<Boolean>
{
return JdbcBoolean.instance.decompose(value);
}
-
+
public int compare(ByteBuffer o1, ByteBuffer o2)
{
if ((o1 == null) || (o1.remaining() != 1))
@@ -61,15 +61,15 @@ public class BooleanType extends AbstractType<Boolean>
public ByteBuffer fromString(String source) throws MarshalException
{
-
+
if (source.isEmpty()|| source.equalsIgnoreCase(Boolean.FALSE.toString()))
return decompose(false);
-
+
if (source.equalsIgnoreCase(Boolean.TRUE.toString()))
return decompose(true);
-
+
throw new MarshalException(String.format("unable to make boolean from '%s'", source));
-
+
}
public void validate(ByteBuffer bytes) throws MarshalException
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/marshal/BytesType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/BytesType.java b/src/java/org/apache/cassandra/db/marshal/BytesType.java
index e4c3f25..80c8269 100644
--- a/src/java/org/apache/cassandra/db/marshal/BytesType.java
+++ b/src/java/org/apache/cassandra/db/marshal/BytesType.java
@@ -38,7 +38,7 @@ public class BytesType extends AbstractType<ByteBuffer>
{
return JdbcBytes.instance.decompose(value);
}
-
+
public int compare(ByteBuffer o1, ByteBuffer o2)
{
return BytesType.bytesCompare(o1, o2);
@@ -50,7 +50,7 @@ public class BytesType extends AbstractType<ByteBuffer>
if(null == o2) return 0;
else return -1;
}
-
+
return ByteBufferUtil.compareUnsigned(o1, o2);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/marshal/DateType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/DateType.java b/src/java/org/apache/cassandra/db/marshal/DateType.java
index 889d0d7..408ce89 100644
--- a/src/java/org/apache/cassandra/db/marshal/DateType.java
+++ b/src/java/org/apache/cassandra/db/marshal/DateType.java
@@ -33,7 +33,7 @@ public class DateType extends AbstractType<Date>
public static final DateType instance = new DateType();
static final String DEFAULT_FORMAT = iso8601Patterns[3];
-
+
static final SimpleDateFormat FORMATTER = new SimpleDateFormat(DEFAULT_FORMAT);
DateType() {} // singleton
@@ -42,12 +42,12 @@ public class DateType extends AbstractType<Date>
{
return JdbcDate.instance.compose(bytes);
}
-
+
public ByteBuffer decompose(Date value)
{
return JdbcDate.instance.decompose(value);
}
-
+
public int compare(ByteBuffer o1, ByteBuffer o2)
{
if (o1.remaining() == 0)
@@ -79,10 +79,10 @@ public class DateType extends AbstractType<Date>
// Return an empty ByteBuffer for an empty string.
if (source.isEmpty())
return ByteBufferUtil.EMPTY_BYTE_BUFFER;
-
+
long millis;
ByteBuffer idBytes = null;
-
+
if (source.toLowerCase().equals("now"))
{
millis = System.currentTimeMillis();
@@ -113,7 +113,7 @@ public class DateType extends AbstractType<Date>
throw new MarshalException(String.format("unable to coerce '%s' to a formatted date (long)", source), e1);
}
}
-
+
return idBytes;
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/marshal/DecimalType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/DecimalType.java b/src/java/org/apache/cassandra/db/marshal/DecimalType.java
index 87a4541..4639a60 100644
--- a/src/java/org/apache/cassandra/db/marshal/DecimalType.java
+++ b/src/java/org/apache/cassandra/db/marshal/DecimalType.java
@@ -27,7 +27,7 @@ public class DecimalType extends AbstractType<BigDecimal>
{
public static final DecimalType instance = new DecimalType();
- DecimalType() {} // singleton
+ DecimalType() {} // singleton
public int compare(ByteBuffer bb0, ByteBuffer bb1)
{
@@ -39,7 +39,7 @@ public class DecimalType extends AbstractType<BigDecimal>
{
return 1;
}
-
+
return compose(bb0).compareTo(compose(bb1));
}
@@ -66,7 +66,7 @@ public class DecimalType extends AbstractType<BigDecimal>
{
// Return an empty ByteBuffer for an empty string.
if (source.isEmpty()) return ByteBufferUtil.EMPTY_BYTE_BUFFER;
-
+
BigDecimal decimal;
try
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/marshal/DoubleType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/DoubleType.java b/src/java/org/apache/cassandra/db/marshal/DoubleType.java
index 7e7c5c8..9d73983 100644
--- a/src/java/org/apache/cassandra/db/marshal/DoubleType.java
+++ b/src/java/org/apache/cassandra/db/marshal/DoubleType.java
@@ -26,17 +26,17 @@ public class DoubleType extends AbstractType<Double>
{
public static final DoubleType instance = new DoubleType();
- DoubleType() {} // singleton
+ DoubleType() {} // singleton
public Double compose(ByteBuffer bytes)
{
return JdbcDouble.instance.compose(bytes);
}
-
+
public ByteBuffer decompose(Double value)
{
return JdbcDouble.instance.decompose(value);
- }
+ }
public int compare(ByteBuffer o1, ByteBuffer o2)
{
@@ -48,12 +48,12 @@ public class DoubleType extends AbstractType<Double>
{
return 1;
}
-
+
return compose(o1).compareTo(compose(o2));
}
public String getString(ByteBuffer bytes)
- {
+ {
try
{
return JdbcDouble.instance.getString(bytes);
@@ -69,7 +69,7 @@ public class DoubleType extends AbstractType<Double>
// Return an empty ByteBuffer for an empty string.
if (source.isEmpty())
return ByteBufferUtil.EMPTY_BYTE_BUFFER;
-
+
Double d;
try
{
@@ -79,7 +79,7 @@ public class DoubleType extends AbstractType<Double>
{
throw new MarshalException(String.format("unable to coerce '%s' to a double", source), e1);
}
-
+
return decompose(d);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/marshal/FloatType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/FloatType.java b/src/java/org/apache/cassandra/db/marshal/FloatType.java
index b78d1ac..43a6eaa 100644
--- a/src/java/org/apache/cassandra/db/marshal/FloatType.java
+++ b/src/java/org/apache/cassandra/db/marshal/FloatType.java
@@ -27,17 +27,17 @@ public class FloatType extends AbstractType<Float>
{
public static final FloatType instance = new FloatType();
- FloatType() {} // singleton
+ FloatType() {} // singleton
public Float compose(ByteBuffer bytes)
{
return JdbcFloat.instance.compose(bytes);
}
-
+
public ByteBuffer decompose(Float value)
{
return JdbcFloat.instance.decompose(value);
- }
+ }
public int compare(ByteBuffer o1, ByteBuffer o2)
{
@@ -49,7 +49,7 @@ public class FloatType extends AbstractType<Float>
{
return 1;
}
-
+
return compose(o1).compareTo(compose(o2));
}
@@ -70,7 +70,7 @@ public class FloatType extends AbstractType<Float>
// Return an empty ByteBuffer for an empty string.
if (source.isEmpty())
return ByteBufferUtil.EMPTY_BYTE_BUFFER;
-
+
try
{
float f = Float.parseFloat(source);
@@ -79,7 +79,7 @@ public class FloatType extends AbstractType<Float>
catch (NumberFormatException e1)
{
throw new MarshalException(String.format("unable to coerce '%s' to a float", source), e1);
- }
+ }
}
public void validate(ByteBuffer bytes) throws MarshalException
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/marshal/Int32Type.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/Int32Type.java b/src/java/org/apache/cassandra/db/marshal/Int32Type.java
index da6ba15..720fa98 100644
--- a/src/java/org/apache/cassandra/db/marshal/Int32Type.java
+++ b/src/java/org/apache/cassandra/db/marshal/Int32Type.java
@@ -52,8 +52,8 @@ public class Int32Type extends AbstractType<Integer>
int diff = o1.get(o1.position()) - o2.get(o2.position());
if (diff != 0)
return diff;
-
-
+
+
return ByteBufferUtil.compareUnsigned(o1, o2);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/marshal/IntegerType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/IntegerType.java b/src/java/org/apache/cassandra/db/marshal/IntegerType.java
index bc82922..0a7846a 100644
--- a/src/java/org/apache/cassandra/db/marshal/IntegerType.java
+++ b/src/java/org/apache/cassandra/db/marshal/IntegerType.java
@@ -133,7 +133,7 @@ public final class IntegerType extends AbstractType<BigInteger>
// Return an empty ByteBuffer for an empty string.
if (source.isEmpty())
return ByteBufferUtil.EMPTY_BYTE_BUFFER;
-
+
BigInteger integerType;
try
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/marshal/LongType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/LongType.java b/src/java/org/apache/cassandra/db/marshal/LongType.java
index b516054..2f251ca 100644
--- a/src/java/org/apache/cassandra/db/marshal/LongType.java
+++ b/src/java/org/apache/cassandra/db/marshal/LongType.java
@@ -52,8 +52,8 @@ public class LongType extends AbstractType<Long>
int diff = o1.get(o1.position()) - o2.get(o2.position());
if (diff != 0)
return diff;
-
-
+
+
return ByteBufferUtil.compareUnsigned(o1, o2);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java b/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
index 6c926eb..2e62b4a 100644
--- a/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
+++ b/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
@@ -110,9 +110,9 @@ public class TimeUUIDType extends AbstractType<UUID>
// Return an empty ByteBuffer for an empty string.
if (source.isEmpty())
return ByteBufferUtil.EMPTY_BYTE_BUFFER;
-
+
ByteBuffer idBytes = null;
-
+
// ffffffff-ffff-ffff-ffff-ffffffffff
if (regexPattern.matcher(source).matches())
{
@@ -126,7 +126,7 @@ public class TimeUUIDType extends AbstractType<UUID>
{
throw new MarshalException(String.format("unable to make UUID from '%s'", source), e);
}
-
+
if (uuid.version() != 1)
throw new MarshalException("TimeUUID supports only version 1 UUIDs");
}
@@ -159,7 +159,7 @@ public class TimeUUIDType extends AbstractType<UUID>
throw new MarshalException(String.format("unable to coerce '%s' to version 1 UUID", source), e1);
}
}
-
+
return idBytes;
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/marshal/UTF8Type.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/UTF8Type.java b/src/java/org/apache/cassandra/db/marshal/UTF8Type.java
index bf5ea8c..26327b0 100644
--- a/src/java/org/apache/cassandra/db/marshal/UTF8Type.java
+++ b/src/java/org/apache/cassandra/db/marshal/UTF8Type.java
@@ -64,7 +64,7 @@ public class UTF8Type extends AbstractType<String>
if (!UTF8Validator.validate(bytes))
throw new MarshalException("String didn't validate.");
}
-
+
static class UTF8Validator
{
enum State {
@@ -76,11 +76,11 @@ public class UTF8Type extends AbstractType<String>
THREE_80bf_2,
FOUR_90bf,
FOUR_80bf_3,
- };
-
+ };
+
// since we're not converting to java strings, we don't need to worry about converting to surrogates.
// buf has already been sliced/duplicated.
- static boolean validate(ByteBuffer buf)
+ static boolean validate(ByteBuffer buf)
{
buf = buf.slice();
int b = 0;
@@ -115,7 +115,7 @@ public class UTF8Type extends AbstractType<String>
state = State.THREE_a0bf;
else
state = State.THREE_80bf_2;
- break;
+ break;
}
else if ((b >> 3) == -2)
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/marshal/UUIDType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/UUIDType.java b/src/java/org/apache/cassandra/db/marshal/UUIDType.java
index a03d288..53f87d2 100644
--- a/src/java/org/apache/cassandra/db/marshal/UUIDType.java
+++ b/src/java/org/apache/cassandra/db/marshal/UUIDType.java
@@ -37,7 +37,7 @@ import static org.apache.cassandra.cql.jdbc.JdbcDate.iso8601Patterns;
* - nil UUID is always lesser<br>
* - compare timestamps if both are time-based<br>
* - compare lexically, unsigned msb-to-lsb comparison<br>
- *
+ *
* @see "com.fasterxml.uuid.UUIDComparator"
*/
public class UUIDType extends AbstractType<UUID>
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java b/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java
index 8838e72..1211d30 100644
--- a/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java
+++ b/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java
@@ -29,7 +29,7 @@ import org.apache.cassandra.db.RowMutation;
public class AddColumnFamily extends Migration
{
private final CFMetaData cfm;
-
+
public AddColumnFamily(CFMetaData cfm) throws ConfigurationException
{
super(System.nanoTime());
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/migration/AddKeyspace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/migration/AddKeyspace.java b/src/java/org/apache/cassandra/db/migration/AddKeyspace.java
index 51320f6..cda4976 100644
--- a/src/java/org/apache/cassandra/db/migration/AddKeyspace.java
+++ b/src/java/org/apache/cassandra/db/migration/AddKeyspace.java
@@ -29,7 +29,7 @@ import org.apache.cassandra.db.RowMutation;
public class AddKeyspace extends Migration
{
private final KSMetaData ksm;
-
+
public AddKeyspace(KSMetaData ksm) throws ConfigurationException
{
super(System.nanoTime());
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/migration/DropColumnFamily.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/migration/DropColumnFamily.java b/src/java/org/apache/cassandra/db/migration/DropColumnFamily.java
index 35778d8..ab6b525 100644
--- a/src/java/org/apache/cassandra/db/migration/DropColumnFamily.java
+++ b/src/java/org/apache/cassandra/db/migration/DropColumnFamily.java
@@ -29,7 +29,7 @@ public class DropColumnFamily extends Migration
{
private final String ksName;
private final String cfName;
-
+
public DropColumnFamily(String ksName, String cfName) throws ConfigurationException
{
super(System.nanoTime());
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/migration/DropKeyspace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/migration/DropKeyspace.java b/src/java/org/apache/cassandra/db/migration/DropKeyspace.java
index 451a408..522c5f5 100644
--- a/src/java/org/apache/cassandra/db/migration/DropKeyspace.java
+++ b/src/java/org/apache/cassandra/db/migration/DropKeyspace.java
@@ -28,7 +28,7 @@ import org.apache.cassandra.db.RowMutation;
public class DropKeyspace extends Migration
{
private final String name;
-
+
public DropKeyspace(String name) throws ConfigurationException
{
super(System.nanoTime());
@@ -44,7 +44,7 @@ public class DropKeyspace extends Migration
{
return MigrationHelper.dropKeyspace(name, timestamp);
}
-
+
@Override
public String toString()
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/db/migration/Migration.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/migration/Migration.java b/src/java/org/apache/cassandra/db/migration/Migration.java
index 7ba2661..f7a89f0 100644
--- a/src/java/org/apache/cassandra/db/migration/Migration.java
+++ b/src/java/org/apache/cassandra/db/migration/Migration.java
@@ -41,14 +41,14 @@ import org.apache.cassandra.utils.UUIDGen;
* There are two parts to a migration (think of it as a schema update):
* 1. data is written to the schema cf (SCHEMA_KEYSPACES_CF).
* 2. updated models are applied to the cassandra instance.
- *
+ *
* Since all steps are not committed atomically, care should be taken to ensure that a node/cluster is reasonably
* quiescent with regard to the Keyspace or ColumnFamily whose schema is being modified.
*/
public abstract class Migration
{
protected static final Logger logger = LoggerFactory.getLogger(Migration.class);
-
+
public static final String NAME_VALIDATOR_REGEX = "\\w+";
public static final String MIGRATIONS_CF = "Migrations";
public static final String SCHEMA_CF = "Schema";
@@ -119,7 +119,7 @@ public abstract class Migration
else
return UUIDGen.getUUID(cf.getColumn(LAST_MIGRATION_KEY).value());
}
-
+
public static boolean isLegalName(String s)
{
return s.matches(Migration.NAME_VALIDATOR_REGEX);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/dht/BootStrapper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/BootStrapper.java b/src/java/org/apache/cassandra/dht/BootStrapper.java
index 8699999..de7f0cf 100644
--- a/src/java/org/apache/cassandra/dht/BootStrapper.java
+++ b/src/java/org/apache/cassandra/dht/BootStrapper.java
@@ -150,15 +150,15 @@ public class BootStrapper
assert !maxEndpoint.equals(FBUtilities.getBroadcastAddress());
if (metadata.pendingRangeChanges(maxEndpoint) > 0)
throw new RuntimeException("Every node is a bootstrap source! Please specify an initial token manually or wait for an existing bootstrap operation to finish.");
-
+
return maxEndpoint;
}
static Token<?> getBootstrapTokenFrom(InetAddress maxEndpoint)
{
Message message = new Message(FBUtilities.getBroadcastAddress(),
- StorageService.Verb.BOOTSTRAP_TOKEN,
- ArrayUtils.EMPTY_BYTE_ARRAY,
+ StorageService.Verb.BOOTSTRAP_TOKEN,
+ ArrayUtils.EMPTY_BYTE_ARRAY,
Gossiper.instance.getVersion(maxEndpoint));
int retries = 5;
long timeout = Math.max(MessagingService.getDefaultCallbackTimeout(), BOOTSTRAP_TIMEOUT);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/dht/BytesToken.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/BytesToken.java b/src/java/org/apache/cassandra/dht/BytesToken.java
index 444d8bf..a95eb98 100644
--- a/src/java/org/apache/cassandra/dht/BytesToken.java
+++ b/src/java/org/apache/cassandra/dht/BytesToken.java
@@ -45,10 +45,10 @@ public class BytesToken extends Token<byte[]>
}
public int compareTo(Token<byte[]> o)
- {
+ {
return FBUtilities.compareUnsigned(token, o.token, 0, 0, token.length, o.token.length);
}
-
+
@Override
public int hashCode()
@@ -65,7 +65,7 @@ public class BytesToken extends Token<byte[]>
if (!(obj instanceof BytesToken))
return false;
BytesToken other = (BytesToken) obj;
-
+
return Arrays.equals(token, other.token);
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/dht/IPartitioner.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/IPartitioner.java b/src/java/org/apache/cassandra/dht/IPartitioner.java
index 5aa02f7..bdfc424 100644
--- a/src/java/org/apache/cassandra/dht/IPartitioner.java
+++ b/src/java/org/apache/cassandra/dht/IPartitioner.java
@@ -29,11 +29,11 @@ public interface IPartitioner<T extends Token>
* @deprecated Used by SSTables before version 'e'.
*
* Convert the on disk representation to a DecoratedKey object
- * @param key On disk representation
+ * @param key On disk representation
* @return DecoratedKey object
*/
public DecoratedKey<T> convertFromDiskFormat(ByteBuffer key);
-
+
/**
* Transform key to object representation of the on-disk format.
*
@@ -68,7 +68,7 @@ public interface IPartitioner<T extends Token>
public T getRandomToken();
public Token.TokenFactory getTokenFactory();
-
+
/**
* @return True if the implementing class preserves key order in the Tokens
* it generates.
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/dht/OrderPreservingPartitioner.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/OrderPreservingPartitioner.java b/src/java/org/apache/cassandra/dht/OrderPreservingPartitioner.java
index 2a21441..d2ee69c 100644
--- a/src/java/org/apache/cassandra/dht/OrderPreservingPartitioner.java
+++ b/src/java/org/apache/cassandra/dht/OrderPreservingPartitioner.java
@@ -40,7 +40,7 @@ public class OrderPreservingPartitioner extends AbstractPartitioner<StringToken>
{
return new DecoratedKey<StringToken>(getToken(key), key);
}
-
+
public DecoratedKey<StringToken> convertFromDiskFormat(ByteBuffer key)
{
return new DecoratedKey<StringToken>(getToken(key), key);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/dht/RandomPartitioner.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/RandomPartitioner.java b/src/java/org/apache/cassandra/dht/RandomPartitioner.java
index 4bc3d46..b083d4c 100644
--- a/src/java/org/apache/cassandra/dht/RandomPartitioner.java
+++ b/src/java/org/apache/cassandra/dht/RandomPartitioner.java
@@ -45,7 +45,7 @@ public class RandomPartitioner extends AbstractPartitioner<BigIntegerToken>
{
return new DecoratedKey<BigIntegerToken>(getToken(key), key);
}
-
+
public DecoratedKey<BigIntegerToken> convertFromDiskFormat(ByteBuffer fromdisk)
{
// find the delimiter position
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/gms/EndpointState.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/EndpointState.java b/src/java/org/apache/cassandra/gms/EndpointState.java
index 3a1f631..05757ee 100644
--- a/src/java/org/apache/cassandra/gms/EndpointState.java
+++ b/src/java/org/apache/cassandra/gms/EndpointState.java
@@ -40,7 +40,7 @@ public class EndpointState
private volatile HeartBeatState hbState;
final Map<ApplicationState, VersionedValue> applicationState = new NonBlockingHashMap<ApplicationState, VersionedValue>();
-
+
/* fields below do not get serialized */
private volatile long updateTimestamp;
private volatile boolean isAlive;
@@ -49,19 +49,19 @@ public class EndpointState
{
return serializer;
}
-
+
EndpointState(HeartBeatState initialHbState)
- {
+ {
hbState = initialHbState;
updateTimestamp = System.currentTimeMillis();
isAlive = true;
}
-
+
HeartBeatState getHeartBeatState()
{
return hbState;
}
-
+
void setHeartBeatState(HeartBeatState newHbState)
{
updateTimestamp();
@@ -81,7 +81,7 @@ public class EndpointState
{
return applicationState;
}
-
+
void addApplicationState(ApplicationState key, VersionedValue value)
{
applicationState.put(key, value);
@@ -92,14 +92,14 @@ public class EndpointState
{
return updateTimestamp;
}
-
+
void updateTimestamp()
{
updateTimestamp = System.currentTimeMillis();
}
-
+
public boolean isAlive()
- {
+ {
return isAlive;
}
@@ -109,7 +109,7 @@ public class EndpointState
}
void markDead()
- {
+ {
isAlive = false;
}
}
@@ -117,7 +117,7 @@ public class EndpointState
class EndpointStateSerializer implements IVersionedSerializer<EndpointState>
{
private static final Logger logger = LoggerFactory.getLogger(EndpointStateSerializer.class);
-
+
public void serialize(EndpointState epState, DataOutput dos, int version) throws IOException
{
/* serialize the HeartBeatState */
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/gms/FailureDetector.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/FailureDetector.java b/src/java/org/apache/cassandra/gms/FailureDetector.java
index b5a5c4c..bf47cc9 100644
--- a/src/java/org/apache/cassandra/gms/FailureDetector.java
+++ b/src/java/org/apache/cassandra/gms/FailureDetector.java
@@ -37,7 +37,7 @@ import org.apache.cassandra.utils.FBUtilities;
/**
* This FailureDetector is an implementation of the paper titled
- * "The Phi Accrual Failure Detector" by Hayashibara.
+ * "The Phi Accrual Failure Detector" by Hayashibara.
* Check the paper and the <i>IFailureDetector</i> interface for details.
*/
public class FailureDetector implements IFailureDetector, FailureDetectorMBean
@@ -51,7 +51,7 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean
private final Map<InetAddress, ArrivalWindow> arrivalSamples = new Hashtable<InetAddress, ArrivalWindow>();
private final List<IFailureDetectionEventListener> fdEvntListeners = new CopyOnWriteArrayList<IFailureDetectionEventListener>();
-
+
public FailureDetector()
{
phiConvictThreshold = DatabaseDescriptor.getPhiConvictThreshold();
@@ -66,7 +66,7 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean
throw new RuntimeException(e);
}
}
-
+
public String getAllEndpointStates()
{
StringBuilder sb = new StringBuilder();
@@ -126,7 +126,7 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean
FileUtils.closeQuietly(os);
}
}
-
+
public void setPhiConvictThreshold(int phi)
{
phiConvictThreshold = phi;
@@ -136,7 +136,7 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean
{
return phiConvictThreshold;
}
-
+
public boolean isAlive(InetAddress ep)
{
if (ep.equals(FBUtilities.getBroadcastAddress()))
@@ -171,19 +171,19 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean
}
heartbeatWindow.add(now);
}
-
+
public void interpret(InetAddress ep)
{
ArrivalWindow hbWnd = arrivalSamples.get(ep);
if ( hbWnd == null )
- {
+ {
return;
}
long now = System.currentTimeMillis();
double phi = hbWnd.phi(now);
if (logger.isTraceEnabled())
logger.trace("PHI for " + ep + " : " + phi);
-
+
if ( phi > phiConvictThreshold )
{
logger.trace("notifying listeners that {} is down", ep);
@@ -192,29 +192,29 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean
{
listener.convict(ep, phi);
}
- }
+ }
}
public void remove(InetAddress ep)
{
arrivalSamples.remove(ep);
}
-
+
public void registerFailureDetectionEventListener(IFailureDetectionEventListener listener)
{
fdEvntListeners.add(listener);
}
-
+
public void unregisterFailureDetectionEventListener(IFailureDetectionEventListener listener)
{
fdEvntListeners.remove(listener);
}
-
+
public String toString()
{
StringBuilder sb = new StringBuilder();
Set<InetAddress> eps = arrivalSamples.keySet();
-
+
sb.append("-----------------------------------------------------------------------");
for ( InetAddress ep : eps )
{
@@ -226,9 +226,9 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean
sb.append("-----------------------------------------------------------------------");
return sb.toString();
}
-
+
public static void main(String[] args) throws Throwable
- {
+ {
}
}
@@ -253,12 +253,12 @@ class ArrivalWindow
{
arrivalIntervals = new BoundedStatsDeque(size);
}
-
+
synchronized void add(double value)
{
double interArrivalTime;
if ( tLast > 0L )
- {
+ {
interArrivalTime = (value - tLast);
}
else
@@ -271,32 +271,32 @@ class ArrivalWindow
logger.debug("Ignoring interval time of {}", interArrivalTime);
tLast = value;
}
-
+
synchronized double sum()
{
return arrivalIntervals.sum();
}
-
+
synchronized double sumOfDeviations()
{
return arrivalIntervals.sumOfDeviations();
}
-
+
synchronized double mean()
{
return arrivalIntervals.mean();
}
-
+
synchronized double variance()
{
return arrivalIntervals.variance();
}
-
+
double stdev()
{
return arrivalIntervals.stdev();
}
-
+
void clear()
{
arrivalIntervals.clear();
@@ -311,7 +311,7 @@ class ArrivalWindow
? PHI_FACTOR * t / mean()
: 0.0;
}
-
+
public String toString()
{
return StringUtils.join(arrivalIntervals.iterator(), " ");
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/gms/GossipDigest.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/GossipDigest.java b/src/java/org/apache/cassandra/gms/GossipDigest.java
index 26a54dc..3dc8294 100644
--- a/src/java/org/apache/cassandra/gms/GossipDigest.java
+++ b/src/java/org/apache/cassandra/gms/GossipDigest.java
@@ -24,7 +24,7 @@ import org.apache.cassandra.io.IVersionedSerializer;
import org.apache.cassandra.net.CompactEndpointSerializationHelper;
/**
- * Contains information about a specified list of Endpoints and the largest version
+ * Contains information about a specified list of Endpoints and the largest version
* of the state they have generated as known by the local endpoint.
*/
@@ -35,7 +35,7 @@ public class GossipDigest implements Comparable<GossipDigest>
{
serializer = new GossipDigestSerializer();
}
-
+
final InetAddress endpoint;
final int generation;
final int maxVersion;
@@ -44,36 +44,36 @@ public class GossipDigest implements Comparable<GossipDigest>
{
return serializer;
}
-
+
GossipDigest(InetAddress ep, int gen, int version)
{
endpoint = ep;
generation = gen;
maxVersion = version;
}
-
+
InetAddress getEndpoint()
{
return endpoint;
}
-
+
int getGeneration()
{
return generation;
}
-
+
int getMaxVersion()
{
return maxVersion;
}
-
+
public int compareTo(GossipDigest gDigest)
{
if ( generation != gDigest.generation )
return ( generation - gDigest.generation );
return (maxVersion - gDigest.maxVersion);
}
-
+
public String toString()
{
StringBuilder sb = new StringBuilder();
@@ -87,9 +87,9 @@ public class GossipDigest implements Comparable<GossipDigest>
}
class GossipDigestSerializer implements IVersionedSerializer<GossipDigest>
-{
+{
public void serialize(GossipDigest gDigest, DataOutput dos, int version) throws IOException
- {
+ {
CompactEndpointSerializationHelper.serialize(gDigest.endpoint, dos);
dos.writeInt(gDigest.generation);
dos.writeInt(gDigest.maxVersion);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/gms/GossipDigestAck2Message.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/GossipDigestAck2Message.java b/src/java/org/apache/cassandra/gms/GossipDigestAck2Message.java
index ae2faff..c1d880e 100644
--- a/src/java/org/apache/cassandra/gms/GossipDigestAck2Message.java
+++ b/src/java/org/apache/cassandra/gms/GossipDigestAck2Message.java
@@ -25,7 +25,7 @@ import org.apache.cassandra.io.IVersionedSerializer;
/**
- * This message gets sent out as a result of the receipt of a GossipDigestAckMessage. This the
+ * This message gets sent out as a result of the receipt of a GossipDigestAckMessage. This the
* last stage of the 3 way messaging of the Gossip protocol.
*/
@@ -36,19 +36,19 @@ class GossipDigestAck2Message
{
serializer = new GossipDigestAck2MessageSerializer();
}
-
+
final Map<InetAddress, EndpointState> epStateMap;
public static IVersionedSerializer<GossipDigestAck2Message> serializer()
{
return serializer;
}
-
+
GossipDigestAck2Message(Map<InetAddress, EndpointState> epStateMap)
{
this.epStateMap = epStateMap;
}
-
+
Map<InetAddress, EndpointState> getEndpointStateMap()
{
return epStateMap;
@@ -66,7 +66,7 @@ class GossipDigestAck2MessageSerializer implements IVersionedSerializer<GossipDi
public GossipDigestAck2Message deserialize(DataInput dis, int version) throws IOException
{
Map<InetAddress, EndpointState> epStateMap = EndpointStatesSerializationHelper.deserialize(dis, version);
- return new GossipDigestAck2Message(epStateMap);
+ return new GossipDigestAck2Message(epStateMap);
}
public long serializedSize(GossipDigestAck2Message gossipDigestAck2Message, int version)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/gms/GossipDigestAckMessage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/GossipDigestAckMessage.java b/src/java/org/apache/cassandra/gms/GossipDigestAckMessage.java
index 3e07931..32bb030 100644
--- a/src/java/org/apache/cassandra/gms/GossipDigestAckMessage.java
+++ b/src/java/org/apache/cassandra/gms/GossipDigestAckMessage.java
@@ -38,26 +38,26 @@ class GossipDigestAckMessage
{
serializer = new GossipDigestAckMessageSerializer();
}
-
+
final List<GossipDigest> gDigestList;
final Map<InetAddress, EndpointState> epStateMap;
-
+
static IVersionedSerializer<GossipDigestAckMessage> serializer()
{
return serializer;
}
-
+
GossipDigestAckMessage(List<GossipDigest> gDigestList, Map<InetAddress, EndpointState> epStateMap)
{
this.gDigestList = gDigestList;
this.epStateMap = epStateMap;
}
-
+
List<GossipDigest> getGossipDigestList()
{
return gDigestList;
}
-
+
Map<InetAddress, EndpointState> getEndpointStateMap()
{
return epStateMap;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/gms/GossipDigestSynMessage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/GossipDigestSynMessage.java b/src/java/org/apache/cassandra/gms/GossipDigestSynMessage.java
index 219394e..e798edb 100644
--- a/src/java/org/apache/cassandra/gms/GossipDigestSynMessage.java
+++ b/src/java/org/apache/cassandra/gms/GossipDigestSynMessage.java
@@ -30,8 +30,8 @@ import org.apache.cassandra.net.CompactEndpointSerializationHelper;
/**
- * This is the first message that gets sent out as a start of the Gossip protocol in a
- * round.
+ * This is the first message that gets sent out as a start of the Gossip protocol in a
+ * round.
*/
class GossipDigestSynMessage
@@ -41,7 +41,7 @@ class GossipDigestSynMessage
{
serializer = new GossipDigestSynMessageSerializer();
}
-
+
final String clusterId;
final List<GossipDigest> gDigests;
@@ -49,13 +49,13 @@ class GossipDigestSynMessage
{
return serializer;
}
-
+
public GossipDigestSynMessage(String clusterId, List<GossipDigest> gDigests)
- {
+ {
this.clusterId = clusterId;
this.gDigests = gDigests;
}
-
+
List<GossipDigest> getGossipDigests()
{
return gDigests;
@@ -75,13 +75,13 @@ class GossipDigestSerializationHelper
static List<GossipDigest> deserialize(DataInput dis, int version) throws IOException
{
- int size = dis.readInt();
+ int size = dis.readInt();
List<GossipDigest> gDigests = new ArrayList<GossipDigest>(size);
-
+
for ( int i = 0; i < size; ++i )
{
gDigests.add(GossipDigest.serializer().deserialize(dis, version));
- }
+ }
return gDigests;
}
}
@@ -101,7 +101,7 @@ class EndpointStatesSerializationHelper
static Map<InetAddress, EndpointState> deserialize(DataInput dis, int version) throws IOException
{
- int size = dis.readInt();
+ int size = dis.readInt();
Map<InetAddress, EndpointState> epStateMap = new HashMap<InetAddress, EndpointState>(size);
for ( int i = 0; i < size; ++i )
@@ -115,9 +115,9 @@ class EndpointStatesSerializationHelper
}
class GossipDigestSynMessageSerializer implements IVersionedSerializer<GossipDigestSynMessage>
-{
+{
public void serialize(GossipDigestSynMessage gDigestSynMessage, DataOutput dos, int version) throws IOException
- {
+ {
dos.writeUTF(gDigestSynMessage.clusterId);
GossipDigestSerializationHelper.serialize(gDigestSynMessage.gDigests, dos, version);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java
index d04b054..fe7b526 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -62,7 +62,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
private static final DebuggableScheduledThreadPoolExecutor executor = new DebuggableScheduledThreadPoolExecutor("GossipTasks");
static final ApplicationState[] STATES = ApplicationState.values();
- static final List<String> DEAD_STATES = Arrays.asList(VersionedValue.REMOVING_TOKEN, VersionedValue.REMOVED_TOKEN,
+ static final List<String> DEAD_STATES = Arrays.asList(VersionedValue.REMOVING_TOKEN, VersionedValue.REMOVED_TOKEN,
VersionedValue.STATUS_LEFT, VersionedValue.HIBERNATE);
private ScheduledFuture<?> scheduledGossipTask;
@@ -71,7 +71,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
private static final Logger logger = LoggerFactory.getLogger(Gossiper.class);
public static final Gossiper instance = new Gossiper();
- public static final long aVeryLongTime = 259200 * 1000; // 3 days
+ public static final long aVeryLongTime = 259200 * 1000; // 3 days
private long FatClientTimeout;
private final Random random = new Random();
private final Comparator<InetAddress> inetcomparator = new Comparator<InetAddress>()
@@ -102,9 +102,9 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
* after removal to prevent nodes from falsely reincarnating during the time when removal
* gossip gets propagated to all nodes */
private final Map<InetAddress, Long> justRemovedEndpoints = new ConcurrentHashMap<InetAddress, Long>();
-
+
private final Map<InetAddress, Long> expireTimeEndpointMap = new ConcurrentHashMap<InetAddress, Long>();
-
+
// protocol versions of the other nodes in the cluster
private final ConcurrentMap<InetAddress, Integer> versions = new NonBlockingHashMap<InetAddress, Integer>();
@@ -116,7 +116,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
{
//wait on messaging service to start listening
MessagingService.instance().waitUntilListening();
-
+
/* Update the local heartbeat counter. */
endpointStateMap.get(FBUtilities.getBroadcastAddress()).getHeartBeatState().updateHeartBeat();
if (logger.isTraceEnabled())
@@ -206,13 +206,13 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
{
subscribers.remove(subscriber);
}
-
+
public void setVersion(InetAddress address, int version)
{
logger.debug("Setting version {} for {}", version, address);
versions.put(address, version);
}
-
+
public void resetVersion(InetAddress endpoint)
{
logger.debug("Reseting version for {}", endpoint);
@@ -231,7 +231,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
else
return v;
}
-
+
public Set<InetAddress> getLiveMembers()
{
@@ -547,7 +547,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
catch (IOException ex)
{
throw new IOError(ex);
- }
+ }
return seeds.contains(to);
}
@@ -639,7 +639,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
}
}
}
-
+
if (!justRemovedEndpoints.isEmpty())
{
for (Entry<InetAddress, Long> entry : justRemovedEndpoints.entrySet())
@@ -653,7 +653,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
}
}
}
-
+
protected long getExpireTimeForEndpoint(InetAddress endpoint)
{
/* default expireTime is aVeryLongTime */
@@ -724,7 +724,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
EndpointState ep2 = getEndpointStateForEndpoint(addr2);
assert ep1 != null && ep2 != null;
return ep1.getHeartBeatState().getGeneration() - ep2.getHeartBeatState().getGeneration();
- }
+ }
void notifyFailureDetector(List<GossipDigest> gDigests)
{
@@ -1066,9 +1066,9 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
Gossiper.intervalInMillis,
TimeUnit.MILLISECONDS);
}
-
+
// initialize local HB state if needed.
- public void maybeInitializeLocalState(int generationNbr)
+ public void maybeInitializeLocalState(int generationNbr)
{
EndpointState localState = endpointStateMap.get(FBUtilities.getBroadcastAddress());
if ( localState == null )
@@ -1079,7 +1079,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
endpointStateMap.put(FBUtilities.getBroadcastAddress(), localState);
}
}
-
+
/**
* Add an endpoint we knew about previously, but whose state is unknown
@@ -1146,7 +1146,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
{
return getCurrentGenerationNumber(InetAddress.getByName(address));
}
-
+
public void addExpireTimeForEndpoint(InetAddress endpoint, long expireTime)
{
if (logger.isDebugEnabled())
@@ -1155,7 +1155,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
}
expireTimeEndpointMap.put(endpoint, expireTime);
}
-
+
public static long computeExpireTime() {
return System.currentTimeMillis() + Gossiper.aVeryLongTime;
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/gms/HeartBeatState.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/HeartBeatState.java b/src/java/org/apache/cassandra/gms/HeartBeatState.java
index 9f0de57..294d460 100644
--- a/src/java/org/apache/cassandra/gms/HeartBeatState.java
+++ b/src/java/org/apache/cassandra/gms/HeartBeatState.java
@@ -23,18 +23,18 @@ import org.apache.cassandra.io.IVersionedSerializer;
/**
- * HeartBeat State associated with any given endpoint.
+ * HeartBeat State associated with any given endpoint.
*/
class HeartBeatState
{
private static final IVersionedSerializer<HeartBeatState> serializer;
-
+
static
{
serializer = new HeartBeatStateSerializer();
}
-
+
private int generation;
private int version;
@@ -42,7 +42,7 @@ class HeartBeatState
{
this(gen, 0);
}
-
+
HeartBeatState(int gen, int ver)
{
generation = gen;
@@ -53,7 +53,7 @@ class HeartBeatState
{
return serializer;
}
-
+
int getGeneration()
{
return generation;
@@ -63,7 +63,7 @@ class HeartBeatState
{
version = VersionGenerator.getNextVersion();
}
-
+
int getHeartBeatVersion()
{
return version;
@@ -82,7 +82,7 @@ class HeartBeatStateSerializer implements IVersionedSerializer<HeartBeatState>
dos.writeInt(hbState.getGeneration());
dos.writeInt(hbState.getHeartBeatVersion());
}
-
+
public HeartBeatState deserialize(DataInput dis, int version) throws IOException
{
return new HeartBeatState(dis.readInt(), dis.readInt());
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/gms/IEndpointStateChangeSubscriber.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/IEndpointStateChangeSubscriber.java b/src/java/org/apache/cassandra/gms/IEndpointStateChangeSubscriber.java
index e827b5b..fff613b 100644
--- a/src/java/org/apache/cassandra/gms/IEndpointStateChangeSubscriber.java
+++ b/src/java/org/apache/cassandra/gms/IEndpointStateChangeSubscriber.java
@@ -24,7 +24,7 @@ import java.net.InetAddress;
* interested parties about changes in the the state associated with any endpoint.
* For instance if node A figures there is a changes in state for an endpoint B
* it notifies all interested parties of this change. It is upto to the registered
- * instance to decide what he does with this change. Not all modules maybe interested
+ * instance to decide what he does with this change. Not all modules maybe interested
* in all state changes.
*/
@@ -33,7 +33,7 @@ public interface IEndpointStateChangeSubscriber
/**
* Use to inform interested parties about the change in the state
* for specified endpoint
- *
+ *
* @param endpoint endpoint for which the state change occurred.
* @param epState state that actually changed for the above endpoint.
*/
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/gms/IFailureDetectionEventListener.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/IFailureDetectionEventListener.java b/src/java/org/apache/cassandra/gms/IFailureDetectionEventListener.java
index c23a675..25b90e4 100644
--- a/src/java/org/apache/cassandra/gms/IFailureDetectionEventListener.java
+++ b/src/java/org/apache/cassandra/gms/IFailureDetectionEventListener.java
@@ -26,7 +26,7 @@ import java.net.InetAddress;
*/
public interface IFailureDetectionEventListener
-{
+{
/**
* Convict the specified endpoint.
* @param ep endpoint to be convicted
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/gms/IFailureDetector.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/IFailureDetector.java b/src/java/org/apache/cassandra/gms/IFailureDetector.java
index d56e48e..309a2d6 100644
--- a/src/java/org/apache/cassandra/gms/IFailureDetector.java
+++ b/src/java/org/apache/cassandra/gms/IFailureDetector.java
@@ -21,7 +21,7 @@ import java.net.InetAddress;
/**
* An interface that provides an application with the ability
- * to query liveness information of a node in the cluster. It
+ * to query liveness information of a node in the cluster. It
* also exposes methods which help an application register callbacks
* for notifications of liveness information of nodes.
*/
@@ -31,7 +31,7 @@ public interface IFailureDetector
/**
* Failure Detector's knowledge of whether a node is up or
* down.
- *
+ *
* @param ep endpoint in question.
* @return true if UP and false if DOWN.
*/
@@ -44,19 +44,19 @@ public interface IFailureDetector
public void clear(InetAddress ep);
/**
- * This method is invoked by any entity wanting to interrogate the status of an endpoint.
+ * This method is invoked by any entity wanting to interrogate the status of an endpoint.
* In our case it would be the Gossiper. The Failure Detector will then calculate Phi and
- * deem an endpoint as suspicious or alive as explained in the Hayashibara paper.
- *
+ * deem an endpoint as suspicious or alive as explained in the Hayashibara paper.
+ *
* param ep endpoint for which we interpret the inter arrival times.
*/
public void interpret(InetAddress ep);
-
+
/**
* This method is invoked by the receiver of the heartbeat. In our case it would be
* the Gossiper. Gossiper inform the Failure Detector on receipt of a heartbeat. The
* FailureDetector will then sample the arrival time as explained in the paper.
- *
+ *
* param ep endpoint being reported.
*/
public void report(InetAddress ep);
@@ -65,16 +65,16 @@ public interface IFailureDetector
* remove endpoint from failure detector
*/
public void remove(InetAddress ep);
-
+
/**
- * Register interest for Failure Detector events.
- * @param listener implementation of an application provided IFailureDetectionEventListener
+ * Register interest for Failure Detector events.
+ * @param listener implementation of an application provided IFailureDetectionEventListener
*/
public void registerFailureDetectionEventListener(IFailureDetectionEventListener listener);
-
+
/**
- * Un-register interest for Failure Detector events.
- * @param listener implementation of an application provided IFailureDetectionEventListener
+ * Un-register interest for Failure Detector events.
+ * @param listener implementation of an application provided IFailureDetectionEventListener
*/
public void unregisterFailureDetectionEventListener(IFailureDetectionEventListener listener);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/gms/IFailureNotification.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/IFailureNotification.java b/src/java/org/apache/cassandra/gms/IFailureNotification.java
index 2fd5f36..84195e6 100644
--- a/src/java/org/apache/cassandra/gms/IFailureNotification.java
+++ b/src/java/org/apache/cassandra/gms/IFailureNotification.java
@@ -20,7 +20,7 @@ package org.apache.cassandra.gms;
import java.net.InetAddress;
public interface IFailureNotification
-{
+{
public void convict(InetAddress ep);
public void revive(InetAddress ep);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/gms/VersionGenerator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/VersionGenerator.java b/src/java/org/apache/cassandra/gms/VersionGenerator.java
index 5a645a8..c9b9564 100644
--- a/src/java/org/apache/cassandra/gms/VersionGenerator.java
+++ b/src/java/org/apache/cassandra/gms/VersionGenerator.java
@@ -20,14 +20,14 @@ package org.apache.cassandra.gms;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * A unique version number generator for any state that is generated by the
+ * A unique version number generator for any state that is generated by the
* local node.
*/
public class VersionGenerator
{
private static final AtomicInteger version = new AtomicInteger(0);
-
+
public static int getNextVersion()
{
return version.incrementAndGet();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/gms/VersionedValue.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/VersionedValue.java b/src/java/org/apache/cassandra/gms/VersionedValue.java
index aab26be..eccca1f 100644
--- a/src/java/org/apache/cassandra/gms/VersionedValue.java
+++ b/src/java/org/apache/cassandra/gms/VersionedValue.java
@@ -29,12 +29,12 @@ import org.apache.cassandra.utils.FBUtilities;
/**
* This abstraction represents the state associated with a particular node which an
- * application wants to make available to the rest of the nodes in the cluster.
+ * application wants to make available to the rest of the nodes in the cluster.
* Whenever a piece of state needs to be disseminated to the rest of cluster wrap
* the state in an instance of <i>ApplicationState</i> and add it to the Gossiper.
- *
+ *
* e.g. if we want to disseminate load information for node A do the following:
- *
+ *
* ApplicationState loadState = new ApplicationState(<string representation of load>);
* Gossiper.instance.addApplicationState("LOAD STATE", loadState);
*/
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2fd3268b/src/java/org/apache/cassandra/hadoop/BulkOutputFormat.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hadoop/BulkOutputFormat.java b/src/java/org/apache/cassandra/hadoop/BulkOutputFormat.java
index afa9e05..34be5cf 100644
--- a/src/java/org/apache/cassandra/hadoop/BulkOutputFormat.java
+++ b/src/java/org/apache/cassandra/hadoop/BulkOutputFormat.java
@@ -32,7 +32,7 @@ public class BulkOutputFormat extends OutputFormat<ByteBuffer,List<Mutation>>
implements org.apache.hadoop.mapred.OutputFormat<ByteBuffer,List<Mutation>>
{
private static final Logger logger = LoggerFactory.getLogger(BulkOutputFormat.class);
-
+
@Override
public void checkOutputSpecs(JobContext context)
{
@@ -52,7 +52,7 @@ public class BulkOutputFormat extends OutputFormat<ByteBuffer,List<Mutation>>
{
return new NullOutputCommitter();
}
-
+
/** Fills the deprecated OutputFormat interface for streaming. */
@Deprecated
public void checkOutputSpecs(org.apache.hadoop.fs.FileSystem filesystem, org.apache.hadoop.mapred.JobConf job) throws IOException