-
Notifications
You must be signed in to change notification settings - Fork 81
Upgrade maxmind geoip dependencies #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…eoip interfaces require JDK 11 and we no longer support 7.x stack
| break; | ||
| case AUTONOMOUS_SYSTEM_NUMBER: | ||
| Integer asn = response.getAutonomousSystemNumber(); | ||
| final Long asn = response.getAutonomousSystemNumber(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking if this Integer -> Long breaks the backward compatibility if result is saved into ES. Quick test with 8.19.last and 9.x versions seems by default numeric will be mapped as Long and this doesn't break unless if there is a strict Integer mapping.
POST /asn-type-test/_doc/1
{
"ip": "8.8.8.8",
"asn": 15169,
"org": "Google LLC"
}
GET /asn-type-test/_mapping
// Results
{
"asn-type-test": {
"mappings": {
"properties": {
"asn": {
"type": "long"
},
"ip": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"org": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
POST /asn-type-test/_doc/2
{
"ip": "1.2.3.4",
"asn": 4200000000,
"org": "Test Large ASN"
}
GET /asn-type-test/_search
| try { | ||
| response = databaseReader.city(ipAddress); | ||
| } catch (NullPointerException e) { | ||
| } catch (NullPointerException | DeserializationException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: after 4.x, on top of NPE there might be DeserializationException if there is invalid custom field data that can't be deserialized.
Remove unnecessary comment
| String junitVersion = '5.11.2' // at least 5.11 is needed to use @FieldSource with @ParameterizedTest | ||
| String maxmindGeoip2Version = '2.17.0' | ||
| String maxmindDbVersion = '2.1.0' | ||
| String maxmindGeoip2Version = '4.4.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geoip2 interface started using maxmind-db 3.1.1 version from 4.2.1 and using the latest seems safe to me, reference - https://github.com/maxmind/GeoIP2-java/releases/tag/v4.2.1
| @@ -1 +1 @@ | |||
| 7.3.3 No newline at end of file | |||
| 7.4.0 No newline at end of file | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did minor version upgrade since maxmind deps also upgraded to minors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version drops support of jvm 8. I consider it as breaking change and suggest to change the version to 8.0.0.
| @@ -1,3 +1,6 @@ | |||
| ## 7.4.0 | |||
| - Upgrade maxmind `geoip2` to 4.4.0 and `maxmind-db` to 3.1.1 versions [#238](https://github.com/logstash-plugins/logstash-filter-geoip/pull/238) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm., maybe worth to mention about asn type (Integer to Long) change if it break anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ruby only has Integer (BigInteger) type and your test shows the output is the same type, so my voice would be not mentioning here
kaisecheng
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some questions about the dependency. We can take this chance to clean up the test cases for LS7 (example)
I have tested a few scenarios. All look good.
- install in LS9 and query db
- use this plugin to query old db and custom field db
- install in LS7 and got rejected as expected
The plugin drops support on jvm 8. I think it is a breaking change. WDYT?
| exclude group: 'org.apache.httpcomponents', module: 'httpclient' | ||
| exclude group: 'org.apache.httpcomponents', module: 'httpcore' | ||
| exclude group: 'commons-codec', module: 'commons-codec' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geoip2 4.x removed the dependency of apache httpclient and commons-codec. We can removed them too.
| exclude group: 'commons-codec', module: 'commons-codec' | ||
| } | ||
|
|
||
| implementation group: "com.maxmind.db", name: "maxmind-db", version: maxmindDbVersion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the maxmind's changelog, starting from 4.0.1, com.maxmind.db is a transitive dependency of com.maxmind.geoip2. How about we drop the dependency?
| @@ -1,3 +1,6 @@ | |||
| ## 7.4.0 | |||
| - Upgrade maxmind `geoip2` to 4.4.0 and `maxmind-db` to 3.1.1 versions [#238](https://github.com/logstash-plugins/logstash-filter-geoip/pull/238) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ruby only has Integer (BigInteger) type and your test shows the output is the same type, so my voice would be not mentioning here
| @@ -1 +1 @@ | |||
| 7.3.3 No newline at end of file | |||
| 7.4.0 No newline at end of file | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version drops support of jvm 8. I consider it as breaking change and suggest to change the version to 8.0.0.
| // Jackson dependencies required by GeoIP2 4.x for JSON serialization (excluded above, needed for tests) | ||
| testImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.17.2' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seem to be able to run test without this dependency. Which test need this?
Description
Upgrades maxmind
geoip2to 4.4.0 andmaxmind-dbversion to 3.1.1.Why specifically to these versions because
geoip25.x available?dma_code(metro code) is removed where LS is using. See draft PR for PoC - Try maxmind geoip 5.x version #2378.x,9.xandmainbranches usegeoip2to 4.2.1 and maxmind-db` 3.1.1 versions.How to test?
!IMPORTANT - Tests are vibe coded but reviewed details.
Repo: https://github.com/mashhurs/geoip-compatibility-tests
Pull this PR and pull the test repo.
Set the
GEOIP_PLUGIN_DIRwith the path you have closed this PR in https://github.com/mashhurs/geoip-compatibility-tests/blob/f5e126713807e89873bc8f12dfa32f41cfcde7b4/run-tests.sh#L8I have also pushed the recent result with 8.19, 9.3 and cross (ES 8.18 vs LS 9.3 or vice versa) - https://github.com/mashhurs/geoip-compatibility-tests/tree/main/results