Better error logging for missing or invalid cluster files
- Dominant language
- C++
- Stars
- 16.7k
- Forks
- 1.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 126
Description
Right now, the logging for missing cluster files isn't great. The main issue is that the mechanism for providing errors is through the `Error` interface, which only can include an error code and a static error message. So this means that if the user does something like specify a file that doesn't exist as the cluster file, they get an error message that says, "No cluster file found in current directory or default location" (even if they specified an explicit cluster file). This can make it difficult to tell, for example, whether a connection is failing because a (non-default) cluster file was not present or because the cluster file information wasn't being passed down correctly (or what).
One approach might be to make it so that the `Error` could take a dynamic message. This would actually be a fairly involved change given how that class is architected (where an individual `Error` struct actually doesn't include any information on its string and calling `what` looks up the message from a table).
It would also probably suffice in most circumstances if it could log to trace events. There are two issues here:
1. The cluster file contents are currently read before the trace file is opened and the cluster file *contents* are included as part of the `ClientStart` message.
1. Subsequent cluster initializations do not emit any message of any kind.
So there would need to be some kind of reworking of the initialization order of a few things to make it so that a trace event is reliably emitted.
Note that we already have a `getErrorString` that appears to mostly give us what we want, but it isn't called in the cluster file read path.
Contributor guide
Research direction
Start by reading the cluster file read path, the existing getErrorString helper, and the Error interface described in the issue. Trace how cluster contents reach ClientStart and when the trace file opens, including subsequent cluster initializations. Done should mean missing or invalid explicit cluster files produce reliable, useful trace information without losing coverage for later initializations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- databases, distributed-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100