Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add invariants validation before writing bad keys to TiKV #58260

Open
db-will opened this issue Dec 13, 2024 · 3 comments
Open

Add invariants validation before writing bad keys to TiKV #58260

db-will opened this issue Dec 13, 2024 · 3 comments
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@db-will
Copy link
Contributor

db-will commented Dec 13, 2024

Enhancement

Considering the recent issue non-DXF ADD INDEX of a large table (trigger import due to disk quota) writes KV with TS = 0, it is essential to validate invariants before writing invalid keys to TiKV. This is particularly important for processes like Lightning and DDL imports, as these paths directly write to TiKV.

@Benjamin2037

@db-will db-will added the type/enhancement The issue or PR belongs to an enhancement. label Dec 13, 2024
@lance6716
Copy link
Contributor

For the ingest way to write TiKV, we have added a client-side check at

if dataCommitTS == 0 {
return errors.New("data commitTS is 0")
}
req.Chunk = &sst.WriteRequest_Batch{
Batch: &sst.WriteBatch{
CommitTs: dataCommitTS,
},
}

we will continue to add more invariants checks

@mittalrishabh
Copy link
Contributor

where are you planning to add invariant checks. I think it should be at the lowest layer too : TiKV

@lance6716
Copy link
Contributor

where are you planning to add invariant checks. I think it should be at the lowest layer too : TiKV

Yes, currently we plan to add checks at many different layers:

  • the ingest gRPC service at TiKV
  • TiDB's ingest client (lightning library)
  • data checksum write to / read from lightning's sorting engine
  • index scan count
  • ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

3 participants