apache / apache/couchdb

Add logging for crashes in `commit_compaction_data`

Open
#1,263 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 16h
Merged PRs (30d)
9

Description

Crash in `commit_compaction_data` causes severe issues. However it is quite hard to figure out what shard it was crashed on. We need to add logging to log shard name in case of a crash in the critical function.

## Expected Behavior

When `commit_compaction_data` crashes for any reason we should see a message in the log which contains the shard name.

## Current Behavior

There is a crash dump which doesn't contain any useful information to identify problematic shard.

## Possible Solution

Add `try/catch` and log from the `catch`

## Steps to Reproduce (for bugs)

See https://github.com/apache/couchdb/pull/1255/files#diff-b6c880ef1513b1db939914f94786a1a5

## Context

## Your Environment

Contributor guide

Open the contributing guide

Research direction

Start by locating the Erlang implementation of `commit_compaction_data` and review the change referenced in pull request #1255. Trace how the shard name is available at the crash point, then verify that failures produce a log message containing that name without hiding the crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.