changed applyToDatabaseNames to use batching #1059

Inlining the work in the callback leads to a deadlock with checkpoint if a
checkpoint begins before we call back into the ydb while processing _f.