SENTRY-391: fix a bug of rename/drop privileges and add test cases