As it arrives in your log or error chain — example values stand where yours will:
compaction head not found: schema "sqlstreams", stream "orders.created", stream_id 1, message_key "order-214" -- produce under message key "order-214" on stream "orders.created" with CompactionOptions.Enable set [SQL0066]
The key has no materialized compaction head. LockCompactionHead may have
created a compaction_head row whose head fields are NULL; ordinary reads
deliberately treat that lock-only row like no row. A head exists only once a
message produced under the key opts into compaction, so a key that has never
been produced under and a key whose messages all left
MessageOptions.Compaction unset look the same here.
The second diagnose query tells them apart: rows with a NULL
compaction_rank were produced under the key without compaction.
Client.Stream(name).Key(key).Messages reads the same rows from Go, and
returns them whether or not a head exists.
produce under message key "{message_key}" on stream "{stream}" with CompactionOptions.Enable set
Helpful info.
the key's compaction_head row, if one exists
SELECT compaction_key, message_id, schema_version, compaction_rank FROM {schema}.compaction_head_{stream_id} WHERE compaction_key = '{message_key}';
the messages produced under the key -- a NULL compaction_rank never opted into compaction
SELECT id, schema_version, compaction_rank, created_at FROM {schema}.message_log_{stream_id} WHERE message_key = '{message_key}' ORDER BY id DESC LIMIT 20;
Looking for a different code? Search every thread.