问题
using WSO2AM 2.1 with analytics (I believe version 2.1 too) we have following exceptino in the aalytics' server log:
ERROR: null value in column "os" violates not-null constraint
Caused by: java.sql.BatchUpdateException: Batch entry 4 INSERT INTO API_REQ_USER_BROW_SUMMARY (api, version, apiPublisher, tenantDomain, total_request_count, year, month, day, requestTime, os, browser) VALUES ('agenda.city', '0.0.1', 'admin', 'carbon.super', 153, 2017, 8, 15, 1502794641000, NULL, NULL) ON CONFLICT (api,version,apiPublisher,year,month,day,os,browser,tenantDomain) DO UPDATE SET total_request_count=EXCLUDED.total_request_count, requestTime=EXCLUDED.requestTime was aborted: ERROR: null value in column "os" violates not-null constraint
Detail: Failing row contains (agenda.city, 0.0.1, admin, carbon.super, 153, 2017, 8, 15, 1502794641000, null, null). Call getNextException to see other errors in the batch.
at org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:145)
at
Full exception: https://pastebin.com/bqRJZniN
As a note - I don't see a problem having null os or browser as not all clients (mainy backend API clients) may/will provide additional information
Edit (18.8.2018):
I see this exception doesn't occur on every environment, so the difference must be somewhere else (reused DB after upgrade from 2.0.0?), seems there are factors I am not aware of
As well I see te long always mention "Batch entry 38 ..", maybe I could just clean up the entries for the start. How do I do that?
回答1:
This is already fixed [1] and will be available in the next release.
[1] https://wso2.org/jira/browse/ANLYAPIM-154
来源:https://stackoverflow.com/questions/45734329/wso2am-analytics-2-1-null-value-in-column-os-violates-not-null-constraint