alberto-art3ch opened a new pull request, #6854:
URL: https://github.com/apache/fineract/pull/6854

   ## Description
   
   `ColumnValidator` validates `orderBy` / `sortOrder` against the table's 
columns on every sorted listing by reading the JDBC metadata, which pgjdbc 
turns into a catalog query of ~124 rows per call. In a read-heavy run (15,003 
requests) it was the top statement by total time: 6,699 calls, 26 % of database 
time, above any business query.
   
   This PR caches the column names per tenant and table in `ColumnValidator` 
and evicts the entry after every datatable DDL (`createDatatable`, each `ALTER` 
in `updateDatatable`, `deleteDatatable`). Unknown tables are not cached, so a 
datatable created later is picked up without eviction. The schema otherwise 
changes only through Liquibase at startup.
   
   No API or behaviour change: the same validation errors are raised for 
unknown tables and columns.
   
   Tests: `ColumnValidatorCacheTest` (cache hit, miss on unknown table, 
eviction, tenant isolation); `DatatableWriteServiceImplTest` updated for the 
new collaborator.
   
   [FINERACT-2968](https://issues.apache.org/jira/browse/FINERACT-2968)
   
   ## Checklist
   
   Please make sure these boxes are checked before submitting your pull request 
- thanks!
   
   - [ ] Write the commit message as per [our 
guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests)
   - [ ] Acknowledge that we will not review PRs that are not passing the build 
_("green")_ - it is your responsibility to get a proposed PR to pass the build, 
not primarily the project's maintainers.
   - [ ] Create/update [unit or integration 
tests](https://fineract.apache.org/docs/current/#_testing) for verifying the 
changes made.
   - [ ] Follow our [coding 
conventions](https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions).
   - [ ] Add required Swagger annotation and update API documentation at 
fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with 
details of any API changes
   - [ ] [This PR must not be a "code 
dump"](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit).
 Large changes can be made in a branch, with assistance. Ask for help on the 
[developer mailing list](https://fineract.apache.org/#contribute).
   - [ ] If merging this PR resolves a JIRA issue, I will mark that issue as 
resolved and set "Fix Version/s" appropriately.
   - [ ] I followed the [AI 
Policy](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#ai-policy).
   
   Your assigned reviewer(s) will follow our [guidelines for code 
reviews](https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to