mirror of https://github.com/apache/cassandra
add SecondaryIndex.reload API
patch by Sam Tunnicliffe; reviewed by jbellis for CASSANDRA-4581
This commit is contained in:
parent
ec1c64ab5a
commit
2cd73633bd
|
|
@ -1,4 +1,5 @@
|
|||
1.1.5
|
||||
* add SecondaryIndex.reload API (CASSANDRA-4581)
|
||||
* use millis + atomicint for commitlog segment creation instead of
|
||||
nanotime, which has issues under some hypervisors (CASSANDRA-4601)
|
||||
* fix FD leak in slice queries (CASSANDRA-4571)
|
||||
|
|
|
|||
|
|
@ -65,6 +65,14 @@ public abstract class SecondaryIndex
|
|||
*/
|
||||
public abstract void init();
|
||||
|
||||
/**
|
||||
* Reload an existing index following a change to its configuration,
|
||||
* or that of the indexed column(s). Differs from init() in that we expect
|
||||
* expect new resources (such as CFS for a KEYS index) to be created by
|
||||
* init() but not here
|
||||
*/
|
||||
public abstract void reload() throws IOException;
|
||||
|
||||
/**
|
||||
* Validates the index_options passed in the ColumnDef
|
||||
* @throws ConfigurationException
|
||||
|
|
|
|||
|
|
@ -99,10 +99,11 @@ public class SecondaryIndexManager
|
|||
if (cdef.getIndexType() != null && !indexedColumnNames.contains(cdef.name))
|
||||
addIndexedColumn(cdef);
|
||||
|
||||
for (ColumnFamilyStore cfs : getIndexesBackedByCfs())
|
||||
Set<SecondaryIndex> reloadedIndexes = Collections.newSetFromMap(new IdentityHashMap<SecondaryIndex, Boolean>());
|
||||
for (SecondaryIndex index : indexesByColumn.values())
|
||||
{
|
||||
cfs.metadata.reloadSecondaryIndexMetadata(baseCfs.metadata);
|
||||
cfs.reload();
|
||||
if (reloadedIndexes.add(index))
|
||||
index.reload();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -181,4 +181,10 @@ public class KeysIndex extends PerColumnSecondaryIndex
|
|||
{
|
||||
return indexCfs.getMemtableDataSize();
|
||||
}
|
||||
|
||||
public void reload() throws IOException
|
||||
{
|
||||
indexCfs.metadata.reloadSecondaryIndexMetadata(baseCfs.metadata);
|
||||
indexCfs.reload();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,11 @@ public class SecondaryIndexColumnSizeTest
|
|||
public void deleteFromIndex(DecoratedKey<?> key, List<IColumn> indexedColumnsInRow)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void reload()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -210,6 +214,11 @@ public class SecondaryIndexColumnSizeTest
|
|||
@Override
|
||||
public void updateColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) throws IOException
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue