alibaba / jstorm

Enterprise Stream Process Engine
http://jstorm.io
Apache License 2.0
3.92k stars 1.8k forks source link

Inconsistent library versions notice. #673

Open kaifeng-h opened 4 years ago

kaifeng-h commented 4 years ago

Hi. I have implemented a tool to detect library version inconsistencies. Your project have 5 inconsistent libraries and 10 false consistent libraries.

Take org.slf4j:slf4j-api for example, this library is declared as version 1.7.21 in jstorm-core, 1.7.5 in jstorm-hbase-metrics-plugin, 1.7.12 in jstorm-hdfs and etc... Such version inconsistencies may cause unnecessary maintenance effort in the long run. For example, if two modules become inter-dependent, library version conflict may happen. It has already become a common issue and hinders development progress. Thus a version harmonization is necessary.

Provided we applied a version harmonization, I calculated the cost it may have to harmonize to all upper versions including an up-to-date one. The cost refers to POM config changes and API invocation changes. Take org.slf4j:slf4j-api for example, if we harmonize all the library versions into 2.0.0-alpha1. The concern is, how much should the project code adapt to the newer library version. We list an effort table to quantify the harmonization cost.

The effort table is listed below. It shows the overall harmonization effort by modules. The columns represents the number of library APIs and API calls(NA,NAC), deleted APIs and API calls(NDA,NDAC) as well as modified API and API calls(NMA,NMAC). Modified APIs refers to those APIs whose call graph is not the same as previous version. Take the first row for example, if upgrading the library into version 2.0.0-alpha1. Given that 192 APIs is used in module jstorm-core, 0 of them is deleted in a recommended version(which will throw a NoMethodFoundError unless re-compiling the project), 191 of them is regarded as modified which could break the former API contract.

Index Module NA(NAC) NDA(NDAC) NMA(NMAC)
1 jstorm-core 192(195) 0(0) 191(194)
2 jstorm-hdfs 8(8) 0(0) 8(8)
3 jstorm-hbase-metrics-plugin 1(1) 0(0) 1(1)

Also we provided another table to show the potential files that may be affected due to library API change, which could help to spot the concerned API usage and rerun the test cases. The table is listed below.

Module File Type API
jstorm-core jstorm-core/src/main/java/com/alibaba/jstorm/daemon/nimbus/NimbusData.java modify org.slf4j.LoggerFactory.getLogger(java.lang.Class)
jstorm-core jstorm-core/src/main/java/com/alibaba/jstorm/schedule/default_assign/ResourceWorkerSlot.java modify org.slf4j.LoggerFactory.getLogger(java.lang.Class)
jstorm-core jstorm-core/src/main/java/backtype/storm/testing/TestAggregatesCounter.java modify org.slf4j.LoggerFactory.getLogger(java.lang.Class)
4 .. .. ..

As for false consistency, take io.dropwizard.metrics metrics-core jar for example. The library is declared in version 3.1.2 in all modules. However they are declared differently. As components are developed in parallel, if one single library version is updated, which could become inconsistent as mentioned above, may cause above-mentioned inconsistency issues

If you are interested, you can have a more complete and detailed report in the attached PDF file. alibaba jstorm.pdf

Fudan SELab