microsoft / kafka-connect-cosmosdb

Kafka Connect connectors for Azure Cosmos DB
MIT License
51 stars 55 forks source link

MoveLeaseContainerCreationIntoConnector #561

Closed xinlian12 closed 8 months ago

xinlian12 commented 8 months ago

Issue: For source connector, when configured with maxTasks > 1, only 1 tasks will run successfully, others will fail.

Root cause: currently when there are multiple tasks configured, all of them will try to create the lease container, but only 1 will succeeded, others will fail.

Fixes: Move the lease container creation into CosmosDBSourceConnector

Other changes included: During task.stop(), adding some delays for closing cosmosClient as the PartitionProcessor will release the leases in the background.