Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Kafka Partition Count #641

Merged

Conversation

dweinshenker
Copy link
Contributor

What

  • Changes Get/List operation responses to include partitions instead of partition_count which is used for Create/Update operations

Why

The API response from Get/List includes 1 or many topics with partitions in the response rather than partition_count. partition_count is used when creating the topic, but the response from the API should include the list of partitions that are created.

https://docs.digitalocean.com/reference/api/api-reference/#operation/databases_get_kafka_topic

An example response from the API is included below:

{
    "topic": {
        "name": "test-topic-1",
        "partitions": [
            {
                "size": 4096,
                "id": 0,
                "in_sync_replicas": 2,
                "earliest_offset": 0,
                "consumer_groups": null
            },
            {
                "size": 4096,
                "id": 2,
                "in_sync_replicas": 2,
                "earliest_offset": 0,
                "consumer_groups": null
            },
            {
                "size": 4096,
                "id": 1,
                "in_sync_replicas": 2,
                "earliest_offset": 0,
                "consumer_groups": null
            }
        ],
        "replication_factor": 2,
        "state": "active",
        "config": {
            "cleanup_policy": "delete",
            "compression_type": "producer",
            "delete_retention_ms": 86400000,
            "file_delete_delay_ms": 60000,
            "flush_messages": 9223372036854775807,
            "flush_ms": 9223372036854775807,
            "index_interval_bytes": 4096,
            "max_compaction_lag_ms": 9223372036854775807,
            "max_message_bytes": 1048588,
            "message_down_conversion_enable": true,
            "message_format_version": "3.0-IV1",
            "message_timestamp_difference_max_ms": 9223372036854775807,
            "message_timestamp_type": "create_time",
            "min_cleanable_dirty_ratio": 0.5,
            "min_compaction_lag_ms": 0,
            "min_insync_replicas": 1,
            "preallocate": false,
            "retention_bytes": -1,
            "retention_ms": 604800000,
            "segment_bytes": 209715200,
            "segment_index_bytes": 10485760,
            "segment_jitter_ms": 0,
            "segment_ms": 604800000,
            "unclean_leader_election_enable": false
        }
    }
}

- addresses `partitions` being returned by API Get/List operations instead of `partition_count` which is used for Create/Update operations
@dweinshenker dweinshenker marked this pull request as ready for review October 11, 2023 23:23
databases.go Show resolved Hide resolved
Copy link
Member

@andrewsomething andrewsomething left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@andrewsomething andrewsomething merged commit 96b0f34 into digitalocean:main Oct 16, 2023
7 checks passed
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