kriti-sc opened a new issue, #3168:
URL: https://github.com/apache/iggy/issues/3168

   ### Bug description
   
   In `core/connectors/sdk/src/sink.rs`, the `sink_connector!` macro expands 
`iggy_sink_open` to unconditionally overwrite any existing entry in `INSTANCES`:
   
   ```
   let mut container = SinkContainer::new(id);
   let result = container.open(id, config_ptr, config_len, log_callback, 
<$type>::new);
   INSTANCES.insert(id, container);  // silently overwrites if id already exists
   ```
   
   If `iggy_sink_open` is called twice with the same `id`, the previous 
`SinkContainer` is dropped without `close()` being called. For sinks with 
buffered state (e.g. `DeltaSink`, which buffers records in a `JsonWriter` 
before flushing to the Delta log), any unflushed records are silently discarded.
   
   The runtime doesn't currently double-open, but the macro is the public SDK 
contract and this is a latent data loss bug for any sink with real buffered 
state.
   
   The same pattern exists in `source_connector!` 
(`core/connectors/sdk/src/source.rs`) and should be fixed there too, though 
sources currently have no equivalent buffered-state risk.
   
   ### Deployment
   
   None
   
   ### Versions
   
   _No response_
   
   ### Hardware / environment
   
   _No response_
   
   ### Sample code
   
   _No response_
   
   ### Logs
   
   _No response_
   
   ### Iggy server config
   
   _No response_
   
   ### Reproduction
   
   _No response_


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to