Sync DB to disk after optimize & safely rename
Don't overwrite an existing file if the data transfer failed
Merge pull request #3 from Incubaid/safe-optimize

Make `tcbdboptimizeimpl` more safe
Set `TCETHREAD` when pthread mutex or lock allocation fails

Failures in `pthread_rwlock_init` or `pthread_mutex_init` called from
`tcbdbsetmutex` could result in the call returning failure (as desired),
but not setting an error code on the database object. This results in
applications reporting failures with error message 'success'.

It's unclear why `pthread_rwlock_init` or `pthread_mutex_init` would fail
though.

See: https://github.com/Incubaid/arakoon/issues/428
Merge pull request #4 from Incubaid/report-thread-error

Set `TCETHREAD` when pthread mutex or lock allocation fails