abh1sar commented on code in PR #13074:
URL: https://github.com/apache/cloudstack/pull/13074#discussion_r3492256410
##########
plugins/backup/nas/src/main/java/org/apache/cloudstack/backup/NASBackupProvider.java:
##########
@@ -239,9 +568,31 @@ public Pair<Boolean, Backup> takeBackup(final
VirtualMachine vm, Boolean quiesce
backupVO.setDate(new Date());
backupVO.setSize(answer.getSize());
backupVO.setStatus(Backup.Status.BackedUp);
+ // If the agent fell back to full (stopped VM mid-incremental
cycle), record this
+ // backup as a full and start a new chain.
+ ChainDecision effective = decision;
+ if (answer.getIncrementalFallback()) {
+ effective = ChainDecision.fullStart(decision.bitmapNew);
+ backupVO.setType("FULL");
Review Comment:
Bug: backupVO.setType("FULL") is silently dropped by the UpdateBuilder in
the incremental fallback path.
CloudStack's GenericDaoBase.update() uses a CGLib proxy (UpdateBuilder) to
track which fields changed. It
derives the tracked field name from the setter name — setType → "type".
But the actual Java field in
BackupVO is named backupType, so _allAttributes.get("type") returns null
and the change is never added to
the UPDATE SQL.
This only manifests in the incremental-fallback branch
(answer.getIncrementalFallback() == true) because
that is the only place where setType is called on an enhanced entity
returned from backupDao.persist.
Everywhere else, setType is called on a plain new BackupVO() before
persist, which goes through a raw
INSERT that reads field values directly — bypassing UpdateBuilder
entirely.
Fix: rename BackupVO.backupType → BackupVO.type so the field name matches
what UpdateBuilder resolves from
the setter.
--
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]