Skip to content

Add comments This PR is to add comments to TestGenerateDataBackupValueFileInvalidObject in pkg/ddc/alluxio/backup_data_test.go.backup data invalid object#6005

Open
letyoudown wants to merge 2 commits into
fluid-cloudnative:masterfrom
letyoudown:add-comments-backup-data-invalid-object
Open

Add comments This PR is to add comments to TestGenerateDataBackupValueFileInvalidObject in pkg/ddc/alluxio/backup_data_test.go.backup data invalid object#6005
letyoudown wants to merge 2 commits into
fluid-cloudnative:masterfrom
letyoudown:add-comments-backup-data-invalid-object

Conversation

@letyoudown

Copy link
Copy Markdown

Ⅰ. Describe what this PR does

This PR adds comments to TestGenerateDataBackupValueFileInvalidObject in pkg/ddc/alluxio/backup_data_test.go. The comments explain that the test verifies generateDataBackupValueFile rejects invalid object types and does not create a value file.

Ⅱ. Does this pull request fix one issue?

fixes #6004

Ⅲ. Special notes for reviews

None.

@fluid-e2e-bot

fluid-e2e-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign cheyang for approval by writing /assign @cheyang in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fluid-e2e-bot

fluid-e2e-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

Hi @letyoudown. Thanks for your PR.

I'm waiting for a fluid-cloudnative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sonarqubecloud

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a three-stage MapReduce program in Java (InvertedIndex.java) to build a document inverted index, complete with helper bash scripts for building and running the tasks, and a minor test comment update in Go. The reviewer's feedback highlights critical performance optimizations for MapReduce, specifically recommending the reuse of Writable objects (SortKey and Text) within the mapper to minimize garbage collection overhead during execution.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread lab2/InvertedIndex.java
Comment on lines +228 to +234
public SortKey() {
}

public SortKey(int total, String word) {
this.total.set(total);
this.word.set(word);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To avoid excessive garbage collection overhead in MapReduce, it is a best practice to reuse Writable objects instead of instantiating them for every record. Let's add a set method to SortKey so it can be reused in the Mapper.

Suggested change
public SortKey() {
}
public SortKey(int total, String word) {
this.total.set(total);
this.word.set(word);
}
public SortKey() {
}
public SortKey(int total, String word) {
this.total.set(total);
this.word.set(word);
}
public void set(int total, String word) {
this.total.set(total);
this.word.set(word);
}

Comment thread lab2/InvertedIndex.java
Comment on lines +289 to +313
public static class SortMapper extends Mapper<LongWritable, Text, SortKey, Text> {
private final Text outValue = new Text();

@Override
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
String line = value.toString();
if (line == null || line.isEmpty()) {
return;
}

int firstTab = line.indexOf('\t');
if (firstTab < 0 || firstTab == line.length() - 1) {
return;
}

String word = line.substring(0, firstTab);
String remainder = line.substring(firstTab + 1);
int secondTab = remainder.indexOf('\t');
String totalStr = secondTab >= 0 ? remainder.substring(0, secondTab) : remainder;
int total = Integer.parseInt(totalStr.trim());

outValue.set(remainder);
context.write(new SortKey(total, word), outValue);
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Reuse the SortKey and Text instances as class member variables to avoid creating a new SortKey object for every input record in the map method. This significantly reduces GC overhead during the sorting phase.

    public static class SortMapper extends Mapper<LongWritable, Text, SortKey, Text> {
        private final SortKey outKey = new SortKey();
        private final Text outValue = new Text();

        @Override
        protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
            String line = value.toString();
            if (line == null || line.isEmpty()) {
                return;
            }

            int firstTab = line.indexOf('\t');
            if (firstTab < 0 || firstTab == line.length() - 1) {
                return;
            }

            String word = line.substring(0, firstTab);
            String remainder = line.substring(firstTab + 1);
            int secondTab = remainder.indexOf('\t');
            String totalStr = secondTab >= 0 ? remainder.substring(0, secondTab) : remainder;
            int total = Integer.parseInt(totalStr.trim());

            outValue.set(remainder);
            outKey.set(total, word);
            context.write(outKey, outValue);
        }
    }

@cheyang

cheyang commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

The comment addition to TestGenerateDataBackupValueFileInvalidObject looks fine, but this PR also includes an entire lab2/ directory with unrelated Hadoop homework files (+565 lines). Please remove those files and push a clean commit with only the intended comment change.

Comment thread lab2/InvertedIndex.java
@@ -0,0 +1,465 @@
import java.io.BufferedReader;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This PR adds an entire lab2/ directory (465-line Java MapReduce program, shell scripts, README) that has nothing to do with the Fluid project. It looks like homework files were accidentally committed. Please remove the lab2/ directory and keep only the doc comment change in pkg/ddc/alluxio/backup_data_test.go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add comments to TestGenerateDataBackupValueFileInvalidObject in pkg/ddc/alluxio/backup_data_test.go.

2 participants