public class SegmentCacheManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SegmentCacheManager.AbortException
Exception which someone can throw to indicate to the Actor that whatever it was doing is not needed anymore.
|
static interface |
SegmentCacheManager.Command<T> |
static class |
SegmentCacheManager.FlushCommand
Command to flush a particular region from cache.
|
static class |
SegmentCacheManager.FlushResult
Result of a
SegmentCacheManager.FlushCommand . |
class |
SegmentCacheManager.SegmentCacheIndexRegistry
Registry of all the indexes that were created for this cache manager, per
RolapStar . |
static interface |
SegmentCacheManager.Visitor
Visitor for messages (commands and events).
|
Modifier and Type | Field and Description |
---|---|
ExecutorService |
cacheExecutor
Executor with which to send requests to external caches.
|
SegmentCache |
compositeCache |
List<SegmentCacheWorker> |
segmentCacheWorkers |
ExecutorService |
sqlExecutor
Executor with which to execute SQL requests.
|
Thread |
thread |
Constructor and Description |
---|
SegmentCacheManager(MondrianServer server) |
Modifier and Type | Method and Description |
---|---|
<T> T |
execute(SegmentCacheManager.Command<T> command) |
void |
externalSegmentCreated(SegmentHeader header,
MondrianServer server)
Tells the cache that a segment is newly available in an external cache.
|
void |
externalSegmentDeleted(SegmentHeader header,
MondrianServer server)
Tells the cache that a segment is no longer available in an external cache.
|
SegmentBuilder.SegmentConverter |
getConverter(RolapStar star,
SegmentHeader header) |
SegmentCacheManager.SegmentCacheIndexRegistry |
getIndexRegistry() |
boolean |
loadCacheForStar(RolapStar star)
Load external cached elements for received star.
|
void |
loadFailed(RolapStar star,
SegmentHeader header,
Throwable throwable)
Informs cache manager that a segment load failed.
|
void |
loadSucceeded(RolapStar star,
SegmentHeader header,
SegmentBody body)
Adds a segment to segment index.
|
SegmentWithData |
peek(CellRequest request)
Makes a quick request to the aggregation manager to see whether the cell value required by a particular cell
request is in external cache.
|
void |
printCacheState(CacheControl.CellRegion region,
PrintWriter pw,
Locus locus) |
void |
remove(RolapStar star,
SegmentHeader header)
Removes a segment from segment index.
|
void |
shutdown()
Shuts down this cache manager and all active threads and indexes.
|
public final Thread thread
public final ExecutorService cacheExecutor
public final ExecutorService sqlExecutor
TODO: create using factory and/or configuration parameters. Executor should be shared within MondrianServer or target JDBC database.
public final List<SegmentCacheWorker> segmentCacheWorkers
public final SegmentCache compositeCache
public SegmentCacheManager(MondrianServer server)
public boolean loadCacheForStar(RolapStar star)
externalSegmentCreated
but the index is created if not there.star
- the star for which the cache is loadedpublic <T> T execute(SegmentCacheManager.Command<T> command)
public SegmentCacheManager.SegmentCacheIndexRegistry getIndexRegistry()
public void loadSucceeded(RolapStar star, SegmentHeader header, SegmentBody body)
Called when a SQL statement has finished loading a segment.
Does not add the segment to the external cache. That is a potentially long-duration operation, better carried out by a worker.
header
- segment headerbody
- segment bodypublic void loadFailed(RolapStar star, SegmentHeader header, Throwable throwable)
Called when a SQL statement receives an error while loading a segment.
header
- segment headerthrowable
- Errorpublic void remove(RolapStar star, SegmentHeader header)
Call is asynchronous. It comes back immediately.
Does not remove it from the external cache.
header
- segment headerpublic void externalSegmentCreated(SegmentHeader header, MondrianServer server)
public void externalSegmentDeleted(SegmentHeader header, MondrianServer server)
public void printCacheState(CacheControl.CellRegion region, PrintWriter pw, Locus locus)
public void shutdown()
public SegmentBuilder.SegmentConverter getConverter(RolapStar star, SegmentHeader header)
public SegmentWithData peek(CellRequest request)
'Quick' is relative. It is an asynchronous request (due to the aggregation manager being an actor) and therefore somewhat slow. If the segment is in cache, will save batching up future requests and re-executing the query. Win should be particularly noticeable for queries running on a populated cache. Without this feature, every query would require at least two iterations.
Request does not issue SQL to populate the segment. Nor does it try to find existing segments for rollup. Those operations can wait until next phase.
Client is responsible for adding the segment to its private cache.
request
- Cell requestCopyright © 2020 Hitachi Vantara. All rights reserved.