telefonicaid / fiware-cygnus

A connector in charge of persisting context data sources into other third-party databases and storage systems, creating a historical view of the context
https://fiware-cygnus.rtfd.io/
GNU Affero General Public License v3.0
65 stars 104 forks source link

Fix/check get lastdata before remove #2355

Closed AlvaroVega closed 4 months ago

AlvaroVega commented 4 months ago

time=2024-03-07T10:32:00.371Z | lvl=ERROR | corr=776e343e-8e3e-4e55-99ca-67939e592c99; cbnotif=15 | trans=5bd491ef-ffc2-4d47-8141-368c227d7138 | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=processNewBatches | msg=com.telefonica.iot.cygnus.sinks.NGSISink[619] : Cannot invoke "java.util.ArrayList.remove(int)" because the return value of "java.util.LinkedHashMap.get(Object)" is null Sink: postgis-sink Destination: smartcity_/_ValidationAsset Stack trace: [com.telefonica.iot.cygnus.aggregation.NGSIGenericColumnAggregator.aggregate(NGSIGenericColumnAggregator.java:247), com.telefonica.iot.cygnus.sinks.NGSIPostgisSink.persistBatch(NGSIPostgisSink.java:390), com.telefonica.iot.cygnus.sinks.NGSISink.processNewBatches(NGSISink.java:597), com.telefonica.iot.cygnus.sinks.NGSISink.process(NGSISink.java:372), org.apache.flume.sink.DefaultSinkProcessor.process(DefaultSinkProcessor.java:39), org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:145), java.base/java.lang.Thread.run(Thread.java:840)]

Maybe related with recent jdk update (from 11 to 17)

AlvaroVega commented 4 months ago

This PR fixes cases when a batch of events with multiple entityCreation and entityUpdate arrives and some of then are not created.