Class NoopSegmentSchemaCache
java.lang.Object
org.apache.druid.segment.metadata.SegmentSchemaCache
org.apache.druid.segment.metadata.NoopSegmentSchemaCache
No-op implementation of
SegmentSchemaCache that always returns false
for isEnabled() and isInitialized().-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRealtimeSegmentSchema(SegmentId segmentId, SchemaPayloadPlus schema) Adds schema for a realtime segment to the cache.voidaddSchemaPendingBackfill(SegmentId segmentId, SchemaPayloadPlus schema) Adds a temporary schema for the given segment ID to the cache.voidCoordinatorSegmentMetadataCachestartup waits on the cache initialization.getStats()booleanbooleanbooleanisSchemaCached(SegmentId segmentId) Check if the cache contains schema for the given segment ID.voidmarkSchemaPersisted(SegmentId segmentId) Marks the schema for the given segment ID as persisted to the DB.voidThis method is called when the current node is no longer the leader.voidrealtimeSegmentRemoved(SegmentId segmentId) Removes schema for realtime segment.voidresetSchemaForPublishedSegments(Map<SegmentId, SegmentMetadata> usedSegmentIdToMetadata, Map<String, SchemaPayload> schemaFingerprintToPayload) Resets the schema in the cache for published (non-realtime) segments.voidsegmentRemoved(SegmentId segmentId) Removes schema cached for this segment ID.voidMethods inherited from class org.apache.druid.segment.metadata.SegmentSchemaCache
getSchemaForSegment
-
Constructor Details
-
NoopSegmentSchemaCache
public NoopSegmentSchemaCache()
-
-
Method Details
-
isEnabled
public boolean isEnabled()- Overrides:
isEnabledin classSegmentSchemaCache- Returns:
- true if schema caching is enabled.
-
setInitialized
public void setInitialized()- Overrides:
setInitializedin classSegmentSchemaCache
-
onLeaderStop
public void onLeaderStop()Description copied from class:SegmentSchemaCacheThis method is called when the current node is no longer the leader. The schema is cleared except forrealtimeSegmentSchemaMap. Realtime schema continues to be updated on both the leader and follower nodes.- Overrides:
onLeaderStopin classSegmentSchemaCache
-
isInitialized
public boolean isInitialized()- Overrides:
isInitializedin classSegmentSchemaCache
-
awaitInitialization
Description copied from class:SegmentSchemaCacheCoordinatorSegmentMetadataCachestartup waits on the cache initialization. This is being done to ensure that we don't execute metadata query for segment with schema already present in the DB.- Overrides:
awaitInitializationin classSegmentSchemaCache- Throws:
InterruptedException
-
resetSchemaForPublishedSegments
public void resetSchemaForPublishedSegments(Map<SegmentId, SegmentMetadata> usedSegmentIdToMetadata, Map<String, SchemaPayload> schemaFingerprintToPayload) Description copied from class:SegmentSchemaCacheResets the schema in the cache for published (non-realtime) segments. This method is called after each successful poll of used segments and schemas from the metadata store.- Overrides:
resetSchemaForPublishedSegmentsin classSegmentSchemaCache- Parameters:
usedSegmentIdToMetadata- Map from used segment ID to corresponding metadataschemaFingerprintToPayload- Map from schema fingerprint to payload
-
addRealtimeSegmentSchema
Description copied from class:SegmentSchemaCacheAdds schema for a realtime segment to the cache.- Overrides:
addRealtimeSegmentSchemain classSegmentSchemaCache
-
addSchemaPendingBackfill
Description copied from class:SegmentSchemaCacheAdds a temporary schema for the given segment ID to the cache. This schema is typically fetched from data nodes by issuing segment metadata queries. Once this schema is persisted to DB, callSegmentSchemaCache.markSchemaPersisted(org.apache.druid.timeline.SegmentId).- Overrides:
addSchemaPendingBackfillin classSegmentSchemaCache
-
markSchemaPersisted
Description copied from class:SegmentSchemaCacheMarks the schema for the given segment ID as persisted to the DB.- Overrides:
markSchemaPersistedin classSegmentSchemaCache
-
getPublishedSegmentMetadataMap
- Overrides:
getPublishedSegmentMetadataMapin classSegmentSchemaCache- Returns:
- Immutable map from segment ID to
SegmentMetadatafor all published used segments currently present in this cache.
-
isSchemaCached
Description copied from class:SegmentSchemaCacheCheck if the cache contains schema for the given segment ID.- Overrides:
isSchemaCachedin classSegmentSchemaCache
-
getPublishedSchemaPayloadMap
- Overrides:
getPublishedSchemaPayloadMapin classSegmentSchemaCache- Returns:
- Immutable map from schema fingerprint to
SchemaPayloadfor all schema fingerprints currently present in this cache.
-
segmentRemoved
Description copied from class:SegmentSchemaCacheRemoves schema cached for this segment ID.- Overrides:
segmentRemovedin classSegmentSchemaCache
-
realtimeSegmentRemoved
Description copied from class:SegmentSchemaCacheRemoves schema for realtime segment.- Overrides:
realtimeSegmentRemovedin classSegmentSchemaCache
-
getStats
- Overrides:
getStatsin classSegmentSchemaCache- Returns:
- Summary stats of the current contents of the cache.
-