VM Backup usage billed at last-reported size for the entire billing period
- Ngôn ngữ chính
- Java
- Star
- 3.1k
- Fork
- 1.4k
- Merge trung bình
- 6 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 32
Mô tả
### problem
When `EVENT_VM_BACKUP_USAGE_METRIC` events are processed, `Usage Manager` performs an in-place UPDATE of the single usage_backup row for a given (vm_id, backup_offering_id) pair. This means only the most recently received size is retained. When BackupUsageParser runs at billing time, it reads that single row and applies its size to the entire billing window duration, regardless of when the size actually changed.
### versions
ACS 4.20
### The steps to reproduce the bug
The problem is independent of the provider but I am using NAS for testing:
1. Set usage.stats.job.exec.time to `10:00`
2. Assign a backup offering to a VM at `11:00`
3. Create a backup of size 1GB at `11:00`
4. Create a backup of size 99GB at `09:00` the next day
5. Wait for usage job to run and finish at `10:00`
### What to do about it?
**Expected Behavior**
The user should be charged proportionally: ~23 hours at 1 GB + ~1 hours at 100 GB
**Actual Behavior**
The user is charged at 100 GB for the full 24 hours because the last metric event overwrote the size column in-place, erasing all history.
**Fix would be to:**
- Find the active row in `usage_backup` (removed IS NULL) for the (vm_id, backup_offering_id).
- Set its removed = eventDate.
- persist a new UsageBackupVO with the updated size/protectedSize and created = eventDate.
- This matches the existing pattern in UsageNetworksDaoImpl and UsageVpcDaoImpl.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với việc Usage Manager xử lý EVENT_VM_BACKUP_USAGE_METRIC và theo dõi cách các hàng usage_backup được BackupUsageParser xử lý. So sánh các mẫu hiện có trong UsageNetworksDaoImpl và UsageVpcDaoImpl, sau đó xác minh rằng các thay đổi kích thước tạo ra các khoảng thời gian lịch sử để hệ thống tính phí chỉ tính phí mỗi kích thước trong khoảng thời gian nó hoạt động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- backend, cloud
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 72/100