Skip to content

feat(queue/sql): add MySQL schema and configuration#20

Merged
behinddwalls merged 1 commit into
mainfrom
sql-queue-schema-config
Feb 20, 2026
Merged

feat(queue/sql): add MySQL schema and configuration#20
behinddwalls merged 1 commit into
mainfrom
sql-queue-schema-config

Conversation

@behinddwalls
Copy link
Copy Markdown
Collaborator

@behinddwalls behinddwalls commented Feb 17, 2026

Summary

Why?

Need database schema and configuration for SQL-based queue implementation to support distributed message processing.

What?

  • MySQL schema with 4 tables: messages, offsets, partition leases, and DLQ
  • Configuration struct with validation for consumer groups, timeouts, and retry policies
  • Bazel build integration

Test Plan

  • Config validation tests pass
  • Default config values are correct
  • Invalid configs are rejected appropriately

Issues

Stack

  1. @ feat(queue/sql): add MySQL schema and configuration #20
  2. feat(queue/sql): add publisher implementation #22

@behinddwalls behinddwalls requested review from a team and sbalabanov as code owners February 17, 2026 04:59
@behinddwalls behinddwalls changed the base branch from chore-claude-add-claude to sql-queue-rfc February 17, 2026 07:28
@behinddwalls behinddwalls force-pushed the sql-queue-schema-config branch from 3477145 to f312df5 Compare February 17, 2026 07:28
@behinddwalls behinddwalls force-pushed the sql-queue-schema-config branch from f312df5 to 38c7cf2 Compare February 17, 2026 07:55
@behinddwalls behinddwalls force-pushed the sql-queue-schema-config branch from 38c7cf2 to 73e753a Compare February 17, 2026 22:19
@behinddwalls behinddwalls force-pushed the sql-queue-schema-config branch 2 times, most recently from 825992e to e8b1a30 Compare February 19, 2026 03:29
@behinddwalls behinddwalls force-pushed the sql-queue-schema-config branch 2 times, most recently from c4c3fe6 to 454d92d Compare February 19, 2026 04:27
@behinddwalls behinddwalls changed the base branch from sql-queue-rfc to main February 19, 2026 04:30
@behinddwalls behinddwalls enabled auto-merge (squash) February 19, 2026 04:35
@behinddwalls behinddwalls force-pushed the sql-queue-schema-config branch from 454d92d to 7dcf5fb Compare February 19, 2026 04:51
@sbalabanov
Copy link
Copy Markdown
Contributor

Have we tried an existing oss solution (queue over mysql) first?

Comment thread extensions/queue/sql/schema/queue_dlq.sql Outdated

-- Indexes optimized for partition-based queries with visibility
INDEX idx_topic_partition_visible_offset (topic, partition_key, invisible_until, offset),
UNIQUE KEY idx_topic_partition_id (topic, partition_key, id)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be primary key instead?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

offset is the primary which is easier to reason it seems as per AI, primarily how it auto-increments and avoids page fragmentation, so having this secondary index is not too bad for this table.

Comment thread extensions/queue/sql/schema/queue_messages.sql
err := tt.config.Validate()
if tt.expectError {
require.Error(t, err)
assert.Contains(t, err.Error(), tt.errorMsg)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI likes to generate string comparisons for error instead of error types (because typically there are no error types); I think this is a bad practice that makes tests fragile.
Just asserting the error is usually ok; when required by code flow, can dedicate an error type and use Is/As semantics.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it sort of validate which error is being returned and not short-circuiting due to any other errors in the call chain

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If error message is not part of the protocol, this makes test fragile to changes for not reason dictated by a change.
If it is part of the protocol, the general convention is for it to be anywhere in the chain and discoverable with errors.Is/errors.As, and I believe the test should follow the convention.

Comment thread extensions/queue/sql/config_test.go Outdated
}
}

func TestTableConstants(t *testing.T) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a change detector test

## Why?
Need database schema and configuration for SQL-based queue implementation to support distributed message processing.

## What?
- MySQL schema with 4 tables: messages, offsets, partition leases, and DLQ
- Configuration struct with validation for consumer groups, timeouts, and retry policies
- Bazel build integration

## Test Plan
- Config validation tests pass
- Default config values are correct
- Invalid configs are rejected appropriately
Copy link
Copy Markdown
Contributor

@sbalabanov sbalabanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepting, but very opinionated that assert.Contains should not be used - can this be removed?

err := tt.config.Validate()
if tt.expectError {
require.Error(t, err)
assert.Contains(t, err.Error(), tt.errorMsg)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If error message is not part of the protocol, this makes test fragile to changes for not reason dictated by a change.
If it is part of the protocol, the general convention is for it to be anywhere in the chain and discoverable with errors.Is/errors.As, and I believe the test should follow the convention.

@behinddwalls behinddwalls merged commit d9d5f3b into main Feb 20, 2026
1 check passed
@behinddwalls behinddwalls deleted the sql-queue-schema-config branch February 20, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants