Logstash input JDBC dupplica dati

Hi everybody

I am using logstash 6.8.1 to import data from a DB and in the file set in last_run_metadata_path saves a wrong ID.
This results in a duplication of the rows since the ID saved in the file is less than the largest ID actually imported.

For example: I imported up to ID 1000 but in the file saved 700, the next import re-imports the data from 700 to 1000.

Can you help me solve this behavior?

Thanks

Daniele