fix(backup): 宿主采集器按 du 口径去重硬链接并拒绝清单符号链接
备份目录 root:root 0700,API 不再遍历;宿主采集器只读 stat/du,原子写快照。统计包含目录自身、树内 (dev,ino) 硬链接去重,单库与整批各自独立与 du -sB1 对齐;MANIFEST 仅接受目录内常规非符号链接文件并 O_NOFOLLOW 打开。快照缺失/陈旧/不完整时批次与子库字节为 null,页面不画容量图、不使用部分字节。
This commit is contained in:
@@ -13,8 +13,9 @@ import { fetchBackupInventory } from './backupInventory'
|
||||
import type { BackupInventory, BackupInventoryBatch } from './backupInventory'
|
||||
import './storageBackup.css'
|
||||
|
||||
export const formatBackupBytes = (bytes: number): string => {
|
||||
if (!bytes) return '—'
|
||||
export const formatBackupBytes = (bytes: number | null | undefined): string => {
|
||||
if (bytes === null || bytes === undefined || !Number.isFinite(bytes) || bytes < 0) return '—'
|
||||
if (bytes === 0) return '0 B'
|
||||
const mib = bytes / (1024 * 1024)
|
||||
return mib >= 1024 ? `${(mib / 1024).toFixed(2)} GiB` : `${mib.toFixed(1)} MiB`
|
||||
}
|
||||
@@ -206,18 +207,27 @@ export interface InventoryUsage {
|
||||
system_other: number
|
||||
}
|
||||
|
||||
// 只读挂载 + 实测容量 + 文件系统与容器根盘分离,三者同时成立才画整盘图。
|
||||
// 备份实际占盘取所有批次的 st_blocks 合计,不是 MANIFEST 的表观字节。
|
||||
// 完整新鲜的宿主快照 + 实测容量 + 采集器给出的文件系统,才画整盘图。
|
||||
// 备份实际占盘取快照的总实际分配,不是 MANIFEST 表观字节,也不接受部分字节。
|
||||
export function inventoryUsage(inventory: BackupInventory | null): InventoryUsage | null {
|
||||
if (
|
||||
!inventory ||
|
||||
!inventory.wired ||
|
||||
!inventory.metadata.present ||
|
||||
!inventory.metadata.valid ||
|
||||
!inventory.metadata.fresh ||
|
||||
!inventory.metadata.complete ||
|
||||
!inventory.mount.mount_verified ||
|
||||
!inventory.capacity.measured ||
|
||||
inventory.capacity.total_bytes <= 0
|
||||
inventory.capacity.total_bytes <= 0 ||
|
||||
inventory.totals.actual_bytes === null ||
|
||||
inventory.totals.actual_bytes === undefined
|
||||
) {
|
||||
return null
|
||||
}
|
||||
if (inventory.batches.some((batch) => !batch.sizes_complete || batch.actual_bytes === null)) {
|
||||
return null
|
||||
}
|
||||
const total = inventory.capacity.total_bytes
|
||||
const used = Math.max(0, inventory.capacity.used_bytes)
|
||||
const backup = Math.max(0, inventory.totals.actual_bytes)
|
||||
@@ -236,20 +246,29 @@ export function inventoryAlerts(inventory: BackupInventory | null): StorageAlert
|
||||
const usage = inventoryUsage(inventory)
|
||||
const latest = inventory?.batches[0]
|
||||
const capacityKnown = Boolean(usage)
|
||||
const latestBytes = latest?.actual_bytes ?? 0
|
||||
const diskKnown = capacityKnown && latestBytes > 0
|
||||
const diskActive = diskKnown && latestBytes > usage!.free
|
||||
const latestBytes = latest?.actual_bytes ?? null
|
||||
const diskKnown =
|
||||
capacityKnown && latest !== undefined && latest.sizes_complete && latestBytes !== null && latestBytes !== undefined
|
||||
const diskActive = diskKnown && latestBytes! > usage!.free
|
||||
const diskDetail = !inventory
|
||||
? '尚未读取备份目录'
|
||||
? '尚未读取宿主元数据快照'
|
||||
: !inventory.wired
|
||||
? '只读盘点未接线'
|
||||
: !inventory.mount.mount_verified
|
||||
? '目录位于容器根盘,读数不代表备份主机磁盘'
|
||||
: !inventory.capacity.measured
|
||||
? inventory.capacity.error || '未读到文件系统容量'
|
||||
: latestBytes <= 0
|
||||
? '没有可参考的批次实际占盘'
|
||||
: `剩余可用 ${formatGib(usage!.free)} GiB,最近一批实际占盘 ${formatGib(latestBytes)} GiB(参考值,不含策略预留)`
|
||||
? '元数据快照未接线'
|
||||
: !inventory.metadata.present
|
||||
? '元数据快照缺失'
|
||||
: !inventory.metadata.valid
|
||||
? inventory.metadata.error || '元数据快照无效'
|
||||
: !inventory.metadata.fresh
|
||||
? '元数据快照已陈旧'
|
||||
: !inventory.metadata.complete
|
||||
? '元数据快照不完整:占盘与容量未知'
|
||||
: !inventory.mount.mount_verified
|
||||
? '宿主采集器未给出可用文件系统'
|
||||
: !inventory.capacity.measured
|
||||
? inventory.capacity.error || '未读到文件系统容量'
|
||||
: latestBytes === null || latestBytes === undefined
|
||||
? '最近批次占盘未知'
|
||||
: `剩余可用 ${formatGib(usage!.free)} GiB,最近一批实际占盘 ${formatGib(latestBytes)} GiB(参考值,不含策略预留)`
|
||||
return [
|
||||
{
|
||||
code: 'disk_low',
|
||||
@@ -308,6 +327,9 @@ export async function copyBackupPath(value: string, button?: HTMLButtonElement |
|
||||
const manifestLabel = (batch: BackupInventoryBatch): string =>
|
||||
batch.manifest_state === 'ok' ? '清单完整' : batch.manifest_state === 'missing' ? '清单缺失' : '清单损坏'
|
||||
|
||||
const inventoryMetadataAvailable = (inventory: BackupInventory): boolean =>
|
||||
inventory.metadata.present && inventory.metadata.valid && inventory.metadata.fresh
|
||||
|
||||
// 备份执行主机上的整库逻辑备份(全部业务库一次 pg_dump)。
|
||||
// 页面只展示接口真实给出的读数;目录、配额、预留、子库路径、历史批次与恢复
|
||||
// 验证在后端契约里还没有字段,保留原型位置并写明"未接线"。
|
||||
@@ -407,8 +429,13 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
const alerts = disk ? storageAlerts(disk) : inventoryAlerts(inventory)
|
||||
const latestBatch: BackupInventoryBatch | null = inventory?.batches[0] ?? null
|
||||
const inventoryFigure = inventoryUsage(inventory)
|
||||
const inventoryReady = Boolean(inventory?.wired && !inventory.error)
|
||||
const readyInventory = inventory && inventory.wired && !inventory.error ? inventory : null
|
||||
const inventoryReady = Boolean(
|
||||
inventory?.wired && inventory.metadata.present && inventory.metadata.valid && inventory.metadata.fresh
|
||||
)
|
||||
const readyInventory =
|
||||
inventory && inventory.wired && inventory.metadata.present && inventory.metadata.valid && inventory.metadata.fresh
|
||||
? inventory
|
||||
: null
|
||||
const inventoryDatabases = latestBatch?.databases.map((item) => item.name) ?? []
|
||||
const scopeDatabases = inventoryDatabases.length ? inventoryDatabases : schedule.last_run_databases
|
||||
const scopeDatabaseCount = scopeDatabases.length
|
||||
@@ -443,12 +470,14 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
</span>
|
||||
<span className={`storage-chip ${inventoryReady ? 'ok' : 'off'}`}>
|
||||
{inventoryLoading
|
||||
? '文件盘点读取中'
|
||||
? '元数据读取中'
|
||||
: inventoryReady
|
||||
? '文件盘点已接线'
|
||||
: inventory?.error
|
||||
? '文件盘点不可读'
|
||||
: '文件盘点未接线'}
|
||||
? inventory?.metadata.complete
|
||||
? '元数据快照有效'
|
||||
: '元数据快照不完整'
|
||||
: inventory?.metadata.error
|
||||
? '元数据快照不可用'
|
||||
: '元数据未接线'}
|
||||
</span>
|
||||
</div>
|
||||
<dl className="storage-facts">
|
||||
@@ -461,7 +490,7 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
<dd>
|
||||
{inventory?.host_root || `${schedule.host_target || '(未配置)'} 本地备份根目录`}
|
||||
<span className="storage-inline-note">
|
||||
{inventoryReady ? '只读挂载盘点;平台没有写路径' : '备份目录未接线或不可读,不在页面猜测'}
|
||||
{inventoryReady ? '宿主采集器快照(只读);平台没有写路径' : '元数据快照未接线或不可用,不在页面猜测'}
|
||||
</span>
|
||||
</dd>
|
||||
<dt>执行范围</dt>
|
||||
@@ -480,7 +509,7 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
<p className="hint">
|
||||
<code>POST /api/v1/backup-schedule/run</code> 没有单库参数,一次就是该主机全部业务库的整批
|
||||
pg_dump。用单库按钮触发会连整批一起跑,因此本页不开放单库动作;单库恢复请复制「备份记录」里该库的
|
||||
完整子目录(来自只读盘点),不要自己拼路径。
|
||||
完整子目录(来自宿主元数据快照),不要自己拼路径。
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
@@ -496,9 +525,13 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
</div>
|
||||
<p>
|
||||
{latestBatch
|
||||
? `最近一批 ${latestBatch.stamp} · ${formatBackupMoment(latestBatch.created_at)} · ${scopeDatabaseCount} 个数据库 · 表观 ${formatBackupBytes(latestBatch.apparent_bytes)} · 实际占盘 ${formatBackupBytes(latestBatch.actual_bytes)} · ${latestBatch.duration_seconds} 秒`
|
||||
? `最近一批 ${latestBatch.stamp} · ${formatBackupMoment(latestBatch.created_at)} · ${scopeDatabaseCount} 个数据库 · 表观 ${formatBackupBytes(latestBatch.apparent_bytes)} · ${
|
||||
latestBatch.actual_bytes === null
|
||||
? '实际占盘未知(采集不完整)'
|
||||
: `实际占盘 ${formatBackupBytes(latestBatch.actual_bytes)}`
|
||||
} · ${latestBatch.duration_seconds} 秒`
|
||||
: hasLastRun
|
||||
? `SSH 读回最近一次 ${schedule.last_run_stamp} · ${databaseCount} 个数据库 · ${formatBackupBytes(schedule.last_run_total_bytes)}(文件盘点未接线,以下仅 SSH 结果)`
|
||||
? `SSH 读回最近一次 ${schedule.last_run_stamp} · ${databaseCount} 个数据库 · ${formatBackupBytes(schedule.last_run_total_bytes)}(元数据快照未接线,以下仅 SSH 结果)`
|
||||
: '还没有从主机读到任何批次。'}
|
||||
</p>
|
||||
{schedule.running ? (
|
||||
@@ -540,15 +573,7 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
<div className="storage-block-heading">
|
||||
<h3 id="storage-disk-heading">整盘占用与告警</h3>
|
||||
<span className="storage-chip off">
|
||||
{usage
|
||||
? '已读到主机读数'
|
||||
: inventoryFigure
|
||||
? inventory?.mount.read_only
|
||||
? '只读挂载实测'
|
||||
: '实测(挂载可写)'
|
||||
: inventory?.capacity.measured
|
||||
? '容器根盘(不可作主机容量)'
|
||||
: '未接线'}
|
||||
{usage ? '已读到主机读数' : inventoryFigure ? '宿主采集器实测' : '占盘未知'}
|
||||
</span>
|
||||
</div>
|
||||
{usage && disk ? (
|
||||
@@ -652,33 +677,19 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
)· 文件系统已用 {formatGib(inventoryFigure.used)} GiB · 可用 {formatGib(inventoryFigure.free)} GiB
|
||||
</p>
|
||||
<small>
|
||||
{inventory.mount.evidence} · 挂载点 {inventory.root} · 采集于 {formatBackupMoment(inventory.observed_at)}
|
||||
{inventory.mount.read_only ? ' · 挂载为只读' : ' · 挂载不是只读(部署需改 :ro)'}
|
||||
{inventory.mount.evidence} · 挂载点 {inventory.mount.mount_point || '—'} · 采集于{' '}
|
||||
{formatBackupMoment(inventory.metadata.collected_at || inventory.observed_at)}
|
||||
{inventory.mount.read_only ? ' · 只读挂载' : ' · 挂载可写(采集器只读)'}
|
||||
</small>
|
||||
</>
|
||||
) : inventory?.capacity.measured ? (
|
||||
<>
|
||||
<div
|
||||
className="storage-disk-track storage-disk-track-unknown"
|
||||
role="img"
|
||||
aria-label="目录位于容器根盘,容量不代表备份主机磁盘"
|
||||
>
|
||||
<span>容器根盘 · 不代表主机磁盘</span>
|
||||
</div>
|
||||
<p className="storage-metric">
|
||||
容器根盘实测 {formatGib(inventory.capacity.total_bytes)} GiB,可用{' '}
|
||||
{formatGib(inventory.capacity.available_bytes)} GiB:仅作排障,不据此判定备份主机磁盘。
|
||||
</p>
|
||||
<small>{inventory.mount.evidence}</small>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div
|
||||
className="storage-disk-track storage-disk-track-unknown"
|
||||
role="img"
|
||||
aria-label="整盘占用未接线:没有可读的只读挂载"
|
||||
aria-label="整盘占用未知:没有完整新鲜的宿主快照"
|
||||
>
|
||||
<span>{inventoryLoading ? '正在读取只读挂载…' : '未接线 · 不显示估算容量'}</span>
|
||||
<span>{inventoryLoading ? '正在读取宿主元数据快照…' : '占盘未知 · 不使用部分字节'}</span>
|
||||
</div>
|
||||
<div className="storage-disk-legend">
|
||||
{['系统其他占用', '备份实际占盘', '可用', '配额内/外'].map((label, index) => (
|
||||
@@ -689,14 +700,15 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
))}
|
||||
</div>
|
||||
<p className="storage-metric">
|
||||
整盘总量 / 空闲 / 备份实际占盘:{inventoryError || inventory?.error || '未接线'}
|
||||
整盘总量 / 空闲 / 备份实际占盘:
|
||||
{inventoryError || inventory?.metadata.error || inventory?.error || '未接线'}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
<p className="hint">
|
||||
容量来自只读挂载目录的 statfs 实测,并与容器根盘比较设备号;同一设备时不把容器容量当主机容量。 备份占盘按文件
|
||||
st_blocks 统计(实际分配),不是 MANIFEST 的表观字节。配额与策略预留仍无后端字段,
|
||||
四项告警中只有磁盘项能按实测判定。
|
||||
容量与实际占盘来自宿主单项元数据采集器(stat/du 元数据,不读数据库内容);API 不遍历备份目录。
|
||||
快照陈旧、缺失或不完整时,容量图与任何可写预测都不使用部分字节。配额与策略预留仍无后端字段,
|
||||
四项告警中只有磁盘项能按完整快照判定。
|
||||
</p>
|
||||
<p className="storage-alert-summary">{storageAlertSummary(alerts)}</p>
|
||||
<ul className="storage-alerts">
|
||||
@@ -742,7 +754,7 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
value={inventory?.host_root || ''}
|
||||
readOnly
|
||||
disabled
|
||||
placeholder={inventoryReady ? '' : '只读盘点未接线'}
|
||||
placeholder={inventoryReady ? '' : '元数据快照未接线'}
|
||||
aria-label="备份主机上的目录(只读展示)"
|
||||
/>
|
||||
</label>
|
||||
@@ -752,8 +764,8 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
</button>
|
||||
<span className="hint">
|
||||
{inventoryReady
|
||||
? '目录来自只读挂载来源,只读展示;修改目录需部署变更,平台没有写接口。'
|
||||
: '只读盘点未接线:目录不可证明,不能按设置推定。'}
|
||||
? '目录来自宿主元数据快照,只读展示;修改目录需部署变更,平台没有写接口。'
|
||||
: '元数据快照未接线:目录不可证明,不能按设置推定。'}
|
||||
</span>
|
||||
</div>
|
||||
<label className="storage-checkbox">
|
||||
@@ -858,41 +870,53 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
<h3 id="storage-runs-heading">备份记录</h3>
|
||||
<span className="hint">
|
||||
{readyInventory
|
||||
? `${readyInventory.totals.batch_count} 批 · 只读盘点 · 实际占盘 ${formatBackupBytes(readyInventory.totals.actual_bytes)}`
|
||||
: '只读盘点'}
|
||||
? `${readyInventory.totals.batch_count} 批 · 元数据快照 · 实际占盘 ${formatBackupBytes(readyInventory.totals.actual_bytes)}`
|
||||
: '元数据快照'}
|
||||
</span>
|
||||
<button type="button" onClick={onReloadInventory} disabled={inventoryLoading}>
|
||||
{inventoryLoading ? '盘点中…' : '重新盘点'}
|
||||
{inventoryLoading ? '读取中…' : '重新读取快照'}
|
||||
</button>
|
||||
</div>
|
||||
{inventoryLoading && !inventory ? <p className="hint">正在读取只读挂载与 MANIFEST…</p> : null}
|
||||
{inventoryLoading && !inventory ? <p className="hint">正在读取宿主元数据快照…</p> : null}
|
||||
{inventoryError ? (
|
||||
<p className="error-message" role="alert">
|
||||
盘点请求失败:{inventoryError}。不能用 SSH 的“最近一次”代替历史;请检查 API 到只读挂载的接线。
|
||||
快照请求失败:{inventoryError}。不能用 SSH 的“最近一次”代替历史;请检查 API 到快照挂载的接线。
|
||||
</p>
|
||||
) : null}
|
||||
{inventory && !inventory.wired ? (
|
||||
<p className="hint">
|
||||
只读盘点未接线:{inventory.error}。部署需把备份目录以 <code>:ro</code> 挂进 API (见
|
||||
元数据快照未接线:{inventory.metadata.error}。部署需在备份主机运行单次采集器并把输出目录只读挂进 API(见
|
||||
docs/STORAGE_BACKUP_READONLY_API.md);未读到批次不等于没有备份。
|
||||
</p>
|
||||
) : null}
|
||||
{inventory && inventory.wired && inventory.error ? (
|
||||
{inventory && inventory.wired && !inventoryMetadataAvailable(inventory) ? (
|
||||
<p className="error-message" role="alert">
|
||||
只读目录不可读:{inventory.error}
|
||||
元数据快照不可用:{inventory.metadata.error || inventory.error || '缺失/陈旧/无效'}
|
||||
</p>
|
||||
) : null}
|
||||
{readyInventory ? (
|
||||
<>
|
||||
<p className="hint">
|
||||
最近批次 {readyInventory.totals.latest_stamp || '—'} · 共 {readyInventory.totals.batch_count} 批 /{' '}
|
||||
{readyInventory.totals.database_count} 个子库 · 表观{' '}
|
||||
{formatBackupBytes(readyInventory.totals.apparent_bytes)} · 实际占盘{' '}
|
||||
{formatBackupBytes(readyInventory.totals.actual_bytes)}。批次与路径来自只读目录,不依赖 SSH 计划读回。
|
||||
{readyInventory.totals.database_count} 个子库 ·{' '}
|
||||
{readyInventory.metadata.complete && readyInventory.totals.actual_bytes !== null ? (
|
||||
<>
|
||||
表观 {formatBackupBytes(readyInventory.totals.apparent_bytes)} · 实际占盘{' '}
|
||||
{formatBackupBytes(readyInventory.totals.actual_bytes)}。
|
||||
</>
|
||||
) : (
|
||||
<>采集快照不完整:所有批次占盘与容量未知。</>
|
||||
)}{' '}
|
||||
路径来自宿主快照,不依赖 SSH 计划读回。
|
||||
</p>
|
||||
<p className="hint">
|
||||
采集于 {formatBackupMoment(readyInventory.metadata.collected_at)} · 年龄{' '}
|
||||
{readyInventory.metadata.age_seconds} 秒 / 上限 {readyInventory.metadata.max_age_seconds} 秒 · 宿主{' '}
|
||||
{readyInventory.metadata.host || '—'} · 快照 {readyInventory.metadata.generation || '—'}
|
||||
</p>
|
||||
{readyInventory.batches.length === 0 ? (
|
||||
<p className="hint">
|
||||
挂载可读,但没有批次目录(可能尚未执行,或挂载到了空目录);这不能证明备份成功或失败。
|
||||
宿主快照可读,但没有批次目录(可能尚未执行,或采集到空目录);这不能证明备份成功或失败。
|
||||
</p>
|
||||
) : null}
|
||||
{readyInventory.batches.map((batch, index) => {
|
||||
@@ -907,25 +931,28 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
<strong className={failedDatabases.length || batch.manifest_state !== 'ok' ? 'off' : 'ok'}>
|
||||
{failedDatabases.length
|
||||
? `有失败 ${failedDatabases.length} 个`
|
||||
: `实际占盘 ${formatBackupBytes(batch.actual_bytes)}`}
|
||||
: batch.actual_bytes === null
|
||||
? '占盘未知(采集不完整)'
|
||||
: `实际占盘 ${formatBackupBytes(batch.actual_bytes)}`}
|
||||
</strong>
|
||||
</summary>
|
||||
<p>
|
||||
批次戳 {batch.stamp} · 表观 {formatBackupBytes(batch.apparent_bytes)} · 实际占盘{' '}
|
||||
{formatBackupBytes(batch.actual_bytes)} · {batch.file_count} 个文件
|
||||
{batch.actual_bytes === null ? '未知' : formatBackupBytes(batch.actual_bytes)} ·{' '}
|
||||
{batch.file_count ?? '—'} 个文件
|
||||
{batch.duration_seconds ? ` · 耗时 ${batch.duration_seconds} 秒` : ''}
|
||||
{batch.kind ? ` · ${batch.kind}` : ''}
|
||||
</p>
|
||||
{batch.manifest_state === 'ok' ? null : (
|
||||
<p className="error-message">
|
||||
{batch.manifest_state === 'missing'
|
||||
? '此批次没有 MANIFEST.json:只能按目录统计占盘,无法确认完整性、耗时与库列表。'
|
||||
: `此批次清单损坏:${batch.manifest_error || '无法解析'};只能按目录统计占盘。`}
|
||||
? '此批次没有 MANIFEST.json:完整性、耗时与库列表无法确认;占盘仅在快照完整时可信。'
|
||||
: `此批次清单损坏:${batch.manifest_error || '无法解析'};库列表来自目录名,占盘仅在快照完整时可信。`}
|
||||
</p>
|
||||
)}
|
||||
{!batch.sizes_complete ? (
|
||||
<p className="error-message">
|
||||
实际占盘未扫全:{batch.sizes_error || '文件数超过上限'};显示的是已扫描部分。
|
||||
采集不完整:占盘未知({batch.sizes_error || '宿主采集器未给出完整统计'});不使用部分字节。
|
||||
</p>
|
||||
) : null}
|
||||
<div className="storage-path-row">
|
||||
@@ -934,7 +961,7 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
<button
|
||||
type="button"
|
||||
disabled={!batch.host_path}
|
||||
title={batch.host_path ? '复制完整主机路径' : '没有主机路径(只读盘点未配置主机根)'}
|
||||
title={batch.host_path ? '复制完整主机路径' : '没有主机路径(快照未配置主机根)'}
|
||||
onClick={(event) => void copyBackupPath(batch.host_path, event.currentTarget)}
|
||||
>
|
||||
复制目录
|
||||
@@ -949,7 +976,7 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
</span>
|
||||
<small>
|
||||
实际 {formatBackupBytes(database.actual_bytes)} · 表观{' '}
|
||||
{formatBackupBytes(database.apparent_bytes)} · {database.file_count} 个文件
|
||||
{formatBackupBytes(database.apparent_bytes)} · {database.file_count ?? '—'} 个文件
|
||||
{database.in_manifest ? '' : ' · 不在清单库列表'}
|
||||
</small>
|
||||
<div className="storage-path-row storage-sublibrary-path">
|
||||
@@ -983,14 +1010,16 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
{readyInventory.skipped.map((item) => `${item.name}(${item.reason})`).join(';')}
|
||||
</p>
|
||||
) : null}
|
||||
{readyInventory.truncated ? <p className="hint">目录或文件数超过扫描上限,列表与占盘为部分结果。</p> : null}
|
||||
{readyInventory.truncated ? (
|
||||
<p className="hint">快照被截断:批次或文件超过采集上限,占盘未知(不使用部分结果)。</p>
|
||||
) : null}
|
||||
<p className="hint">
|
||||
盘点采集于 {formatBackupMoment(readyInventory.observed_at)} · 挂载点 {readyInventory.root || '—'} · 来源{' '}
|
||||
{readyInventory.source || '—'}
|
||||
快照采集于 {formatBackupMoment(readyInventory.metadata.collected_at)} · 快照文件{' '}
|
||||
{readyInventory.metadata.path || '—'} · 来源 {readyInventory.source || '—'}
|
||||
</p>
|
||||
</>
|
||||
) : null}
|
||||
{!inventory && !inventoryLoading && !inventoryError ? <p className="hint">尚未读取只读盘点。</p> : null}
|
||||
{!inventory && !inventoryLoading && !inventoryError ? <p className="hint">尚未读取宿主元数据快照。</p> : null}
|
||||
</section>
|
||||
|
||||
<section className="storage-block" aria-labelledby="storage-host-heading">
|
||||
@@ -1035,7 +1064,7 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
|
||||
{schedule.last_run_stamp ? (runFailed ? ' · 有失败/读取错误' : ' · 成功') : ''}
|
||||
</dd>
|
||||
<dt>最近一次成功</dt>
|
||||
<dd>未从主机读取(不能用最近一次运行代替成功;历史批次以「备份记录」的只读盘点为准)</dd>
|
||||
<dd>未从主机读取(不能用最近一次运行代替成功;历史批次以「备份记录」的元数据快照为准)</dd>
|
||||
<dt>备份耗时 / 体积</dt>
|
||||
<dd>
|
||||
{schedule.last_run_stamp
|
||||
@@ -1285,7 +1314,7 @@ export function BackupScheduleSection() {
|
||||
inventoryLoading={inventoryLoading}
|
||||
inventoryError={inventoryError}
|
||||
onReloadInventory={() => void loadInventory()}
|
||||
// disk 不传:生产只认只读挂载盘点;disk 仅测试夹具用于验证告警分支。
|
||||
// disk 不传:生产只认宿主元数据快照;disk 仅测试夹具用于验证告警分支。
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user