Logging of transactions for debugging purposes

Unfortunately, there are no built-in feature to log the state of transactions client-side, and there is some logging capability of transactions server-side (used by the backup tool) but it will not produce something that I would consider usable if your intent is to develop, troubleshoot and optimize an application or a layer.

Out of necessity, I added this capability to the .NET binding, in order to measure each operations and to produce timelines of each transactions with timings, key/value results, error codes, retries, and so on. The default output is in text format that can be dumped to text files, but the raw timings could also be collected and sent in any other format (JSON, binary, …).

You can see some example in this comment (and others below): Performance characteristics of using Watches for Distributed Task Scheduling

I don’t think that other bindings have the same capability at the current time. And since you are using the C binding which is the lowest client API (most other bindings do use the C binding under the hood), your only choice is to create some sort of wrapper on top of FDBTransaction* that does this kind of logging for you.

My experience of the last 5 years, working with fdb from the application/layer side, is that this kind of tool is invaluable, and I don’t know how I would have been able to do without!.

I would recommend everyone wanting to do serious work with layers, to invest some time into this kind of tooling, because it will help you a lot in the future!

1 Like