Just want to know if someone already get some issues with changeFeedWorker after that cosmos db reach 50Gb size limit for one partition and automatically split it into 2 partitions.

Since this split we have observed that after adding many new items to the db, changefeedworkers was not always triggered and our view that should get changes is partially updated.

In the lease container we can see now that we moved to 2 "LeaseToken" (1 and 2) was 0 before.

If someone has an idea where to look as it was working fine before the db split.

Here is how I start my worker:

    async Task IChangeFeedWorker.StartAsync()
    {
        await _semaphoreSlim.WaitAsync();
        string operationName = $"{nameof(CosmosChangeFeedWorker)}.{nameof(IChangeFeedWorker.StartAsync)}";

        using var _ = BeginChangeFeedWorkerScope(_logger, operationName, _processorName, _instanceName);

        try
        {
            if (Active)
            {
                return;
            }

            Container eventContainer = _cosmosClient.GetContainer(_databaseId, _eventContainerId);
            Container leaseContainer = _cosmosClient.GetContainer(_databaseId, _leaseContainerId);

            _changeFeedProcessor = eventContainer
                .GetChangeFeedProcessorBuilder<CosmosEventChange>(_processorName, HandleChangesAsync)
                .WithInstanceName(_instanceName)
                .WithLeaseContainer(leaseContainer)
                .WithStartTime(_startTimeOfTrackingChanges)
                .Build();

            await _changeFeedProcessor.StartAsync();
            Active = true;
            _logger.LogInformation(
                "Change feed processor instance has been started.",
                _processorName, _instanceName);
        }
        catch (Exception e)
        {
            _logger.LogError(e,
                "Starting of change feed processor instance has failed.",
                _processorName, _instanceName);
            _changeFeedProcessor = null;
            throw;
        }
        finally
        {
            _semaphoreSlim.Release();
        }
    }
0

There are 0 best solutions below