Search code examples
sentry

KeyError: 1 sentry snuba subscription consumer events


I am getting an error after increasing the partition count from 1 to 2 for the snuba-commit-log topic. I sometimes saw timeout errors and thought I could fix them by increasing the partition count. Sentry Version: 22.6.0

   return _process_result(sub_ctx.command.invoke(sub_ctx))
 File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
   return ctx.invoke(self.callback, **ctx.params)
 File "/usr/local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
   return __callback(*args, **kwargs)
 File "/usr/src/snuba/snuba/cli/subscriptions_scheduler_executor.py", line 162, in subscriptions_scheduler_executor
   processor.run()
 File "/usr/local/lib/python3.8/site-packages/arroyo/processing/processor.py", line 131, in run
   self._run_once()
 File "/usr/local/lib/python3.8/site-packages/arroyo/processing/processor.py", line 169, in _run_once
   self.__processing_strategy.submit(self.__message)
 File "/usr/src/snuba/snuba/subscriptions/scheduler_processing_strategy.py", line 252, in submit
   self.__next_step.submit(message)
 File "/usr/src/snuba/snuba/subscriptions/combined_scheduler_executor.py", line 256, in submit
   tasks.extend([task for task in entity_scheduler[tick.partition].find(tick)])
KeyError: 1

I couldn't open any kind of tickets in sentry's own forum because the site seems read-only mode. That's why I preferred to ask here. Sorry if the location is not correct.


Solution

  • We had multiple partitions for a couple of topics but we had a missing config parameter for snuba. Here is which parts was missing:

    TOPIC_PARTITION_COUNTS = {
          "errors-replacements": 1,
          "event-replacements": 1,
          "events": 2,
          "ingest-attachments": 1,
          "ingest-events": 1,
          "ingest-sessions": 2,
          "ingest-transactions": 1,
          "outcomes": 2,
          "snuba-commit-log": 2,
        }