Bug: add exactly maxRecords in db

Change-Id: Ic3f9a82e154f477329ab9a65f19caf05f7478c5f