/** {@inheritDoc} */ @Override public boolean equals(Object other) { if (!(other instanceof SchemaEntry)) { return false; } final SchemaEntry entry = (SchemaEntry) other; return (this.mId == entry.mId) && (this.mHash.equals(entry.mHash)) && (this.mSchema.equals(entry.mSchema)); }
/** {@inheritDoc} */ @Override public synchronized SchemaEntry getSchemaEntry(BytesKey schemaHash) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot get schema entry from SchemaTable instance in state %s.", state); final SchemaEntry existingEntry = mSchemaHashMap.get(schemaHash); if (existingEntry != null) { return existingEntry; } // On a lookup miss from the local schema cache, check to see if we can get the schema // from the original HBase table, cache it locally, and return it. final SchemaTableEntry avroEntry = loadFromHashTable(schemaHash); if (null == avroEntry) { return null; } final SchemaEntry entry = storeInMemory(avroEntry); Preconditions.checkState(schemaHash.equals(entry.getHash())); return entry; }
/** {@inheritDoc} */ @Override public SchemaEntry getSchemaEntry(BytesKey schemaHash) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot get schema entry from SchemaTable instance in state %s.", state); SchemaEntry existingEntry = mSchemaHashMap.get(schemaHash); if (existingEntry != null) { return existingEntry; } synchronized (this) { existingEntry = mSchemaHashMap.get(schemaHash); if (existingEntry != null) { return existingEntry; } // On a lookup miss from the local schema cache, check to see if we can get the schema // from the schema hash table, cache it locally, and return it. final SchemaTableEntry avroEntry = loadFromHashTable(schemaHash); if (null == avroEntry) { return null; } final SchemaEntry entry = storeInMemory(fromAvroEntry(avroEntry)); Preconditions.checkState(schemaHash.equals(entry.getHash())); return entry; } }
final SchemaEntry entry = fromAvroEntry(decodeSchemaEntry(keyValue.getValue())); entries.add(entry); if (!getSchemaHash(entry.getSchema()).equals(entry.getHash())) { LOG.error(String.format( "Invalid schema hash table entry: computed schema hash %s does not match entry %s", getSchemaHash(entry.getSchema()), entry)); if (!rowKey.equals(entry.getHash())) { LOG.error(String.format("Inconsistent schema hash table: " + "hash encoded in row key %s does not match schema entry: %s",
if (existingEntryWithHash.getHash().equals(entry.getHash()) && existingEntryWithHash.getSchema().equals(entry.getSchema())) {
final SchemaEntry entry = fromAvroEntry(decodeSchemaEntry(keyValue.getValue())); entries.add(entry); if (!getSchemaHash(entry.getSchema()).equals(entry.getHash())) { LOG.error(String.format("Invalid schema hash table entry with row key %s: " + "computed schema hash %s does not match entry %s",
final SchemaEntry entry = fromAvroEntry(decodeSchemaEntry(schemaAsBytes)); entries.add(entry); if (!getSchemaHash(entry.getSchema()).equals(entry.getHash())) { LOG.error("Invalid schema hash table entry with row key {}: " + "computed schema hash {} does not match entry {}.",
if (existingEntryWithHash.getHash().equals(entry.getHash()) && existingEntryWithHash.getSchema().equals(entry.getSchema())) {
final SchemaEntry entry = fromAvroEntry(decodeSchemaEntry(schemaAsBytes)); entries.add(entry); if (!getSchemaHash(entry.getSchema()).equals(entry.getHash())) { LOG.error( "Invalid schema hash table entry: computed schema hash {} does not match entry {}.", getSchemaHash(entry.getSchema()), entry); if (!rowKey.equals(entry.getHash())) { LOG.error( "Inconsistent schema hash table: hash encoded in row key {}"