diff --git a/hollow/src/main/java/com/netflix/hollow/api/producer/HollowIncrementalCyclePopulator.java b/hollow/src/main/java/com/netflix/hollow/api/producer/HollowIncrementalCyclePopulator.java index 554f9847c..af9c4719c 100644 --- a/hollow/src/main/java/com/netflix/hollow/api/producer/HollowIncrementalCyclePopulator.java +++ b/hollow/src/main/java/com/netflix/hollow/api/producer/HollowIncrementalCyclePopulator.java @@ -105,6 +105,11 @@ private BitSet markTypeRecordsToRemove(HollowReadStateEngine priorStateEngine, f HollowSchema schema = priorReadState.getSchema(); int populatedOrdinals = priorReadState.getPopulatedOrdinals().length(); if(schema.getSchemaType() == HollowSchema.SchemaType.OBJECT) { + HollowObjectSchema objectSchema = (HollowObjectSchema) schema; + if (objectSchema.getPrimaryKey() == null) { + throw new IllegalArgumentException("Type " + type + " does not have a primary key defined"); + } + final HollowPrimaryKeyIndex idx = new HollowPrimaryKeyIndex(priorStateEngine, ((HollowObjectSchema) schema).getPrimaryKey()); ///TODO: Should we scan instead? Can we create this once and do delta updates? ThreadSafeBitSet typeRecordsToRemove = new ThreadSafeBitSet(ThreadSafeBitSet.DEFAULT_LOG2_SEGMENT_SIZE_IN_BITS, populatedOrdinals);