Dawid Wysakowicz created FLINK-15941:
----------------------------------------
Summary: ConfluentSchemaRegistryCoder should not perform HTTP requests for all request
Key: FLINK-15941
URL:
https://issues.apache.org/jira/browse/FLINK-15941 Project: Flink
Issue Type: Improvement
Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
Reporter: Dawid Wysakowicz
ConfluentSchemaRegistryCoder should cache ids of schemas that it has already seen.
I think it should be as simple as changing
{code}
@Override
public void writeSchema(Schema schema, OutputStream out) throws IOException {
try {
int registeredId = schemaRegistryClient.register(subject, schema);
out.write(CONFLUENT_MAGIC_BYTE);
byte[] schemaIdBytes = ByteBuffer.allocate(4).putInt(registeredId).array();
out.write(schemaIdBytes);
} catch (RestClientException e) {
throw new IOException("Could not register schema in registry", e);
}
}
{code}
to
{code}
@Override
public void writeSchema(Schema schema, OutputStream out) throws IOException {
try {
int registeredId = schemaRegistryClient.getId(subject, schema);
out.write(CONFLUENT_MAGIC_BYTE);
byte[] schemaIdBytes = ByteBuffer.allocate(4).putInt(registeredId).array();
out.write(schemaIdBytes);
} catch (RestClientException e) {
throw new IOException("Could not register schema in registry", e);
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)