yahoo / mdbm

MDBM a very fast memory-mapped key/value store.
BSD 3-Clause "New" or "Revised" License
993 stars 111 forks source link

Completion of error handling #15

Closed elfring closed 10 years ago

elfring commented 10 years ago

I have looked at a few source files for your current software. I have noticed that some checks for return codes are missing.

Would you like to add more error handling for return values from functions like the following?

timrc-git commented 10 years ago

Fixed in commit e059b7ac9f3982ac0ad170bde4fa32eff85d3abb.

elfring commented 10 years ago

It seems that there are a few update candidates left over.

Are you interested to apply aspect-oriented software development? How do you think about to encapsulate error detection and corresponding exception handling as a reusable aspect in your software?

timrc-git commented 10 years ago

Hi Elfring-

The coding standard at Yahoo, Google, and undoubtedly other places prohibits exceptions. This is partly because lots of legacy C++ code is unprepared to handle exceptions. But additionally, for MDBM, the main API is in C, so exceptions just wont fly.

For MutexRAII, there are some unfortunate issues with CPPUnit and forking. If you do anything other than exit from a forked process (including assert, throw, abort, etc) CPPUnit will catch it and continue to run subsequent tests in that unwanted forked process, in parallel with the main process. This creates chaos and makes it very difficult to track down the actual test failure. Since MutexRAII is used in both the main, and forked processes, I'm hesitant to change it.

AcumTSC is only present to do high-resolution speed-testing of locking changes. It is not normally used, but it needs to be as lightweight as possible when it does run.

Thanks!

.timrc

elfring commented 10 years ago

I hope that less return values will be ignored in the near future. Will the importance of software correctness increase over the desire for "lightweight" and efficient execution?