mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-11-24 08:46:54 +08:00
Admin UI: Fetch task logs (#7114)
* show task details * loading tasks * task UI works * generic rendering * rendering the export link * removing placementConflicts from task parameters * remove TaskSourceLocation * remove "Server ID" column * rendering balance task source * sources and targets * fix ec task generation * move info * render timeline * simplified worker id * simplify * read task logs from worker * isValidTaskID * address comments * Update weed/worker/tasks/balance/execution.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update weed/worker/tasks/erasure_coding/ec_task.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update weed/worker/tasks/task_log_handler.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix shard ids * plan distributing shard id * rendering planned shards in task details * remove Conflicts * worker logs correctly * pass in dc and rack * task logging * Update weed/admin/maintenance/maintenance_queue.go Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * display log details * logs have fields now * sort field keys * fix link * fix collection filtering * avoid hard coded ec shard counts --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -94,21 +94,23 @@ message TaskAssignment {
|
||||
|
||||
// TaskParams contains task-specific parameters with typed variants
|
||||
message TaskParams {
|
||||
string task_id = 12; // ActiveTopology task ID for lifecycle management
|
||||
uint32 volume_id = 1;
|
||||
string server = 2;
|
||||
string collection = 3;
|
||||
string data_center = 4;
|
||||
string rack = 5;
|
||||
repeated string replicas = 6;
|
||||
uint64 volume_size = 11; // Original volume size in bytes for tracking size changes
|
||||
string task_id = 1; // ActiveTopology task ID for lifecycle management
|
||||
uint32 volume_id = 2; // Primary volume ID for the task
|
||||
string collection = 3; // Collection name
|
||||
string data_center = 4; // Primary data center
|
||||
string rack = 5; // Primary rack
|
||||
uint64 volume_size = 6; // Original volume size in bytes for tracking size changes
|
||||
|
||||
// Unified source and target arrays for all task types
|
||||
repeated TaskSource sources = 7; // Source locations (volume replicas, EC shards, etc.)
|
||||
repeated TaskTarget targets = 8; // Target locations (destinations, new replicas, etc.)
|
||||
|
||||
// Typed task parameters
|
||||
oneof task_params {
|
||||
VacuumTaskParams vacuum_params = 7;
|
||||
ErasureCodingTaskParams erasure_coding_params = 8;
|
||||
BalanceTaskParams balance_params = 9;
|
||||
ReplicationTaskParams replication_params = 10;
|
||||
VacuumTaskParams vacuum_params = 9;
|
||||
ErasureCodingTaskParams erasure_coding_params = 10;
|
||||
BalanceTaskParams balance_params = 11;
|
||||
ReplicationTaskParams replication_params = 12;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,54 +125,48 @@ message VacuumTaskParams {
|
||||
|
||||
// ErasureCodingTaskParams for EC encoding operations
|
||||
message ErasureCodingTaskParams {
|
||||
uint64 estimated_shard_size = 3; // Estimated size per shard
|
||||
int32 data_shards = 4; // Number of data shards (default: 10)
|
||||
int32 parity_shards = 5; // Number of parity shards (default: 4)
|
||||
string working_dir = 6; // Working directory for EC processing
|
||||
string master_client = 7; // Master server address
|
||||
bool cleanup_source = 8; // Whether to cleanup source volume after EC
|
||||
repeated string placement_conflicts = 9; // Any placement rule conflicts
|
||||
repeated ECDestination destinations = 10; // Planned destinations with disk information
|
||||
repeated ExistingECShardLocation existing_shard_locations = 11; // Existing EC shards to cleanup
|
||||
uint64 estimated_shard_size = 1; // Estimated size per shard
|
||||
int32 data_shards = 2; // Number of data shards (default: 10)
|
||||
int32 parity_shards = 3; // Number of parity shards (default: 4)
|
||||
string working_dir = 4; // Working directory for EC processing
|
||||
string master_client = 5; // Master server address
|
||||
bool cleanup_source = 6; // Whether to cleanup source volume after EC
|
||||
}
|
||||
|
||||
// ECDestination represents a planned destination for EC shards with disk information
|
||||
message ECDestination {
|
||||
// TaskSource represents a unified source location for any task type
|
||||
message TaskSource {
|
||||
string node = 1; // Source server address
|
||||
uint32 disk_id = 2; // Source disk ID
|
||||
string rack = 3; // Source rack for tracking
|
||||
string data_center = 4; // Source data center for tracking
|
||||
uint32 volume_id = 5; // Volume ID (for volume operations)
|
||||
repeated uint32 shard_ids = 6; // Shard IDs (for EC shard operations)
|
||||
uint64 estimated_size = 7; // Estimated size to be processed
|
||||
}
|
||||
|
||||
// TaskTarget represents a unified target location for any task type
|
||||
message TaskTarget {
|
||||
string node = 1; // Target server address
|
||||
uint32 disk_id = 2; // Target disk ID
|
||||
string rack = 3; // Target rack for placement tracking
|
||||
string data_center = 4; // Target data center for placement tracking
|
||||
double placement_score = 5; // Quality score of the placement
|
||||
uint32 disk_id = 2; // Target disk ID
|
||||
string rack = 3; // Target rack for tracking
|
||||
string data_center = 4; // Target data center for tracking
|
||||
uint32 volume_id = 5; // Volume ID (for volume operations)
|
||||
repeated uint32 shard_ids = 6; // Shard IDs (for EC shard operations)
|
||||
uint64 estimated_size = 7; // Estimated size to be created
|
||||
}
|
||||
|
||||
// ExistingECShardLocation represents existing EC shards that need cleanup
|
||||
message ExistingECShardLocation {
|
||||
string node = 1; // Server address with existing shards
|
||||
repeated uint32 shard_ids = 2; // List of shard IDs on this server
|
||||
}
|
||||
|
||||
|
||||
// BalanceTaskParams for volume balancing operations
|
||||
message BalanceTaskParams {
|
||||
string dest_node = 1; // Planned destination node
|
||||
uint64 estimated_size = 2; // Estimated volume size
|
||||
string dest_rack = 3; // Destination rack for placement rules
|
||||
string dest_dc = 4; // Destination data center
|
||||
double placement_score = 5; // Quality score of the planned placement
|
||||
repeated string placement_conflicts = 6; // Any placement rule conflicts
|
||||
bool force_move = 7; // Force move even with conflicts
|
||||
int32 timeout_seconds = 8; // Operation timeout
|
||||
bool force_move = 1; // Force move even with conflicts
|
||||
int32 timeout_seconds = 2; // Operation timeout
|
||||
}
|
||||
|
||||
// ReplicationTaskParams for adding replicas
|
||||
message ReplicationTaskParams {
|
||||
string dest_node = 1; // Planned destination node for new replica
|
||||
uint64 estimated_size = 2; // Estimated replica size
|
||||
string dest_rack = 3; // Destination rack for placement rules
|
||||
string dest_dc = 4; // Destination data center
|
||||
double placement_score = 5; // Quality score of the planned placement
|
||||
repeated string placement_conflicts = 6; // Any placement rule conflicts
|
||||
int32 replica_count = 7; // Target replica count
|
||||
bool verify_consistency = 8; // Verify replica consistency after creation
|
||||
int32 replica_count = 1; // Target replica count
|
||||
bool verify_consistency = 2; // Verify replica consistency after creation
|
||||
}
|
||||
|
||||
// TaskUpdate reports task progress
|
||||
@@ -329,4 +325,75 @@ message BalanceTaskConfig {
|
||||
// ReplicationTaskConfig contains replication-specific configuration
|
||||
message ReplicationTaskConfig {
|
||||
int32 target_replica_count = 1; // Target number of replicas
|
||||
}
|
||||
|
||||
// ========== Task Persistence Messages ==========
|
||||
|
||||
// MaintenanceTaskData represents complete task state for persistence
|
||||
message MaintenanceTaskData {
|
||||
string id = 1;
|
||||
string type = 2;
|
||||
string priority = 3;
|
||||
string status = 4;
|
||||
uint32 volume_id = 5;
|
||||
string server = 6;
|
||||
string collection = 7;
|
||||
TaskParams typed_params = 8;
|
||||
string reason = 9;
|
||||
int64 created_at = 10;
|
||||
int64 scheduled_at = 11;
|
||||
int64 started_at = 12;
|
||||
int64 completed_at = 13;
|
||||
string worker_id = 14;
|
||||
string error = 15;
|
||||
double progress = 16;
|
||||
int32 retry_count = 17;
|
||||
int32 max_retries = 18;
|
||||
|
||||
// Enhanced fields for detailed task tracking
|
||||
string created_by = 19;
|
||||
string creation_context = 20;
|
||||
repeated TaskAssignmentRecord assignment_history = 21;
|
||||
string detailed_reason = 22;
|
||||
map<string, string> tags = 23;
|
||||
TaskCreationMetrics creation_metrics = 24;
|
||||
}
|
||||
|
||||
// TaskAssignmentRecord tracks worker assignments for a task
|
||||
message TaskAssignmentRecord {
|
||||
string worker_id = 1;
|
||||
string worker_address = 2;
|
||||
int64 assigned_at = 3;
|
||||
int64 unassigned_at = 4; // Optional: when worker was unassigned
|
||||
string reason = 5; // Reason for assignment/unassignment
|
||||
}
|
||||
|
||||
// TaskCreationMetrics tracks why and how a task was created
|
||||
message TaskCreationMetrics {
|
||||
string trigger_metric = 1; // Name of metric that triggered creation
|
||||
double metric_value = 2; // Value that triggered creation
|
||||
double threshold = 3; // Threshold that was exceeded
|
||||
VolumeHealthMetrics volume_metrics = 4; // Volume health at creation time
|
||||
map<string, string> additional_data = 5; // Additional context data
|
||||
}
|
||||
|
||||
// VolumeHealthMetrics captures volume state at task creation
|
||||
message VolumeHealthMetrics {
|
||||
uint64 total_size = 1;
|
||||
uint64 used_size = 2;
|
||||
uint64 garbage_size = 3;
|
||||
double garbage_ratio = 4;
|
||||
int32 file_count = 5;
|
||||
int32 deleted_file_count = 6;
|
||||
int64 last_modified = 7;
|
||||
int32 replica_count = 8;
|
||||
bool is_ec_volume = 9;
|
||||
string collection = 10;
|
||||
}
|
||||
|
||||
// TaskStateFile wraps task data with metadata for persistence
|
||||
message TaskStateFile {
|
||||
MaintenanceTaskData task = 1;
|
||||
int64 last_updated = 2;
|
||||
string admin_version = 3;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user