|
16 | 16 | */
|
17 | 17 | package com.netflix.hollow.core.write;
|
18 | 18 |
|
| 19 | +import com.netflix.hollow.core.index.FieldPaths; |
19 | 20 | import com.netflix.hollow.core.memory.ByteData;
|
20 | 21 | import com.netflix.hollow.core.memory.ByteDataArray;
|
21 | 22 | import com.netflix.hollow.core.memory.ThreadSafeBitSet;
|
|
26 | 27 | import com.netflix.hollow.core.schema.HollowMapSchema;
|
27 | 28 | import java.io.DataOutputStream;
|
28 | 29 | import java.io.IOException;
|
| 30 | +import java.util.logging.Level; |
| 31 | +import java.util.logging.Logger; |
| 32 | + |
| 33 | +import static com.netflix.hollow.core.index.FieldPaths.FieldPathException.ErrorKind.NOT_BINDABLE; |
29 | 34 |
|
30 | 35 | public class HollowMapTypeWriteState extends HollowTypeWriteState {
|
| 36 | + private static final Logger LOG = Logger.getLogger(HollowMapTypeWriteState.class.getName()); |
31 | 37 |
|
32 | 38 | /// statistics required for writing fixed length set data
|
33 | 39 | private int bitsPerMapPointer;
|
@@ -212,9 +218,19 @@ public void calculateSnapshot() {
|
212 | 218 |
|
213 | 219 | HollowWriteStateEnginePrimaryKeyHasher primaryKeyHasher = null;
|
214 | 220 |
|
215 |
| - if(getSchema().getHashKey() != null) |
216 |
| - primaryKeyHasher = new HollowWriteStateEnginePrimaryKeyHasher(getSchema().getHashKey(), getStateEngine()); |
217 |
| - |
| 221 | + if(getSchema().getHashKey() != null) { |
| 222 | + try { |
| 223 | + primaryKeyHasher = new HollowWriteStateEnginePrimaryKeyHasher(getSchema().getHashKey(), getStateEngine()); |
| 224 | + } catch (FieldPaths.FieldPathException e) { |
| 225 | + if (e.error == NOT_BINDABLE) { |
| 226 | + LOG.log(Level.WARNING, "Failed to create a key hasher for " + getSchema().getHashKey() + |
| 227 | + " because a field could not be bound to a type in the state"); |
| 228 | + } else { |
| 229 | + throw e; |
| 230 | + } |
| 231 | + } |
| 232 | + } |
| 233 | + |
218 | 234 | for(int ordinal=0;ordinal<=maxOrdinal;ordinal++) {
|
219 | 235 | int shardNumber = ordinal & shardMask;
|
220 | 236 | int shardOrdinal = ordinal / numShards;
|
@@ -378,8 +394,18 @@ private void calculateDelta(ThreadSafeBitSet fromCyclePopulated, ThreadSafeBitSe
|
378 | 394 |
|
379 | 395 | HollowWriteStateEnginePrimaryKeyHasher primaryKeyHasher = null;
|
380 | 396 |
|
381 |
| - if(getSchema().getHashKey() != null) |
382 |
| - primaryKeyHasher = new HollowWriteStateEnginePrimaryKeyHasher(getSchema().getHashKey(), getStateEngine()); |
| 397 | + if(getSchema().getHashKey() != null) { |
| 398 | + try { |
| 399 | + primaryKeyHasher = new HollowWriteStateEnginePrimaryKeyHasher(getSchema().getHashKey(), getStateEngine()); |
| 400 | + } catch (FieldPaths.FieldPathException e) { |
| 401 | + if (e.error == NOT_BINDABLE) { |
| 402 | + LOG.log(Level.WARNING, "Failed to create a key hasher for " + getSchema().getHashKey() + |
| 403 | + " because a field could not be bound to a type in the state"); |
| 404 | + } else { |
| 405 | + throw e; |
| 406 | + } |
| 407 | + } |
| 408 | + } |
383 | 409 |
|
384 | 410 | for(int ordinal=0;ordinal<=maxOrdinal;ordinal++) {
|
385 | 411 | int shardNumber = ordinal & shardMask;
|
|
0 commit comments