Skip to content

Conversation

@inv-jishnu
Copy link
Contributor

@inv-jishnu inv-jishnu commented Nov 19, 2025

Description

In this PR, I fixed an issue where failure logs were not written in storage mode due to an incorrect flag check. The logic has been updated so that the log raw record check happens at the point where the record is added to the import result object, instead of right before writing the log. The problem only appeared in storage mode because the previous check was located inside the log-writing method used exclusively for that mode.

Related issues and/or PRs

NA

Changes made

  • Removed the flag check for raw records from the log writing method. This caused failure logs to not write properly when raw record flag was enabled.
  • Moved the raw record to import task class in which the raw record data is added to import result. This ensures the raw record is only included when the flag is actually set.

I have tested the changes in my local environment with storage and transaction mode with single log and split log modes.

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • I have considered whether similar issues could occur in other products, components, or modules if this PR is for bug fixes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

NA

Release notes

Fixed failure log writing issue in storage mode for Data Loader imports

@inv-jishnu inv-jishnu self-assigned this Nov 19, 2025
@inv-jishnu inv-jishnu requested a review from thongdk8 November 19, 2025 11:47
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @inv-jishnu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical bug in the data loader's import mechanism where failure logs were not being generated correctly, particularly when operating in storage mode and with raw record logging enabled. The changes refactor the logging logic to ensure that all failure records are consistently logged, regardless of the raw record flag, and centralize the conditional inclusion of raw records in the import results.

Highlights

  • Failure Log Fix: Resolved an issue where failure logs were not being written for data loader imports when operating in storage mode, particularly when the raw record logging flag was enabled.
  • Logging Logic Refinement: Removed an early exit condition in onTaskComplete methods of SingleFileImportLogger and SplitByDataChunkImportLogger that incorrectly prevented log writing if both success and raw record logging were disabled.
  • Conditional Raw Record Inclusion: Introduced a new helper method getRecordForLogging in ImportTask to centralize and correctly apply the logic for conditionally including raw source records in ImportTargetResult objects, ensuring they are only added when the isLogRawRecord configuration is enabled.
  • Simplified Failure Logging: Modified the writeImportTaskResultDetailToLogs methods in both SingleFileImportLogger and SplitByDataChunkImportLogger to remove the isLogRawSourceRecordsEnabled() check for failure logs, ensuring all import failures are consistently logged.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 effectively addresses the issue of failure logs not being written. The changes in SingleFileImportLogger and SplitByDataChunkImportLogger correctly decouple failure logging from the raw record logging flag. The refactoring in ImportTask to introduce getRecordForLogging and centralize the logic for including raw records is a great improvement for code clarity and maintainability. I have one suggestion to further improve the maintainability of ImportTask.java by reducing some code duplication.

@ypeckstadt ypeckstadt changed the title Fix failure log write issue in storage mode for data loader import Fix failure log writing issue in storage mode for Data Loader imports Nov 20, 2025
Copy link
Contributor

@ypeckstadt ypeckstadt left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you.

@ypeckstadt ypeckstadt requested review from a team, Torch3333, brfrn169, feeblefakie and komamitsu and removed request for a team November 20, 2025 00:13
@ypeckstadt
Copy link
Contributor

@inv-jishnu This fix can be ported to 3.16.2 patch release right?

@brfrn169
Copy link
Collaborator

@inv-jishnu Could you please fix the Gradle check failure in CI?

@inv-jishnu
Copy link
Contributor Author

@inv-jishnu Could you please fix the Gradle check failure in CI?

@brfrn169 san,
I re-ran the gradle check test and it was completed successfully. I did this as I could not find any issue when I ran the tests locally.

@inv-jishnu inv-jishnu requested a review from komamitsu November 20, 2025 03:49
Copy link
Collaborator

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

Copy link
Contributor

@komamitsu komamitsu left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

Copy link
Contributor

@thongdk8 thongdk8 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@feeblefakie feeblefakie merged commit 7f9d80e into master Nov 21, 2025
138 of 140 checks passed
@feeblefakie feeblefakie deleted the fix/data-loader/raw-record-issue branch November 21, 2025 02:41
feeblefakie pushed a commit that referenced this pull request Nov 21, 2025
…#3189)

Co-authored-by: Toshihiro Suzuki <brfrn169@gmail.com>
feeblefakie pushed a commit that referenced this pull request Nov 21, 2025
…#3189)

Co-authored-by: Toshihiro Suzuki <brfrn169@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants