Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-8819

Plugin path for converters not working as intended




      KafakConnect allows all plugins to be available via a plugin path mechanism. This allows for classpath isolation. This is not working as designed under the following circumstances for Converters


      I have 2 directories under plugin path `connector1` and `connector2`. I intend to use AvroConverter and its available in both the plugin directories. Under these circumstances, the Worker attempts to create the Converter available in the plugin director first which should ideally be deterministic but it's not because of the following reasons:-


      https://github.com/apache/kafka/blob/aa4ba8eee8e6f52a9d80a98fb2530b5bcc1b9a11/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/Worker.java#L421 would lead to all configs of type Class to be loaded and this would mean that they are not loaded in the context of the connectors plugin loader. IIUC, the current loaded would be the DelegatingClassLoader. This would mean that the AvroConverter could potentially be loaded from connector2 plugin path while loading the class. This should be made deterministic as intended. i.e. if a Converter class is in the connector's plugin path that should be given the first priority.


      The converter is created and configured with the current class loaded as the Connector's class loader. This will not work if the converter uses reflection or other mechanisms like ServiceLoader in its constructor or configure method. Considering that the current class loader should be set to the Converter's class loaded while doing these operations. 


        Issue Links



              gharris1727 Greg Harris
              mageshn Magesh kumar Nandakumar
              Randall Hauch Randall Hauch
              0 Vote for this issue
              3 Start watching this issue