Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
913f27d
Add remote checkpoint tooling and logical table view
XuPeng-SH Jun 6, 2026
eaa1bfc
Fix checkpoint schema replay and CSV column mapping
XuPeng-SH Jun 6, 2026
953b6e7
Optimize checkpoint CSV dump and add layout compatibility
XuPeng-SH Jun 6, 2026
9a0e208
Fix checkpoint system table dumps
XuPeng-SH Jun 7, 2026
721cab6
Make checkpoint CSV dumps load-data compatible
XuPeng-SH Jun 7, 2026
2c7c75e
fix checkpoint dump timestamp handling
jiangxinmeng1 Jun 11, 2026
143b032
fix: EarliestTS skip empty start/end, cover end; pipeline CSV streaming
jiangxinmeng1 Jun 11, 2026
cbaecb7
fix: catalog table listing with schema-projected mo_tables; normalize…
jiangxinmeng1 Jun 11, 2026
985b1fe
fix: add parallel 'true' to LOAD DATA in restore.sql
jiangxinmeng1 Jun 12, 2026
9c9f4c7
fix: move parallel 'true' after LINES TERMINATED BY
jiangxinmeng1 Jun 12, 2026
9ec570d
fix: move parallel 'true' after IGNORE N LINES clause
jiangxinmeng1 Jun 12, 2026
7155277
perf: speed up checkpoint CSV dump
jiangxinmeng1 Jun 12, 2026
f8cd540
fix checkpoint dump restore indexes
jiangxinmeng1 Jun 12, 2026
c5e338b
feat checkpoint dump to object storage
jiangxinmeng1 Jun 12, 2026
5a1d59c
update
jiangxinmeng1 Jun 15, 2026
5138083
fix ckp dump restore load paths for s3 output
jiangxinmeng1 Jun 15, 2026
fefe3cf
feat(ckp): remove --table dump by name, set --jobs default to 5
jiangxinmeng1 Jun 15, 2026
72e35a1
fix(ckp): rebuild show create from mo_columns
jiangxinmeng1 Jun 15, 2026
15e3a54
fix multipart upload small final part
jiangxinmeng1 Jun 15, 2026
69ad9bc
fix(fileservice): avoid qcloud multipart upload starvation
jiangxinmeng1 Jun 15, 2026
65197f1
fix(ckp): use parallel multipart for remote dump streams
jiangxinmeng1 Jun 15, 2026
7b57204
fix(toolfs): bound remote lazy cache size
jiangxinmeng1 Jun 15, 2026
64baae3
fix(ckp): fallback index DDL merge for restore script
jiangxinmeng1 Jun 15, 2026
1167c86
fix(ckp): allow dumps for catalog-only tables
jiangxinmeng1 Jun 15, 2026
5830110
fix(ckp): fallback for binary mo_columns types
jiangxinmeng1 Jun 15, 2026
34e7744
fix(ckp): skip corrupt create sql candidates
jiangxinmeng1 Jun 15, 2026
700bd0d
fix(ckp): reuse prepared schema for restore ddl
jiangxinmeng1 Jun 15, 2026
3eb760e
fix(ckp): decode mo_columns attr types for ddl
jiangxinmeng1 Jun 15, 2026
c092eac
chore(ckp): add schema resolution debug logs
jiangxinmeng1 Jun 15, 2026
c2a196f
fix(ckp): detect encoded column types across mo_columns rows
jiangxinmeng1 Jun 15, 2026
c6462e6
fix(ckp): use object metadata for missing column types
jiangxinmeng1 Jun 15, 2026
51b8e56
chore(ckp): log raw mo_columns attr types
jiangxinmeng1 Jun 15, 2026
f7ebb55
fix(ckp): read object columns by seqnum
jiangxinmeng1 Jun 15, 2026
f21e78f
fix(ckp): restore catalog table ddl attributes
jiangxinmeng1 Jun 15, 2026
90fcfc2
fix(ckp): restore non-unique catalog indexes
jiangxinmeng1 Jun 15, 2026
ebbe27c
fix(ckp): restore table partition clause
jiangxinmeng1 Jun 15, 2026
63d77f4
fix(ckp): restore primary keys from constraints
jiangxinmeng1 Jun 15, 2026
46a53ae
fix(ckp): avoid recursive catalog lookup
jiangxinmeng1 Jun 15, 2026
59d4e24
fix(ckp): preserve vector index options
jiangxinmeng1 Jun 16, 2026
c9058ec
fix(ckp): align catalog headers by seqnum
jiangxinmeng1 Jun 16, 2026
0a349f6
fix(ckp): recover partition metadata by row shape
jiangxinmeng1 Jun 16, 2026
84c1e7c
fix(ckp): dump partition table data
jiangxinmeng1 Jun 16, 2026
7ff8517
fix ckp list external table visibility
jiangxinmeng1 Jun 17, 2026
10a1f1d
include views in ckp list output
jiangxinmeng1 Jun 17, 2026
54352d3
ignore missing optional catalog tables in ckp dump
jiangxinmeng1 Jun 17, 2026
ee0e253
include initial incremental checkpoint in ckp view
jiangxinmeng1 Jun 17, 2026
6909cf4
use absolute local paths in ckp restore scripts
jiangxinmeng1 Jun 17, 2026
243b0a2
restore temp table display names in ckp tool
jiangxinmeng1 Jun 17, 2026
6682230
fix ckp restore ddl for enum time and fulltext
jiangxinmeng1 Jun 17, 2026
a88ae0d
restore external tables from ckp create sql
jiangxinmeng1 Jun 17, 2026
df53e11
package external table sources in ckp dump
jiangxinmeng1 Jun 17, 2026
ff890db
fix ckp load csv encoding for special types
jiangxinmeng1 Jun 17, 2026
1f13865
restore external table ddl from rel_createsql params
jiangxinmeng1 Jun 17, 2026
4ad0673
fix ckp restore ddl for fulltext enum set
jiangxinmeng1 Jun 17, 2026
1cd8ece
support year in load data external parser
jiangxinmeng1 Jun 17, 2026
86e50a0
restore foreign keys in ckp table ddl
jiangxinmeng1 Jun 17, 2026
c87d7b7
restore views as views in ckp dump
jiangxinmeng1 Jun 17, 2026
1b801ee
preserve foreign keys in ckp schema clone
jiangxinmeng1 Jun 17, 2026
e84804f
render unsupported array ddl as json in ckp dump
jiangxinmeng1 Jun 17, 2026
0b7a36d
fix ckp restore foreign key ordering
jiangxinmeng1 Jun 17, 2026
cdc1ef1
restore partition definitions in ckp dump ddl
jiangxinmeng1 Jun 17, 2026
34058a3
update
jiangxinmeng1 Jun 18, 2026
2b18af7
Merge branch 'main' into view_ckp
jiangxinmeng1 Jun 18, 2026
c0d240c
preserve array type in ckp restore ddl
jiangxinmeng1 Jun 18, 2026
0440e9d
preserve typed array ddl in ckp restore
jiangxinmeng1 Jun 18, 2026
075d6cd
list ckp databases from mo_database
jiangxinmeng1 Jun 18, 2026
24bfedc
resolve ckp partition metadata by account
jiangxinmeng1 Jun 18, 2026
4b0e684
update
jiangxinmeng1 Jun 24, 2026
a0de8dd
add diagnostic logging to checkpoint loading path
jiangxinmeng1 Jun 24, 2026
5d15243
keep diagnostic logging only in tool path (loadEntries)
jiangxinmeng1 Jun 24, 2026
d6f4fdf
update error message
jiangxinmeng1 Jun 24, 2026
10f3fc7
fix ckp dump s3 retry errors
jiangxinmeng1 Jun 26, 2026
b9c5ca6
Merge branch 'main' into view_ckp
mergify[bot] Jul 1, 2026
15cf34b
fix checkpoint tool sca errors
jiangxinmeng1 Jul 2, 2026
e168dc6
fix checkpoint tool static checks
jiangxinmeng1 Jul 3, 2026
2a970bc
Merge branch 'main' into view_ckp
jiangxinmeng1 Jul 3, 2026
3332df1
test: improve checkpoint tool coverage
jiangxinmeng1 Jul 3, 2026
5c0a002
fix checkpoint dump restore edge cases
jiangxinmeng1 Jul 3, 2026
d1f48b2
fix ckp account restore script system tables
jiangxinmeng1 Jul 6, 2026
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
484 changes: 484 additions & 0 deletions VIEW_CKP_STATUS.md

Large diffs are not rendered by default.

322 changes: 322 additions & 0 deletions cmd/mo-object-tool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
# mo-tool Object And Checkpoint Usage

`mo-tool` provides offline tools for inspecting MatrixOne checkpoint and object
files. It can read from a local data directory, or from a remote MatrixOne
fileservice such as S3 or MinIO.

## Build

```bash
go build -o mo-tool ./cmd/mo-tool
```

You can also run it directly during development:

```bash
go run ./cmd/mo-tool --help
```

## Local Checkpoint Usage

Read checkpoint files from a local MatrixOne data directory:

```bash
./mo-tool ckp info ./mo-data
./mo-tool ckp view ./mo-data
```

If no directory is provided, the current working directory is used:

```bash
./mo-tool ckp info
./mo-tool ckp view
```

The checkpoint viewer lists checkpoint entries and lets you drill down into
tables, object ranges, and object data.

Inside table detail view:

- Press `Enter` on a row to open the physical object view for that object.
- Press `L` to open a logical table view with tombstones applied to table rows.

## Offline Table Schema And CSV Export

`mo-tool ckp` can reconstruct table schema and export logical table rows directly
from checkpoint data.

Show the `CREATE TABLE` statement for a table at the latest checkpoint:

```bash
./mo-tool ckp show-create-table --table-id=272387 ./mo-data
```

Show the schema at a specific snapshot timestamp:

```bash
./mo-tool ckp show-create-table \
--table-id=272387 \
--ts=1780574341899433000:0 \
./mo-data
```

Dump a logical table view to CSV:

```bash
./mo-tool ckp dump --table-id=323820 ./mo-data
./mo-tool ckp dump --table-id=323820 -o workflow_cases.csv ./mo-data
./mo-tool ckp dump --table-id=323820 --header --meta-comments ./mo-data
./mo-tool ckp dump --table-id=323820 --row-order=lexical ./mo-data
```

The CSV dump:

- applies tombstones at the selected checkpoint snapshot
- excludes hidden system columns
- uses catalog metadata from `mo_tables` and `mo_columns`
- uses MatrixOne SQL export style field formatting so the output can be loaded
back with `LOAD DATA`
- uses `\N` for nulls
- streams row output instead of materializing the full CSV in memory first when
`--row-order=storage` (the default)

If catalog metadata cannot be resolved exactly, the command fails instead of
guessing from raw physical object columns.

By default, `ckp dump` is geared toward reloadability:

- no metadata comment lines
- no header row

Use these flags when you want a more human-readable export:

- `--meta-comments` to prepend `-- CREATE TABLE ...` and row count comment lines
- `--header` to include a header row with visible column names
- use `--row-order=lexical` if you want deterministic CSV ordering by visible
column values for diffing or reproducible snapshots

Row order modes:

- `storage`: object/block/row scan order after tombstone application; this is
the default and remains large-table friendly
- `lexical`: sorts the final visible CSV rows lexicographically by exported
column values; this buffers rows in memory and is intended for smaller exports

## Local Object Usage

Read a single local object file:

```bash
./mo-tool object info ./mo-data/<object-name>
./mo-tool object view ./mo-data/<object-name>
```

Replace `<object-name>` with the object path shown by the checkpoint viewer or
stored in checkpoint metadata.

## Remote Fileservice From MatrixOne Config

The recommended remote workflow is to reuse the MatrixOne service TOML file.
This avoids manually copying bucket, endpoint, key prefix, and credential
settings.

For example, with a MinIO launch config:

```bash
./mo-tool ckp info \
--fs-config etc/launch-minio-local/tn.toml

./mo-tool ckp view \
--fs-config etc/launch-minio-local/tn.toml
```

By default, `mo-tool` uses the fileservice configured in
`[tn.Txn.Storage].fileservice`. If that field is absent, it uses `SHARED`.

To select a specific fileservice:

```bash
./mo-tool ckp view \
--fs-config etc/launch-minio-local/tn.toml \
--fs-name SHARED
```

The same fileservice options work for object inspection:

```bash
./mo-tool object info <object-name> \
--fs-config etc/launch-minio-local/tn.toml \
--fs-name SHARED

./mo-tool object view <object-name> \
--fs-config etc/launch-minio-local/tn.toml \
--fs-name SHARED
```

When checkpoint data is opened from a remote fileservice, object drill-down from
the checkpoint viewer reuses the same fileservice. This means checkpoint meta,
checkpoint data objects, and table data objects are all read from the same S3 or
MinIO backend.

The logical table view also uses the same fileservice and applies tombstones at
the selected checkpoint snapshot timestamp.

The same remote options work for schema lookup and CSV export:

```bash
./mo-tool ckp show-create-table \
--table-id=272387 \
--fs-config etc/launch-minio-local/tn.toml

./mo-tool ckp dump \
--table-id=323820 \
--fs-config etc/launch-minio-local/tn.toml
```

## Remote S3 Or MinIO With Inline Arguments

You can also provide object storage settings directly on the command line.

MinIO example:

```bash
./mo-tool ckp view \
--backend MINIO \
--s3 bucket=mo-test,endpoint=http://127.0.0.1:9000,key-prefix=server/data,key-id=minio,key-secret=minio123
```

AWS S3 example:

```bash
./mo-tool ckp info \
--backend S3 \
--s3 bucket=my-mo-bucket,region=us-east-1,key-prefix=prod/mo-data
```

Object viewer with inline S3 arguments:

```bash
./mo-tool object view <object-name> \
--backend S3 \
--s3 bucket=my-mo-bucket,region=us-east-1,key-prefix=prod/mo-data
```

Supported `--s3` keys include:

- `bucket`
- `endpoint`
- `region`
- `key-prefix`
- `key-id`
- `key-secret`
- `session-token`
- `role-arn`
- `external-id`
- `shared-config-profile`
- `no-default-credentials`
- `no-bucket-validation`
- `is-minio`
- `cert-files`

Credentials can also come from the default AWS credential chain when supported
by the selected backend and when `no-default-credentials` is not set.

## Catalog Layout Compatibility

Checkpoint catalog objects are not completely stable across MatrixOne branches.
In particular, older `3.0-dev` generated data may differ from newer builds in
the layout of `mo_tables` and `mo_columns`.

Current tool behavior:

- it first uses actual column names from checkpoint catalog rows when present
- if the checkpoint only exposes generic `col_N` headers, it infers the system
table layout from the observed column count
- it supports both:
- current layout, which includes `mo_tables.rel_logical_id` and
`mo_columns.attr_has_generated` / `mo_columns.attr_generated`
- older `3.0-dev` layout, which does not include those columns

For `mo_columns`, CSV extraction uses:

- `attnum` for SQL column order
- `att_seqnum` for physical object column position

This matters for tables with hidden columns, index-related internal columns, or
wide schemas. Without `att_seqnum`, visible values can shift to the wrong CSV
column.

In practice, you do not need a separate flag for `3.0-dev` generated data. The
tool auto-detects the known layout variants and falls back to the matching
built-in schema for system tables when needed.

Example with older checkpoint data:

```bash
./mo-tool ckp show-create-table --table-id=2 ./mo-data
./mo-tool ckp dump --table-id=323820 ./mo-data
```

If a checkpoint comes from an unknown future layout and neither named columns
nor known-width inference matches, schema reconstruction can still fail closed.
That is intentional.

This means `3.0-dev` checkpoint data is supported for the known catalog layout
differences above, but compatibility is not an open-ended promise for arbitrary
older or future internal layouts.

## Important Path Rules

For remote checkpoint inspection, `key-prefix` should point to the MatrixOne
data root, not to the checkpoint directory itself.

Correct:

```text
s3://my-bucket/prod/mo-data/
ckp/
<table-data-objects>
```

Use:

```bash
--s3 bucket=my-bucket,key-prefix=prod/mo-data,...
```

Do not use:

```bash
--s3 bucket=my-bucket,key-prefix=prod/mo-data/ckp,...
```

Checkpoint metadata stores object names relative to the fileservice root. If the
fileservice root is pointed directly at `ckp/`, checkpoint metadata may be found
but table data object drill-down will fail.

## Command Summary

Checkpoint commands:

```bash
./mo-tool ckp info [directory] [--fs-config FILE] [--fs-name NAME]
./mo-tool ckp view [directory] [--fs-config FILE] [--fs-name NAME]
./mo-tool ckp dump --table-id ID [directory] [--ts PHYSICAL:LOGICAL] [-o FILE] [--header] [--meta-comments] [--row-order storage|lexical]
./mo-tool ckp show-create-table --table-id ID [directory] [--ts PHYSICAL:LOGICAL]
./mo-tool ckp info --backend S3 --s3 key=value,...
./mo-tool ckp view --backend MINIO --s3 key=value,...
./mo-tool ckp dump --table-id ID --backend S3 --s3 key=value,... [--header] [--meta-comments] [--row-order storage|lexical]
./mo-tool ckp show-create-table --table-id ID --backend S3 --s3 key=value,...
```

Object commands:

```bash
./mo-tool object info <object-file> [--fs-config FILE] [--fs-name NAME]
./mo-tool object view <object-file> [--fs-config FILE] [--fs-name NAME]
./mo-tool object info <object-name> --backend S3 --s3 key=value,...
./mo-tool object view <object-name> --backend MINIO --s3 key=value,...
```

Local mode treats paths as local filesystem paths. Remote mode treats object
names as paths relative to the selected fileservice root.
Loading
Loading