Refine some concurrency codes in DataBase.

Signed-off-by: 核心力量 <kernelforce@gmail.com>