Skip to content

Conversation

@Torch3333
Copy link
Contributor

@Torch3333 Torch3333 commented Sep 4, 2025

Description

This changes the default mapping for Db2 BLOB column to a data type that allows storing up to 2GB. This changes addresses concerns that the original data type only allowed to store up 32KB which was deemed too restrictive.

The new Db2 data type used is named BLOB and its maximum capacity is 2GB for Db2 LUW, which also coincides with the maximum capacity that the backing object byte[] of BlobColumn object can hold.

Because of limitations of the Db2 BLOB data type, ScalarDB BLOB column can no longer be used as :

  • primary key
  • clustering key
  • secondary index
  • an ordering column in a cross-partition scan, .i.e ScanAll, operation

Related issues and/or PRs

Changes made

  • Changes the default mapping for ScalarDB BLOB column in Db2 from VARBINARY(32672) to BLOB(2G)
  • Disable some integration tests that can no longer be run on a BLOB column because of the limitations mentioned above

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)

Provide any additional information or notes that may be relevant to the reviewers or stakeholders.

Release notes

When using Db2, the default data type used for ScalarDB BLOB column from Db2 is changed from VARBINARY(32672) to BLOB(2G) to allow storing data up to 2GB. This brings new limitations that a BLOB column can no longer be used as partition key, clustering key, secondary index or as an ordering column in a cross-partitions scan, .i.e. ScanAll, operation.

@Torch3333 Torch3333 self-assigned this Sep 4, 2025
@Torch3333 Torch3333 force-pushed the db2_change_blob_type_mapping branch 2 times, most recently from f2b485b to 8ef0b7b Compare September 4, 2025 05:25
@Torch3333 Torch3333 force-pushed the db2_change_blob_type_mapping branch from 51f8972 to 683f011 Compare September 4, 2025 05:50
@Torch3333 Torch3333 changed the title Change default mapping for BLOB column for Db2 from "VARBINARY(32672)… For IBM Db2, change the data type for BLOB column to support storing very large data Sep 4, 2025
@Torch3333 Torch3333 changed the title For IBM Db2, change the data type for BLOB column to support storing very large data For IBM Db2, change the data type for BLOB column to support storing up to 2GB. Sep 4, 2025
@Torch3333 Torch3333 marked this pull request as ready for review September 4, 2025 07:25
@Torch3333 Torch3333 marked this pull request as draft September 4, 2025 07:33
@Torch3333 Torch3333 marked this pull request as ready for review September 4, 2025 08:02
@Torch3333 Torch3333 requested review from a team, brfrn169, feeblefakie and komamitsu and removed request for a team September 4, 2025 08:02
@brfrn169 brfrn169 changed the title For IBM Db2, change the data type for BLOB column to support storing up to 2GB. For IBM Db2, change the data type for BLOB column to support storing up to 2GB Sep 5, 2025
…e_mapping

# Conflicts:
#	core/src/integration-test/java/com/scalar/db/storage/jdbc/ConsensusCommitAdminIntegrationTestWithJdbcDatabase.java
#	core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminCaseSensitivityIntegrationTest.java
#	core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminIntegrationTest.java
#	core/src/integration-test/java/com/scalar/db/storage/jdbc/SingleCrudOperationTransactionAdminIntegrationTestWithJdbcDatabase.java
#	core/src/integration-test/java/com/scalar/db/transaction/jdbc/JdbcTransactionAdminIntegrationTest.java
#	core/src/main/java/com/scalar/db/common/CoreError.java
@Torch3333 Torch3333 requested a review from komamitsu September 19, 2025 02:38
@Torch3333
Copy link
Contributor Author

/gemini review

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 increases the BLOB size limit for Db2 by changing the data type to BLOB(2G). The associated limitations are handled well with new checks and error messages, and the integration tests are updated accordingly. I've identified a few areas in the unit tests where the changes to accommodate Db2's new limitations have unintentionally reduced test coverage for other databases. My review includes suggestions to conditionally adapt the tests based on the RDB engine to maintain this coverage.

@Torch3333 Torch3333 requested a review from brfrn169 September 19, 2025 05:08
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.

Left minor comments. Other than that, 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!

@Copilot Copilot AI review requested due to automatic review settings September 22, 2025 01:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR changes the IBM Db2 BLOB column data type mapping from VARBINARY(32672) to BLOB(2G) to support storing up to 2GB of data. Due to limitations of the Db2 BLOB data type, BLOB columns can no longer be used as primary keys, clustering keys, secondary indexes, or in ordering operations for cross-partition scans.

  • Changes Db2 BLOB column mapping to support 2GB storage capacity
  • Implements validation to prevent BLOB columns from being used as keys or indexes in Db2
  • Updates integration tests to conditionally skip BLOB-related tests for Db2

Reviewed Changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
RdbEngineDb2.java Changes BLOB data type mapping and adds validation for unsupported BLOB operations
JdbcOperationChecker.java New operation checker that validates cross-partition scan ordering on BLOB columns
CoreError.java Adds new error messages for Db2 BLOB column restrictions
JdbcDatabase.java Updates to use the new JdbcOperationChecker
OperationChecker.java Makes checkOrderingsForScanAll method protected for extension
Integration test files Updates test methods to conditionally skip BLOB-related operations for Db2

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Torch3333 Torch3333 requested a review from komamitsu September 24, 2025 02:04
…e_mapping

# Conflicts:
#	core/src/main/java/com/scalar/db/common/CoreError.java
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, thank you!

@brfrn169 brfrn169 merged commit f1765d6 into master Sep 24, 2025
105 of 108 checks passed
@brfrn169 brfrn169 deleted the db2_change_blob_type_mapping branch September 24, 2025 05:34
Torch3333 added a commit that referenced this pull request Sep 24, 2025
…up to 2GB (#3000)

# Conflicts:
#	core/src/test/java/com/scalar/db/storage/jdbc/JdbcAdminTestBase.java
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.

4 participants