Skip to content
Draft
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
28 changes: 21 additions & 7 deletions pkg/ddc/jindo/load_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,27 @@ func (e *JindoEngine) genDataLoadValue(image string, runtime *datav1alpha1.Jindo
}

targetPaths := []cdataload.TargetPath{}
for _, target := range dataload.Spec.Target {
fluidNative := utils.IsTargetPathUnderFluidNativeMounts(target.Path, *targetDataset)
targetPaths = append(targetPaths, cdataload.TargetPath{
Path: target.Path,
Replicas: target.Replicas,
FluidNative: fluidNative,
})
if len(dataload.Spec.Target) > 0 {
for _, target := range dataload.Spec.Target {
fluidNative := utils.IsTargetPathUnderFluidNativeMounts(target.Path, *targetDataset)
targetPaths = append(targetPaths, cdataload.TargetPath{
Path: target.Path,
Replicas: target.Replicas,
FluidNative: fluidNative,
})
}
} else {
for _, m := range targetDataset.Spec.Mounts {
if m.Path == "" {
continue
}
fluidNative := utils.IsTargetPathUnderFluidNativeMounts(m.Path, *targetDataset)
targetPaths = append(targetPaths, cdataload.TargetPath{
Path: m.Path,
Comment on lines +174 to +179
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

When mount.Path is empty, the code skips that mount entirely. According to the UFSPathBuilder.GenUFSPathInUnifiedNamespace convention, if mount.Path is not set, the path should default to /{mount.Name}. Consider using GenUFSPathInUnifiedNamespace to get the correct path instead of skipping mounts with empty paths, to ensure consistency with how mount paths are handled elsewhere in the codebase.

Suggested change
if m.Path == "" {
continue
}
fluidNative := utils.IsTargetPathUnderFluidNativeMounts(m.Path, *targetDataset)
targetPaths = append(targetPaths, cdataload.TargetPath{
Path: m.Path,
mountPath := m.Path
if mountPath == "" {
mountPath = "/" + m.Name
}
fluidNative := utils.IsTargetPathUnderFluidNativeMounts(mountPath, *targetDataset)
targetPaths = append(targetPaths, cdataload.TargetPath{
Path: mountPath,

Copilot uses AI. Check for mistakes.
Replicas: 1,
FluidNative: fluidNative,
})
}
}
Comment on lines +172 to 184
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

The same issue likely exists in JindoCache and JindoFsx runtimes. Both pkg/ddc/jindocache/load_data.go and pkg/ddc/jindofsx/load_data.go iterate directly over dataload.Spec.Target without handling the empty target case. Consider applying this same fix to those runtimes for consistency and to prevent the same bug from affecting users of those runtime types.

Copilot uses AI. Check for mistakes.
dataloadInfo.TargetPaths = targetPaths
options := map[string]string{}
Expand Down
136 changes: 136 additions & 0 deletions pkg/ddc/jindo/load_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,142 @@ func Test_genDataLoadValue(t *testing.T) {
runtime *datav1alpha1.JindoRuntime
want *cdataload.DataLoadValue
}{
"dataset without mounts and no explicit target": {
image: "fluid:v0.0.1",
targetDataset: &datav1alpha1.Dataset{
ObjectMeta: metav1.ObjectMeta{
Name: "test-dataset",
Namespace: "fluid",
},
Spec: datav1alpha1.DatasetSpec{},
},
dataload: &datav1alpha1.DataLoad{
ObjectMeta: metav1.ObjectMeta{
Name: "test-dataload",
Namespace: "fluid",
},
Spec: datav1alpha1.DataLoadSpec{
Dataset: datav1alpha1.TargetDataset{
Name: "test-dataset",
Namespace: "fluid",
},
},
},
runtime: &datav1alpha1.JindoRuntime{
Spec: datav1alpha1.JindoRuntimeSpec{
TieredStore: datav1alpha1.TieredStore{
Levels: []datav1alpha1.Level{
{
MediumType: "MEM",
},
},
},
HadoopConfig: "principal=root",
},
},
want: &cdataload.DataLoadValue{
Name: "test-dataload",
OwnerDatasetId: "fluid-test-dataset",
Owner: &common.OwnerReference{
APIVersion: "/",
Enabled: true,
Name: "test-dataload",
BlockOwnerDeletion: false,
Controller: true,
},
DataLoadInfo: cdataload.DataLoadInfo{
BackoffLimit: 3,
Image: "fluid:v0.0.1",
TargetDataset: "test-dataset",
TargetPaths: []cdataload.TargetPath{},
ImagePullSecrets: []corev1.LocalObjectReference{},
Options: map[string]string{
"loadMemorydata": "true",
"hdfsConfig": "principal=root",
},
},
},
},
"dataset with multiple mounts and no explicit target": {
image: "fluid:v0.0.1",
targetDataset: &datav1alpha1.Dataset{
ObjectMeta: metav1.ObjectMeta{
Name: "test-dataset",
Namespace: "fluid",
},
Spec: datav1alpha1.DatasetSpec{
Mounts: []datav1alpha1.Mount{
{
Name: "spark-0",
MountPoint: "local://mnt/data0",
Path: "/mnt0",
},
{
Name: "spark-1",
MountPoint: "local://mnt/data1",
Path: "/mnt1",
},
},
},
},
dataload: &datav1alpha1.DataLoad{
ObjectMeta: metav1.ObjectMeta{
Name: "test-dataload",
Namespace: "fluid",
},
Spec: datav1alpha1.DataLoadSpec{
Dataset: datav1alpha1.TargetDataset{
Name: "test-dataset",
Namespace: "fluid",
},
},
},
runtime: &datav1alpha1.JindoRuntime{
Spec: datav1alpha1.JindoRuntimeSpec{
TieredStore: datav1alpha1.TieredStore{
Levels: []datav1alpha1.Level{
{
MediumType: "MEM",
},
},
},
HadoopConfig: "principal=root",
},
},
want: &cdataload.DataLoadValue{
Name: "test-dataload",
OwnerDatasetId: "fluid-test-dataset",
Owner: &common.OwnerReference{
APIVersion: "/",
Enabled: true,
Name: "test-dataload",
BlockOwnerDeletion: false,
Controller: true,
},
DataLoadInfo: cdataload.DataLoadInfo{
BackoffLimit: 3,
Image: "fluid:v0.0.1",
TargetDataset: "test-dataset",
TargetPaths: []cdataload.TargetPath{
{
Path: "/mnt0",
Replicas: 1,
FluidNative: true,
},
{
Path: "/mnt1",
Replicas: 1,
FluidNative: true,
},
},
ImagePullSecrets: []corev1.LocalObjectReference{},
Options: map[string]string{
"loadMemorydata": "true",
"hdfsConfig": "principal=root",
},
},
},
},
"test case with scheduler name": {
image: "fluid:v0.0.1",
targetDataset: &datav1alpha1.Dataset{
Expand Down
Loading