mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
* admin/maintenance: report whether the running manager queues a task type Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: list the EC balancers that are active at the same time The plugin ec_balance job, the legacy maintenance manager's ec_balance task and an admin_script job that runs ec.balance -apply each plan shard moves from the same topology without knowing about the others. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: log a warning while more than one EC balancer is active The check runs on the maintenance metrics tick and logs again only when the set of active balancers changes. The legacy maintenance entry names the admin.toml switch that turns it off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: warn on the plugin pages when more than one EC balancer is active The scheduler status API returns the active EC balancers, and the scheduler banner on the plugin and lane pages lists them when there are two or more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin/maintenance: count a task type only when a registered worker can run it Only legacy maintenance workers pull tasks from the legacy queue. With plugin workers alone, the queued ec_balance tasks never run, so they do not compete with the plugin ec_balance job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: parse ec.balance apply flags like the flag package A value counts only when strconv.ParseBool reads it as true, and a # token ends the arguments, as it does for the shell command's flag parser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin/maintenance: skip legacy workers past their heartbeat timeout A disconnected worker keeps its queue record until the cleanup loop removes it, so the capability check also requires a heartbeat within the worker timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: count ec.balance only when its flags parse the way the command parses them An invalid boolean in -apply or -force fails the whole command, the last value of a flag wins, -force overrides -apply, and parsing stops at the first non-flag argument. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: share ec.balance's flag set and report whether its arguments apply the plan Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: count an admin_script ec.balance only when ec.balance accepts its flags Unknown flags and invalid values of any flag fail the command before it can move shards, so they no longer count as an active balancer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell, plugin/worker: move admin_script command tokenizing into the shell package Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: split admin_script ec.balance arguments with the executor's tokenizer A quoted value with spaces is one argument to ec.balance, so flags after it are still seen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: report through one lookup whether a command's arguments change the cluster ec.balance now also rejects an invalid -volumeIds, as its Do does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: report whether volume.balance arguments apply its plan Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: report whether ec.encode accepts its arguments ec.encode has no dry run, so any accepted invocation changes the cluster. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: report whether volume.vacuum accepts its arguments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: report overlap for every maintenance work that more than one scheduler runs The plugin scheduler, the legacy maintenance manager, and an admin_script can each run volume balance, EC balance, EC encoding, and vacuum. Check all four from one table and report each work with two or more active runners, in the log and in the scheduler-status API as maintenance_overlaps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: show each maintenance overlap on the plugin pages Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
84 lines
4.7 KiB
Templ
84 lines
4.7 KiB
Templ
package app
|
|
|
|
templ PluginSchedulerStatus() {
|
|
<div id="plugin-scheduler-blockers" aria-live="polite"></div>
|
|
<script>
|
|
window.renderPluginSchedulerStatus = function(data) {
|
|
const root = document.getElementById('plugin-scheduler-blockers');
|
|
if (!root) return;
|
|
root.replaceChildren();
|
|
(data.maintenance_overlaps || []).forEach(function(overlap) {
|
|
const runners = overlap.runners || [];
|
|
const box = document.createElement('div');
|
|
box.className = 'alert alert-warning';
|
|
const heading = document.createElement('strong');
|
|
heading.textContent = overlap.work + ' has ' + runners.length + ' independent runners';
|
|
box.appendChild(heading);
|
|
runners.forEach(function(name) {
|
|
const line = document.createElement('div');
|
|
line.textContent = name;
|
|
box.appendChild(line);
|
|
});
|
|
const hint = document.createElement('div');
|
|
hint.className = 'small mt-1';
|
|
hint.textContent = 'Each one plans from the same topology without knowing about the others, so their changes can collide. Keep only one enabled.';
|
|
box.appendChild(hint);
|
|
root.appendChild(box);
|
|
});
|
|
const lock = data.lock || {};
|
|
const waiters = lock.waiters || [];
|
|
if (waiters.length) {
|
|
const alert = document.createElement('div');
|
|
alert.className = 'alert alert-warning';
|
|
const title = document.createElement('strong');
|
|
title.textContent = 'Waiting for the maintenance lock';
|
|
alert.appendChild(title);
|
|
const owner = document.createElement('div');
|
|
owner.textContent = lock.holder ? 'Lock owner: ' + lock.holder : (lock.holder_error || 'Lock owner not reported');
|
|
if (lock.holder_message) owner.textContent += ' — ' + lock.holder_message;
|
|
alert.appendChild(owner);
|
|
waiters.forEach(function(waiter) {
|
|
const line = document.createElement('div');
|
|
const since = new Date(waiter.since);
|
|
const now = new Date((data.scheduler || {}).now || Date.now());
|
|
const seconds = Math.max(0, Math.floor((now - since) / 1000));
|
|
line.textContent = waiter.reason + ' · since ' + since.toLocaleString() +
|
|
' (local time) · waiting ' + Math.floor(seconds / 60) + 'm ' + (seconds % 60) + 's';
|
|
alert.appendChild(line);
|
|
});
|
|
const note = document.createElement('div');
|
|
note.className = 'small mt-1';
|
|
note.textContent = 'This lane cannot advance until the lock becomes available. A scheduled check time is not a guaranteed start time.';
|
|
alert.appendChild(note);
|
|
root.appendChild(alert);
|
|
}
|
|
const scheduler = data.scheduler || {};
|
|
const now = new Date(scheduler.now || Date.now());
|
|
(scheduler.job_types || []).forEach(function(job) {
|
|
if (data.job_type ? job.job_type !== data.job_type : !job.enabled) return;
|
|
const until = job.detection_eligible_at ? new Date(job.detection_eligible_at) : null;
|
|
const cooling = until && until > now;
|
|
if (!job.cooldown_error && !cooling && !(data.job_type && job.cooldown_seconds)) return;
|
|
const box = document.createElement('div');
|
|
box.className = 'alert ' + (job.cooldown_error ? 'alert-warning' : 'alert-info');
|
|
const title = document.createElement('strong');
|
|
title.textContent = job.job_type + ': ' + (job.cooldown_error || (cooling ? 'Cooldown after successful job' : until ? 'Cooldown elapsed' : 'No successful job yet'));
|
|
box.appendChild(title);
|
|
const line = document.createElement('div');
|
|
const seconds = job.cooldown_seconds || 0;
|
|
const duration = seconds >= 3600 ? (seconds / 3600) + ' hours' : seconds >= 60 ? (seconds / 60) + ' minutes' : seconds + ' seconds';
|
|
line.textContent = 'Configured cooldown: ' + duration + ' (' + seconds + ' seconds).';
|
|
if (job.last_successful_run_at) line.textContent += ' Last success: ' + new Date(job.last_successful_run_at).toLocaleString() + '.';
|
|
if (until) line.textContent += ' Eligible after: ' + until.toLocaleString() + '.';
|
|
if (cooling) line.textContent += ' Remaining: ' + Math.ceil((until - now) / 60000) + ' minutes.';
|
|
box.appendChild(line);
|
|
const note = document.createElement('div');
|
|
note.className = 'small mt-1';
|
|
note.textContent = 'Applies across this job type. Locks and other jobs in the lane can delay the actual start.';
|
|
box.appendChild(note);
|
|
root.appendChild(box);
|
|
});
|
|
};
|
|
</script>
|
|
}
|