Aias00 opened a new issue, #7723:
URL: https://github.com/apache/shenyu/issues/7723

   ## Current behavior
   `InstanceInfoServiceImpl.createOrUpdate` assigns `lastHeartBeatTime` on the 
Java entity for updates, but the instance mapper's column list, result map, 
insert and update statements contain no heartbeat timestamp. The reviewed 
initialization schemas also lack this column. The create conversion does not 
copy the value either. Database reads therefore produce the Java default `0` 
for a primitive long.
   
   The instance list overlays this with a live local map, masking the omission. 
Detail queries read the database, and `InstanceCheckService.fetchInstanceData` 
restores database values on startup/master election. A restored record 
consequently has no durable last-seen observation, and the checker can age it 
from epoch zero if no new report arrives. Do not use `date_updated` as a 
substitute: periodic persistence updates that field independently of receiving 
a heartbeat.
   
   ## Source evidence
   - [Mapper and column/result 
definitions](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/resources/mappers/instance-info-sqlmap.xml#L21)
   - [Service assigns the value before calling 
mapper](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/InstanceInfoServiceImpl.java#L70)
   - [Create conversion omits 
heartbeat](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/entity/InstanceInfoDO.java#L272)
   - [Startup 
restore](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/InstanceCheckService.java#L95)
   
   A local XML inspection confirmed that Base_Column_List, BaseResultMap, 
insert and updateById omit this field. No database/runtime reproduction was 
executed during issue preparation.
   
   ## Acceptance criteria
   - [ ] Define durable last-seen semantics and persist/read the heartbeat 
observation consistently through create, update, list and detail paths.
   - [ ] Add initialization/upgrade changes for supported database dialects and 
explicit handling of historical rows with no observation.
   - [ ] Mapper integration tests round-trip a fixed nonzero timestamp through 
insert and update; mock-only service tests are insufficient.
   - [ ] Test Admin restart/master handover, with and without a subsequent 
heartbeat; unknown/stale observations are represented explicitly rather than 
fabricated as fresh.
   - [ ] Preserve namespace identity and distinguish last report time from last 
persistence time.
   
   Related: #7697 concerns missing local-map entries; #7718 concerns readiness; 
neither repairs the persistence contract.
   


-- 
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