MaxMind-DB-Reader-java
MaxMind-DB-Reader-java copied to clipboard
Enable basic sanity check for new database files
Hello,
A couple of days ago, I encountered an exception on every get(InetAddress) method call on a GeoIP2 City database file, dated from June 11, 2017:

For now, I don't see any (public) method that could allow some sanity check on a database file.
The MD5 hash computed on the downloaded file was matching the one available on your web site.
Appart from testing a new database file with some values, how could we ensure that we can safely switch to a valid database? For production systems, this is very important.
Thanks,
Dimitri
If you want to verify a database, I would suggest using mmdbverify. If you just want a basic sanity check and you have already checked the MD5 of the download, I would suggest just opening the database and reading an IP address from it.
For Java users, the most frequent source of "invalid" database is not disabling binary filtering when deploying with Maven.
Thanks for the suggestions @oschwald .
- mmdbverify is nice, but difficult to integrate in our automatic, all Java-based setup.
- Using a "probation" mode where both old & new database files are used is easier in our case.
- The Maven deployment is not relevant to us, but glad to hear about it.
We will probably go for suggestion n°2.
By any chance, do you foresee porting mmdbverify to Java ?
I am not sure if we will port mmdbverify to Java. We primarily use it internally and have not seen much customer interest in such a tool.