Source:
<code>public HdfsWriter(HdfsSinkConnectorConfig connectorConfig, SinkTaskContext context, AvroData avroData) { try { writers = new HashMap<>(); wals = new HashMap<>(); offsets = new HashMap<>(); recordCounters = new HashMap<>(); tempFileNames = new HashMap<>(); flushSize = connectorConfig.getInt(HdfsSinkConnectorConfig.FLUSH_SIZE_CONFIG); backOffMs = connectorConfig.getLong(HdfsSinkConnectorConfig.RETRY_BACKOFF_CONFIG); url = connectorConfig.getString(HdfsSinkConnectorConfig.HDFS_URL_CONFIG); topicsDir = connectorConfig.getString(HdfsSinkConnectorConfig.TOPIC_DIR_CONFIG); conf = new Configuration(); Class<? extends Storage> storageClass = (Class<? extends Storage>) Class.forName(connectorConfig.getString(HdfsSinkConnectorConfig.STORAGE_CLASS_CONFIG)); this.storage = StorageFactory.createStorage(storageClass, conf, url); createTopicsDir(); writerProvider = ((Class<RecordWriterProvider>) Class.forName(connectorConfig.getString( HdfsSinkConnectorConfig.RECORD_WRITER_PROVIDER_CLASS_CONFIG))).newInstance(); this.context = context; this.assignment = context.assignment(); this.avroData = avroData; states = new HashMap<>(); for (TopicPartition tp: assignment) { <START> states.put(tp, State.RECOVERY_STARTED); <END> } buffer = new HashMap<>(); for (TopicPartition tp: assignment) { buffer.put(tp, new LinkedList<SinkRecord>()); } recovered = new HashSet<>(); } catch (IOException e) { throw new CopycatException(e); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { throw new CopycatException("RecordWriterProvider class not found", e); } }</code><technical_language>(or should) pause partitions here? this ends mattering, weird potentially get some records put() add buffer ignore want yet. again, handle uncommitted messages in buffer, difference</technical_language>

Target:
public HdfsWriter(HdfsSinkConnectorConfig connectorConfig, SinkTaskContext context, AvroData avroData) { try { writers = new HashMap<>(); wals = new HashMap<>(); offsets = new HashMap<>(); recordCounters = new HashMap<>(); tempFileNames = new HashMap<>(); flushSize = connectorConfig.getInt(HdfsSinkConnectorConfig.FLUSH_SIZE_CONFIG); backOffMs = connectorConfig.getLong(HdfsSinkConnectorConfig.RETRY_BACKOFF_CONFIG); url = connectorConfig.getString(HdfsSinkConnectorConfig.HDFS_URL_CONFIG); topicsDir = connectorConfig.getString(HdfsSinkConnectorConfig.TOPIC_DIR_CONFIG); conf = new Configuration(); Class<? extends Storage> storageClass = (Class<? extends Storage>) Class.forName(connectorConfig.getString(HdfsSinkConnectorConfig.STORAGE_CLASS_CONFIG)); this.storage = StorageFactory.createStorage(storageClass, conf, url); createTopicsDir(); writerProvider = ((Class<RecordWriterProvider>) Class.forName(connectorConfig.getString( HdfsSinkConnectorConfig.RECORD_WRITER_PROVIDER_CLASS_CONFIG))).newInstance(); this.context = context; this.assignment = context.assignment(); this.avroData = avroData; states = new HashMap<>(); for (TopicPartition tp: assignment) { states.put(tp, State.RECOVERY_STARTED); } buffer = new HashMap<>(); for (TopicPartition tp: assignment) { buffer.put(tp, new LinkedList<SinkRecord>()); } recovered = new HashSet<>(); lastAssignment = new HashSet<>(); failureTime = new HashMap<>(); } catch (IOException e) { throw new CopycatException(e); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { throw new CopycatException("Reflection exception: ", e); } }