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

ssue when kafka connect worker pod restart, during creation of nested partition directories in hdfs file system.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • None
    • None
    • connect
    • None

    Description

      In our production labs, an issue is observed. Below is the sequence of the same.

      1. hdfs connector is added to the connect worker.
      2. hdfs connector is creating folders in hdfs /test1=1/test2=2/
        Based on the custom partitioner. Here test1 and test2 are two separate nested directories derived from multiple fields in the record using a custom partitioner.
      3. Now kafka connect hdfs connector uses below function calls to create the directories in the hdfs file system.
        fs.mkdirs(new Path(filename));
        ref: https://github.com/confluentinc/kafka-connect-hdfs/blob/master/src/main/java/io/confluent/connect/hdfs/storage/HdfsStorage.java

      Now the important thing to note is that if mkdirs() is a non atomic operation (i.e can result in partial execution if interrupted)
      then suppose the first directory ie test1 is created and just before creation of test2 in hdfs happens if there is a restart to the connect worker pod. Then the hdfs file system will remain with partial folders created for partitions during the restart time frames.

      So we might have conditions in hdfs as below
      /test1=0/test2=0/
      /test1=1/
      /test1=2/test2=2
      /test1=3/test2=3

      So the second partition has a missing directory in it. And if hive integration is enabled, hive metastore exceptions will occur since there is a partition expected from hive table is missing for few partitions in hdfs.

      This can occur to any connector with some ongoing non atomic operation and a restart is triggered to kafka connect worker pod. This will result in some partially completed states in the system and may cause issues for the connector to continue its operation.

      This is a very critical issue and needs some attention on ways for handling the same.

      Attachments

        Activity

          People

            Unassigned Unassigned
            kaushik srinivas kaushik srinivas
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: