// TODO: Obviate this comment by doing all of this in batch.
// Writes the ID mapping first: if the hash table write fails, we just lost one schema ID.
// The hash table write must not happen before the ID table write has been persisted.
// Otherwise, another client may see the hash entry, write cells with the schema ID that cannot
// be decoded (since the ID mapping has not been written yet).
final ResultSet resultSet = mAdmin.execute(
mPreparedStatementWriteIdTable.bind(
avroEntry.getId(),
new Date(timestamp),
ByteBuffer.wrap(entryBytes))
);
Preconditions.checkNotNull(resultSet);
// TODO: Anything here to flush the table or verify that this worked?
//if (flush) { mSchemaIdTable.flushCommits(); }
final ResultSet hashResultSet =
mAdmin.execute(
mPreparedStatementWriteHashTable.bind(
ByteBuffer.wrap(avroEntry.getHash().bytes()),
new Date(timestamp),
ByteBuffer.wrap(entryBytes))