ExportXMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: DHandles
    • Storage Engines, Storage Engines - Foundations
    • 100.023
    • None
    • None

      Issue
      On a disaggregated storage leader the ingest table is expected to be empty and is not used for reads or writes (leader layered cursors do not open, or close after step-up, their ingest cursor). However, every path that touches an ingest table on the leader opens its btree and then only releases the reference, leaving the dhandle open in the connection dhandle list until the sweep server closes it after close_idle_time (600 s in mongod).

      Measured on the DSC M10 leader during sys-perf data_handle_small_locust (WT-19133, patch 6b082613, 21:04): Layered 5094, Table 5093, btree 10167 dhandles (about 20.3k in total), versus about 10.3k on the ASC primary running the same workload. Every eviction server pass loops over the full dhandle list and skips about 4.9-5.0k ingest btrees (the eviction-disabled skip count equals the ingest skip count). On that leader, refill wall time was 16-49 s per minute, of which tree walking was only 0.5-2.8 s; the rest is the dhandle loop. At 21:10-21:11, about 10 minutes after the tables were created, btree dhandles dropped from 10.9k to 5.6k while Layered and Table counts were unchanged, consistent with sweep closing the idle ingest handles.

      Where the leader opens ingest btrees
      1. Table create opens the new ingest file once to validate it, then only releases it:

      WT_SESSION::create("table:...")
      └─ __session_create
          └─ __wt_session_create
              └─ __wt_schema_create
                  └─ __wt_schema_create_internal
                      └─ __schema_create
                          └─ __create_layered
                              └─ __wt_schema_create("file:<name>.wt_ingest")
                                  └─ __wt_schema_create_internal → __schema_create → __create_file
                                      ├─ __wt_session_get_dhandle(uri, WT_DHANDLE_EXCLUSIVE)   ← validation open
                                      └─ __wt_session_release_dhandle   ← dhandle stays open in the list
      

      2. Opening a layered table opens the ingest btree only to record its btree ID:

      __schema_open_layered
      └─ __schema_open_layered_ingest
          ├─ __wt_session_get_dhandle(ingest_uri)
          ├─ layered->ingest_btree_id = btree->id
          └─ __wt_session_release_dhandle
      

      3. Step-up drains every open ingest btree, clears it, checks it is empty (diagnostic builds), resets its prune timestamp, and then only drops its use count:

      __wti_layered_drain_ingest_tables
      └─ __layered_drain_worker_run
          ├─ __layered_drain_ingest_table_and_truncate_list
          ├─ __layered_clear_ingest_table
          ├─ __layered_assert_ingest_table_empty      (HAVE_DIAGNOSTIC)
          ├─ __layered_reset_ingest_table_prune_timestamp
          └─ __wt_cursor_dhandle_decr_use
      

      Expected
      On a leader, once an ingest btree has served its purpose (validated on create, btree ID recorded on layered open, or drained, cleared and checked empty on step-up), its dhandle should be closed and discarded immediately instead of staying in the dhandle list for up to close_idle_time. During that window it doubles the number of btree handles the eviction server and other dhandle-list walkers loop over.

      Work to be done

      • Discard the ingest dhandle on the leader after each of the paths above. Consider recording the ingest btree ID without keeping the btree open.
      • Keep the follower and step-down paths unchanged: there the ingest table holds data and must stay open (see WT-16982 for tying the layered dhandle lifetime to the ingest dhandle).
      • Measure the leader dhandle count and eviction server refill time before and after on data_handle_small_locust.

            Assignee:
            [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            Shoufu Du
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: