Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion api/eventlog/db/eventFilePlugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,14 @@ func (m *EventFilePlugin) downloadWithRetry(eventID, localPath string) error {
maxRetries := 3
retryDelay := time.Second

// 构造正确的 S3 路径:从 localPath 中提取相对于 HomePath 的路径
// localPath 格式: /xxx/grdata/eventlog/eventID.log
// 需要构造成: grdata/eventlog/eventID.log
Comment on lines +207 to +209
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment on line 208 is now misleading. The localPath parameter is no longer used in the path construction logic, so describing its expected format is confusing. Consider updating the comment to reflect that the S3 path is constructed directly from the eventID parameter instead.

Suggested change
// 构造正确的 S3 路径:从 localPath 中提取相对于 HomePath 的路径
// localPath 格式: /xxx/grdata/eventlog/eventID.log
// 需要构造成: grdata/eventlog/eventID.log
// 构造正确的 S3 路径: 直接根据 eventID 构建 S3 路径
// S3 路径格式: grdata/eventlog/eventID.log

Copilot uses AI. Check for mistakes.
s3Path := path.Join("grdata", "eventlog", eventID+".log")

for attempt := 1; attempt <= maxRetries; attempt++ {
err := storage.Default().StorageCli.DownloadFileToDir(
path.Join("grdata", localPath),
s3Path,
path.Join(m.HomePath, "eventlog"),
)
if err == nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/component/storage/s3_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,8 @@ func (s3s *S3Storage) DownloadDirToDir(srcDir, dstDir string) error {
}

func (s3s *S3Storage) DownloadFileToDir(srcFile, dstDir string) error {
// 解析 S3 路径
bucketName, key, err := s3s.ParseDirPath(srcFile, false)
// 解析 S3 路径 - 第二个参数应该是 true,因为 srcFile 是文件路径而不是目录
bucketName, key, err := s3s.ParseDirPath(srcFile, true)
if err != nil {
return fmt.Errorf("解析源路径失败: %v", err)
}
Expand Down
Loading