nsivarajan opened a new pull request, #65431:
URL: https://github.com/apache/doris/pull/65431

   ### What problem does this PR solve?
   
   Issue Number: close #65422 
   
   Related PR: #xxx
   
   **Problem Summary:**
   
   Modern analytical workloads require querying data as it existed at a 
specific point in time — for audit trails, data debugging, incremental pipeline 
recovery, and regulatory compliance.
   
   Apache Doris cloud/decoupled mode currently has no mechanism to read 
historical versions of a table. Once data is compacted or overwritten, earlier 
states are unrecoverable from SQL.
   
   **Requested syntax:**
   
   ```sql
   SELECT * FROM orders FOR TIME AS OF '2024-01-15 10:00:00';
   
   CREATE TABLE snapshot AS
       SELECT * FROM orders FOR TIME AS OF '2024-01-15 10:00:00';
   ```
       
   Supported on all DML table models: Duplicate Key, Unique Key (MoW), and 
Aggregate Key.
   
   **Solution**
   
   Key design points
   
   Per-table opt-in — zero overhead for non-TT tables:
   
   ```sql
    CREATE TABLE orders (...)
    PROPERTIES (
        "enable_time_travel"         = "true",
        "time_travel_retention_days" = "7"
    );
   ```
    
   **Two-level FDB index (cloud mode):**
   
   Level 1: sparse version index — one FDB key per commit per partition (T → V 
mapping)
   Level 2: compaction checkpoint — pre-compaction rowset manifests written 
before each cumulative compaction, so historical reads survive compaction
   One batch RPC resolves all partitions and fetches all manifests in a single 
FDB transaction — consistent snapshot across all partitions, one network round 
trip.
   
   Post-compaction correctness — the critical test: a query at timestamp T 
returns identical results before and after compaction of the rowsets that 
covered T.
   
   **Scope**
   
   Cloud/decoupled mode only (this PR)
   Coupled/local storage mode: same architecture, separate follow-up (~40% 
effort)
   SHOW TIME TRAVEL ON : listed as future work
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [x] Regression test
       - [x] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   - Behavior changed:
       - [ ] No.
       - [x] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [ ] No.
       - [x] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to