Class SegmentSchemaManager
java.lang.Object
org.apache.druid.segment.metadata.SegmentSchemaManager
Handles segment schema persistence and cleanup on the Coordinator.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classWrapper overSchemaPayloadPlusclass to include segmentId and fingerprint information. -
Constructor Summary
ConstructorsConstructorDescriptionSegmentSchemaManager(MetadataStorageTablesConfig dbTables, com.fasterxml.jackson.databind.ObjectMapper jsonMapper, SQLMetadataConnector connector) -
Method Summary
Modifier and TypeMethodDescriptionintdeleteSchemasOlderThan(long timestamp) Finds all schema fingerprints which have been marked as unused but are still referenced by some used segments.intmarkSchemaAsUsed(List<String> schemaFingerprints) Marks the segment schema entries for the given fingerprints as used.intvoidpersistSchemaAndUpdateSegmentsTable(String dataSource, List<SegmentSchemaManager.SegmentSchemaMetadataPlus> segmentSchemas, int version) Persist segment schema and update segments in a transaction.voidpersistSegmentSchema(org.skife.jdbi.v2.Handle handle, String dataSource, int version, Map<String, SchemaPayload> fingerprintSchemaPayloadMap, org.joda.time.DateTime updateTime) Persist unique segment schema in the DB.voidupdateSegmentWithSchemaInformation(org.skife.jdbi.v2.Handle handle, List<SegmentSchemaManager.SegmentSchemaMetadataPlus> batch, org.joda.time.DateTime updateTime) Update segment with schemaFingerprint and numRows information.
-
Constructor Details
-
SegmentSchemaManager
@Inject public SegmentSchemaManager(MetadataStorageTablesConfig dbTables, com.fasterxml.jackson.databind.ObjectMapper jsonMapper, SQLMetadataConnector connector)
-
-
Method Details
-
findReferencedSchemaMarkedAsUnused
Finds all schema fingerprints which have been marked as unused but are still referenced by some used segments.- Returns:
- Empty list if no such schema fingerprint exists.
-
markSchemaAsUsed
Marks the segment schema entries for the given fingerprints as used.- Parameters:
schemaFingerprints- List of fingerprints to mark as used- Returns:
- Number of rows updated in the metadata store.
-
deleteSchemasOlderThan
public int deleteSchemasOlderThan(long timestamp) -
markUnreferencedSchemasAsUnused
public int markUnreferencedSchemasAsUnused() -
persistSchemaAndUpdateSegmentsTable
public void persistSchemaAndUpdateSegmentsTable(String dataSource, List<SegmentSchemaManager.SegmentSchemaMetadataPlus> segmentSchemas, int version) Persist segment schema and update segments in a transaction. -
persistSegmentSchema
public void persistSegmentSchema(org.skife.jdbi.v2.Handle handle, String dataSource, int version, Map<String, SchemaPayload> fingerprintSchemaPayloadMap, org.joda.time.DateTime updateTime) throws com.fasterxml.jackson.core.JsonProcessingExceptionPersist unique segment schema in the DB.- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
updateSegmentWithSchemaInformation
public void updateSegmentWithSchemaInformation(org.skife.jdbi.v2.Handle handle, List<SegmentSchemaManager.SegmentSchemaMetadataPlus> batch, org.joda.time.DateTime updateTime) Update segment with schemaFingerprint and numRows information.
-