- Notifications
You must be signed in to change notification settings - Fork 935
Closed
Labels
component:schema-registryAny schema registry related isues rather than kafka isolated onesAny schema registry related isues rather than kafka isolated ones
Description
Description
Attempting to hard-delete a subject that has been soft-deleted ends up throwing a 404 error and will never execute the hard-delete API call.
How to reproduce
- Register schema to Schema Registry
- Soft-delete the subject we just registered
- Attempt to programmatically hard-delete the subject using SchemaRegistryClient.delete_subject
Schema Registry returns the follow error
Traceback (most recent call last): File "/Users/user/confluent-kafka-python-error.py", line 28, in <module> client.delete_subject(subject, permanent=True) File "/Users/user/venv/lib/python3.7/site-packages/confluent_kafka/schema_registry/schema_registry_client.py", line 462, in delete_subject .format(_urlencode(subject_name))) File "/Users/user/venv/lib/python3.7/site-packages/confluent_kafka/schema_registry/schema_registry_client.py", line 130, in delete return self.send_request(url, method='DELETE') File "/Users/user/venv/lib/python3.7/site-packages/confluent_kafka/schema_registry/schema_registry_client.py", line 176, in send_request response.json().get('message')) confluent_kafka.schema_registry.error.SchemaRegistryError: Subject 'lorem-ipsum-value' was soft deleted.Set permanent=true to delete permanently (HTTP status code 404, SR code 40404)
Repro Script
from confluent_kafka.schema_registry import Schema, SchemaRegistryClient if __name__ == '__main__': subject = 'lorem-ipsum-value' schema = """ { "namespace": "confluent.io.examples.serialization.avro", "name": "User", "type": "record", "fields": [ {"name": "name", "type": "string"}, {"name": "favorite_number", "type": "int"}, {"name": "favorite_color", "type": "string"} ] } """ client: SchemaRegistryClient = SchemaRegistryClient({'url': 'http://localhost:8081'}) # Staging: Register Schema then soft delete it client.register_schema(subject, Schema(schema_str=schema, schema_type='AVRO')) client.delete_subject(subject) # Bug: Attempt to hard-delete a subject that has been soft-deleted in the past # Throws 404 Exception by Schema Registry and it won't ever be hard-deleted client.delete_subject(subject, permanent=True) # Expected Exception # ======================= # confluent_kafka.schema_registry.error.SchemaRegistryError: Subject 'lorem-ipsum-value' was soft deleted. # Set permanent=true to delete permanently (HTTP status code 404, SR code 40404)
Checklist
Please provide the following information:
-
confluent-kafka-python and librdkafka version (
confluent_kafka.version()
andconfluent_kafka.libversion()
):-
confluent-kafka-python = ('1.6.1', 17170688)
-
Librdkafka = ('1.6.1', 17170943)
-
-
Apache Kafka broker version:
-
Client configuration:
{...}
-
Operating system: macOS Catalina (10.15.7)
-
Provide client logs (with
'debug': '..'
as necessary)- N/A
-
Provide broker log excerpts
- N/A
-
Critical issue
Metadata
Metadata
Assignees
Labels
component:schema-registryAny schema registry related isues rather than kafka isolated onesAny schema registry related isues rather than kafka isolated ones