jiazhai opened a new issue #3925: Meet schema error while using debezium source.
URL: https://github.com/apache/pulsar/issues/3925
 
 
   **Describe the bug**
   If a debezium source connector stop and start again. the internal 
PulsarSink's schema type is changed.
   
   In PulsarSink.open(), the schema is changed while restart the source.
   Add a log after initializeSchema(): 
   ```
       public void open(Map<String, Object> config, SinkContext sinkContext) 
throws Exception {
           log.info("Opening pulsar sink with config: {}", pulsarSinkConfig);
          Schema<T> schema = initializeSchema();
          log.error("++++ schemainfo: name:{}, type:{}, string:{}", 
info.getName(), info.getType(), info.toString())
   ```
   Here is the log of first run, the schema is KeyValue schema, which is right.
   ```
    17:11:31.557 [public/default/debezium-postgres-source-0] INFO  
org.apache.pulsar.functions.sink.PulsarSink - Opening pulsar sink with config: 
PulsarSinkConfig(processingGuarantees=ATLEAST_ONCE,        
topic=debezium-postgres-topic, serdeClassName=null, schemaType=null, 
typeClassName=org.apache.pulsar.common.schema.KeyValue)
    17:11:31.707 [pulsar-client-io-1-1] INFO  
org.apache.pulsar.client.impl.ConnectionPool - [[id: 0x4b095a03, 
L:/127.0.0.1:49721 - R:localhost/127.0.0.1:6650]] Connected to server
    17:11:31.731 [public/default/debezium-postgres-source-0] ERROR 
org.apache.pulsar.functions.sink.PulsarSink - ++++ schemainfo: name:KeyValue, 
type:KEY_VALUE, string:SchemaInfo(name=KeyValue,            schema=[0, 0, 0, 0, 
0, 0, 0, 0], type=KEY_VALUE, properties={})
   ```
   Here is the log of second run, get a wrong Bytes Schema:
   ```
   17:16:31.409 [public/default/debezium-postgres-source-0] INFO  
org.apache.pulsar.functions.sink.PulsarSink - Opening pulsar sink with config: 
PulsarSinkConfig(processingGuarantees=ATLEAST_ONCE,        
topic=debezium-postgres-topic, serdeClassName=null, schemaType=null, 
typeClassName=org.apache.pulsar.common.schema.KeyValue)
    17:16:31.526 [pulsar-client-io-1-1] INFO  
org.apache.pulsar.client.impl.ConnectionPool - [[id: 0x4519d8a5, 
L:/127.0.0.1:50018 - R:localhost/127.0.0.1:6650]] Connected to server
    17:16:31.547 [public/default/debezium-postgres-source-0] ERROR 
org.apache.pulsar.functions.sink.PulsarSink - ++++ schemainfo: name:Bytes, 
type:BYTES, string:SchemaInfo(name=Bytes, schema=[],           type=BYTES, 
properties={})
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to