Fix "3rd party error log" message in the log with debug builds (#550)
The new CDebugCounter class caused error messages when we called gpos_terminate in a debug build, because it didn't release its memory pool before the CMemoryPoolManager that managed it got destroyed. The log messages started with "3rd party error log:". The fix makes sure that we delete the static CDebugCounter object and its associated memory pool before deleting the CMemoryPoolManager in the gpos_terminate call. Also, the code caused simple queries like "select 1" to fall back in debug builds, due to an assert in the IDatumInt8::GetByteArrayValue() function. This has been fixed as well. Note that most of the diffs in COptimizer::PrintQueryOrPlan() are due to indentation, the actual code change is just a dynamic cast and an added "if (NULL != datum)". Also fix a double deletion issue, visible in debug builds We had an issue in gpos_terminate, when we deleted the single CDebugCounter object. This object was allocated from a memory pool, and we destroyed that memory pool in the destructor - while the CDebugCounter object was still allocated in the memory pool. This led to a recursive deletion of the same object and an error. In some cases (e.g. gpstart on 5X, possibly others) this error caused the gpstart operation to fail. The fix moves the destruction of the memory pool out, to a point where the memory pool is empty.
Showing
想要评论请 注册 或 登录