wenzhenghu opened a new issue, #65798:
URL: https://github.com/apache/doris/issues/65798

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   - master
   - branch-3.1
   
   
   ### Whats Wrong?
   
   Local backup snapshots are indexed in FE memory only by the bare snapshot 
label.
   
   The current implementation keeps local snapshots in 
`BackupHandler.localSnapshots` as `Map<String, BackupJob>` and `getSnapshot` 
RPC also looks up the snapshot only by `request.label_name`.
   
   As a result, local snapshots from different databases can collide when they 
use the same label:
   
   - creating a later local snapshot with the same label can overwrite the 
previous one in FE memory;
   - `getSnapshot` may return the snapshot from another database;
   - eviction or removal may also affect the wrong snapshot entry.
   
   This is not just a path naming issue. Although local staging directories 
include `label + "__" + createTime` and remote job-info files include 
timestamps, the in-
   ### Seakup key is still only the bare label.
   
   
   ### What You Expected?
   
   Local backup snapshots should be uniquely identified by database scope, for 
example `(dbId, label)` or an equivalent key that matches the SQL semantics of 
`db.label`.
   
   `getSnapshot` should use the database dimension from the request when 
resolving a local snapshot, instead of looking up by bare label only.
   
   
   ### How to Reproduce?
   
   1. Create database `db1` and database `db2`.
   2. Create one local backup snapshot in `db1` with label `same_label`.
   3. Create another local backup snapshot in `db2` with the same label 
`same_label`.
   4. Call the local snapshot retrieval path for `db1.same_label` and 
`db2.same_label`.
   
   Expected:
   Each database resolves its own local snapshot.
   
   Actual:
   The FE local snapshot map is keyed only by `label`, so one snapshot can 
overwrite the other and the lookup can resolve the wrong snapshot.
   
   
   ### Anything Else?
   
   Relevant code paths:
   
   - `fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java`
   - 
`fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java`
   - 
`fe/fe-core/src/main/java/org/apache/doris/analysis/AbstractBackupStmt.java`
   - `fe/fe-core/src/main/java/org/apache/doris/analysis/LabelName.java`
   
   This issue is intentionally tracked separately from the recent 
staging-directory cleanup changes, because it is a distinct correctness problem 
and should be fixed in a focused PR.
   
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this projects Code of Conduct
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to