Skip to content

Improve oracle support in SMT - #1393

Open
dhwanilpatel wants to merge 6 commits into
GoogleCloudPlatform:masterfrom
dhwanilpatel:oracle_support
Open

Improve oracle support in SMT#1393
dhwanilpatel wants to merge 6 commits into
GoogleCloudPlatform:masterfrom
dhwanilpatel:oracle_support

Conversation

@dhwanilpatel

Copy link
Copy Markdown
Contributor

Improve existing oracle support for schema migration in spanner migration tool.

@dhwanilpatel
dhwanilpatel requested a review from a team as a code owner August 31, 2026 13:44
@dhwanilpatel
dhwanilpatel requested review from manitgupta and sm745052 and removed request for a team August 31, 2026 13:45
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.54920% with 85 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.28%. Comparing base (10c9e29) to head (981ef6f).

Files with missing lines Patch % Lines
sources/oracle/infoschema.go 81.40% 37 Missing and 8 partials ⚠️
assessment/sources/oracle/infoschema.go 0.00% 27 Missing ⚠️
sources/oracle/toddl.go 95.59% 7 Missing ⚠️
assessment/collectors/infoschema_collector.go 0.00% 5 Missing ⚠️
...omponents/object-detail/object-detail.component.ts 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1393      +/-   ##
==========================================
+ Coverage   51.19%   51.28%   +0.09%     
==========================================
  Files         202      203       +1     
  Lines       22797    22980     +183     
  Branches      552      552              
==========================================
+ Hits        11671    11786     +115     
- Misses      10438    10499      +61     
- Partials      688      695       +7     
Components Coverage Δ
backend-apis 46.10% <ø> (ø)
backend-library 56.91% <80.60%> (+0.07%) ⬆️
cli 26.62% <ø> (ø)
frontend 39.34% <75.00%> (ø)
Files with missing lines Coverage Δ
ui/src/app/app.constants.ts 100.00% <100.00%> (ø)
...ponents/add-new-column/add-new-column.component.ts 70.73% <100.00%> (ø)
...omponents/object-detail/object-detail.component.ts 29.66% <0.00%> (ø)
assessment/collectors/infoschema_collector.go 92.36% <0.00%> (-1.64%) ⬇️
sources/oracle/toddl.go 95.28% <95.59%> (+0.39%) ⬆️
assessment/sources/oracle/infoschema.go 0.00% <0.00%> (ø)
sources/oracle/infoschema.go 58.66% <81.40%> (-2.54%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bharadwaj-aditya bharadwaj-aditya 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.

Largely looks fine. But it looks like the data migration code has been deleted. Lets not delete that code in this PR - unless it is causing major issues in the implementation

Comment thread sources/oracle/data.go
Comment thread sources/oracle/data_test.go
Comment thread sources/oracle/toddl_test.go

@bharadwaj-aditya bharadwaj-aditya 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.

Looks a lot cleaner. Some questions added here.

ignored := schema.Ignored{}
for _, c := range constraints[colName] {
// Type of constraint definition in oracle C (check constraint on a table)
// P (primary key), U (unique key) ,R (referential integrity), V (with check option, on a view)

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.

can you check if unique keys and primary keys are being identified correctly in the schema conversion ? I don't quite understand how this logic is being translated in the new implementation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes unique keys are being identified from getIndexsBatch and primaryKey from getConstraintsBatch.

return result, nil
}

// GetIndexes return a list of all indexes for the specified table.

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.

please retain the comments where relevant.

Are we handling all these index types in the conversion ?

@dhwanilpatel dhwanilpatel Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added comments on top of critical methods on what it does.

Are we handling all these index types in the conversion ?

Yes we are handling it, below is the mapping, please confirm if it looks good? @bharadwaj-aditya

Oracle Index Type Spanner Target Mapping SMT Conversion Logic & Reasoning
Normal Index CREATE INDEX Migrates natively as a standard Spanner secondary index.
Unique Index CREATE UNIQUE INDEX Migrates natively. SMT explicitly enforces the UNIQUE integrity constraint over the Spanner column natively.
Composite Index CREATE INDEX (col1, col2) Migrates natively. SMT extracts the exact column sort ordering from all_ind_columns to perfectly recreate the composite hierarchy in Spanner.
Bitmap Index Downgrades to CREATE INDEX Migrated as a standard secondary index. Spanner doesn't use low-cardinality bitmap blocks natively, so SMT translates this into a standard secondary index to preserve the query filtering hints safely.
Reverse Key Index Downgrades to CREATE INDEX Migrated as a standard secondary index. Spanner prevents RAC hot-block contention dynamically through UUIDs and partition splitting, so the REVERSE bit-hashing logic is stripped.
Function-Based Index Ignored / Filtered Intentionally dropped. Oracle uses native AST execution functions (e.g., UPPER(col)) that do not securely translate 1:1 on target Spanner instances.

)

var (
projectID string

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.

We should retain this test. Unless the functionality is covered in some other test here ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was planning to fix it along with other Integ PR, but I will try fixing this existing integ in this PR and will raise separate PR for new integs.

@dhwanilpatel
dhwanilpatel force-pushed the oracle_support branch 3 times, most recently from d08d64a to 80c0150 Compare September 3, 2026 08:47
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.

2 participants