Page MenuHomePhabricator

User and team Hive database cleanup tracking for Fall 2026
Closed, ResolvedPublic

Description

User and team Hive database cleanup tracking

This is a spin-off of T437605.

These databases add 468.8 TB on-disk between Feb 2026 and Aug 2026. This is 50% of the net cluster growth. T431391 asked engineers to clean up this space. That did not happen. This table tracks the work.

Sizes and file counts come from hdfs dfs -count on 2026-10-29. This is the final count. The two change columns compare with the counts on 2026-09-10 (the first count) and 2026-10-26 (the last count). Growth comes from wmf.hdfs_usage, Feb 2026 to Aug 2026. All sizes are on-disk bytes, which include replication.

DatabaseOn-disk (TB)Change since 09-10 (TB)Change since 10-26 (TB)Growth Feb–Aug (TB)FilesOwnerStatusNotes
/user/hive/warehouse/xcollazo.db0.1-164.50.0+99.86,825@xcollazo✅ DoneAll tables deleted on 2026-09-11. Only hdfs_usage_rollup stays.
/user/hive/warehouse/wmf_traffic.db23.8-86.0+1.0+106.32,734,692@KCVelaga_WMF and @amastilovic✅ DoneCleaned on 2026-10-09 with P96661. The script deleted data before 2026-08-31 from 11 staging and intermediate dbt tables, then expired the old snapshots. It grows again: up 59,017 files since 2026-10-26. T439690 tracks the automation of this cleanup.
/user/hive/warehouse/apizzata1.8-63.40.0+63.360,209@APizzata-WMF✅ DoneCleaned on 2026-09-30. The second path apizzata.db went from 1.6 TB to 0.1 TB.
/user/hive/warehouse/multimedia.db47.2-16.90.0+64.0151,783@dr0ptp4kt✅ ReviewedEphemeral tables dropped on 2026-10-15. The remaining tables stay on purpose: *_do_not_delete tables, and tables for the Multimedia Metadata Dataset pipeline. The size can go up and down while that pipeline changes. See T437733#12439553.
/user/hive/warehouse/dr0ptp4kt.db0.0-63.50.0+63.40@dr0ptp4kt✅ DoneAll tables dropped on 2026-10-15. The database is empty.
/user/hive/warehouse/traffic_patterns.db4.1-26.00.0+30.1164,726@fkaelin✅ DoneCleaned on 2026-10-23. See T437733#12468375.
/user/hive/warehouse/hghani.db1.0-21.3-5.7+15.0329,549@Hghani✅ DoneCleaned on 2026-10-27. Down 837,280 files since 2026-10-26. See T437733#12481855.
/user/hive/warehouse/wmf_contributors.db19.2+6.8+0.5+10.51,185,148TBDMoved to T439690Still grows. Up 8,619 files since 2026-10-26. Five dbt models hold most of the files. See T437733#12364731. T439690 tracks default expiration for dbt staging and intermediate models.
/user/hive/warehouse/edit_history.db0.0-7.70.0+7.70@fkaelin✅ DoneDatabase dropped on 2026-10-23. The path does not exist now.
/user/hive/warehouse/kcvelaga_staging.db0.0-5.30.0+5.30@KCVelaga_WMF✅ DoneDeleted on 2026-10-02. The path does not exist now.
/user/hive/warehouse/kcvelaga_wmf_traffic.db0.5-2.90.0+3.410,395@KCVelaga_WMF✅ DoneCleaned on 2026-10-02.

Total: 97.7 TB on-disk. It was 548.4 TB on 2026-09-10 and 101.9 TB on 2026-10-26. Growth is +468.8 TB.

Two databases with dbt outputs still grow. Together they added +1.5 TB in 3 days:

  • wmf_traffic.db: +1.0 TB.
  • wmf_contributors.db: +0.5 TB.

The intent is that T439690 stops this growth.

fab.db

/user/hive/warehouse/fab.db holds 4.6 TB and 878,175 files. It held 67.3 TB on 2026-09-10. @fkaelin dropped most tables on 2026-10-23. ✅ Done.

Related tasks

  • T439690: Implement default expiration for staging and intermediate dbt models.
  • T440170: Decide and implement default Hive location for dbt marts. Today, dbt marts go to /user/hive/warehouse/<db>.db and not to /wmf/data/<db>. This applies to wmf_traffic.db and wmf_contributors.db.
  • T438056: Build an HDFS growth dashboard based on wmf.hdfs_usage.
  • T441160: HDFS clean-up.

Potential future work

  • Use one partition scheme for the wmf_traffic dbt models. The 11 tables in P96661 use three schemes: day DATE, year, month, day INT, and hour TIMESTAMP. One scheme makes the cleanup easier to automate. See T437733#12417005.

Method for each database

  1. List the tables. Use hdfs dfs -ls -C /user/hive/warehouse/<db>.
  2. Find the Iceberg tables. Use hdfs dfs -ls -d '/user/hive/warehouse/<db>/*/metadata'.
  3. Drop the partitions in month batches for any table with many partitions. A single DROP TABLE times out. See P91234.
  4. Drop the tables. Use DROP TABLE ... PURGE for Iceberg tables.
  5. Delete the HDFS data. Use hdfs dfs -rm -r -skipTrash. Do not use trash. Trash holds the space for the full fs.trash.interval window.

To delete only old data from an Iceberg table, see P96661. Use DELETE with a filter on the partition columns, then run expire_snapshots. The DELETE frees no space until the snapshots expire.

Event Timeline

Hi @xcollazo, please associate one or more active project tags with this task (via the Add Action... → Change Project Tags dropdown). That will allow to see a task when looking at project workboards or searching for tasks in certain projects, and get notified about a task when watching a related project tag. Thanks.

Opened T438056: Build an HDFS growth dashboard based on wmf.hdfs_usage for consideration as Essential-Work Such a pipeline would give us good visibility on rapidly growing datasets like the ones we identified in this taask.

Ahoelzl triaged this task as High priority.
xcollazo added a subscriber: amastilovic.

@APizzata-WMF thanks for taking care of /user/hive/warehouse/apizzata.db. It does look like there is another database at /user/hive/warehouse/apizzata with more data to peruse?

@amastilovic it looks like many other dbt models are generating lots of files under /user/hive/warehouse/wmf_contributors.db:

$ hdfs dfs -count /user/hive/warehouse/wmf_contributors.db/* | sort -k 2,2nr | head -n 20
         406       222974         1089475084 /user/hive/warehouse/wmf_contributors.db/structured_edits_weekly
          68       168875          863640140 /user/hive/warehouse/wmf_contributors.db/base_active_editors_experience
          84       141614          277309263 /user/hive/warehouse/wmf_contributors.db/retained_newcomers
           3        92862      5016786012860 /user/hive/warehouse/wmf_contributors.db/int_editors_per_page
           3        92569       325506850862 /user/hive/warehouse/wmf_contributors.db/editor_counts_per_page
          48        82975        62156689559 /user/hive/warehouse/wmf_contributors.db/attribution_research
          69        71623          175835686 /user/hive/warehouse/wmf_contributors.db/active_editors_tenure
          69        47097          118913774 /user/hive/warehouse/wmf_contributors.db/constructive_edit_rate
          84        33826          104039842 /user/hive/warehouse/wmf_contributors.db/constructive_activation_rate
          69        32450           65165827 /user/hive/warehouse/wmf_contributors.db/constructive_edits
          84        30822           75332079 /user/hive/warehouse/wmf_contributors.db/account_registrations
          84        19185           53690043 /user/hive/warehouse/wmf_contributors.db/constructive_activations
          69        15647           33455784 /user/hive/warehouse/wmf_contributors.db/retained_editors
          77        14474         4072418331 /user/hive/warehouse/wmf_contributors.db/stg_reverted_edit
          10         5409            9348919 /user/hive/warehouse/wmf_contributors.db/retained_newcomers_weekly
          17         4590         1073403535 /user/hive/warehouse/wmf_contributors.db/base_moderator_actions_html_historical
          69         4173           15367249 /user/hive/warehouse/wmf_contributors.db/active_admins
          15         2502            5984917 /user/hive/warehouse/wmf_contributors.db/constructive_edit_rate_weekly
         138         2314          564928201 /user/hive/warehouse/wmf_contributors.db/base_moderator_actions
          15         2154            3962518 /user/hive/warehouse/wmf_contributors.db/constructive_edits_weekly

In the order of thousands sounds good to me. In the order of hundrend of thousands sounds problematic. Could we tackle the top 5?

@APizzata-WMF thanks for taking care of /user/hive/warehouse/apizzata.db. It does look like there is another database at /user/hive/warehouse/apizzata with more data to peruse?

done! thanks for pointing this out!

xcollazo renamed this task from User and team Hive database cleanup tracking for Sept 2026 to User and team Hive database cleanup tracking for Fall 2026.Oct 2 2026, 11:10 AM
xcollazo updated the task description. (Show Details)

Sorry for the delay in responding here.

Sharing the findings here from the Slack thread with Xabriel:

  • /user/hive/warehouse/wmf_traffic.db
    • This is primarily caused by dbt staging + intermediate tables (originating from several models that I own)
    • We materialize them in some cases, especially if they're used by multiple models upstream, and if there is a need to dig into breakdowns every now and then.
    • However, the except marts (the final models) we don't have the usual dataset maintenance for these (dropping old data and snapshots).
      • Given most are derived webrequest, it got accumulated over the last few months.
    • We had some discussion on this in this thread, and we have a task to to figure out a long-term solution for this: T439690: Implement default expiration for staging and intermediate dbt models
    • In the meantime, I will check which tables can be cleaned-up and also update the number of partitions we write out.
  • The other things is the location itself.
    • Even though the marts are final "production" datasets, they end up at /user/hive/warehouse/wmf_traffic.db instead of say, /wmf/data/wmf_traffic as we don't explicity define the location when the tables are created for the first time with dbt.
    • Some of the other paths that are listed in the table: /user/hive/warehouse/wmf_contributors.db and /user/hive/warehouse/edit_history.db are similar - they have production dbt outputs, instead of /wmf/data/wmf_contributors as the location.
    • I don't have a strong opinion on either, but maybe /wmf/data/wmf_traffic is better for consistency with other tables.

...

  • The other things is the location itself.
    • Even though the marts are final "production" datasets, they end up at /user/hive/warehouse/wmf_traffic.db instead of say, /wmf/data/wmf_traffic as we don't explicity define the location when the tables are created for the first time with dbt.
    • Some of the other paths that are listed in the table: /user/hive/warehouse/wmf_contributors.db and /user/hive/warehouse/edit_history.db are similar - they have production dbt outputs, instead of /wmf/data/wmf_contributors as the location.
    • I don't have a strong opinion on either, but maybe /wmf/data/wmf_traffic is better for consistency with other tables.

CC @amastilovic @JAllemandou @GGoncalves-WMF WDYT we should do? Should we force a LOCATION, at least for the production tables? Should we have separate database for int, stg, prod, or is that too much? @GGoncalves-WMF perhaps you already have a task for this?

cleared /user/hive/warehouse/kcvelaga_staging.db and /user/hive/warehouse/kcvelaga_wmf_traffic.db - they were mostly created during development.


Only one database grows now: wmf_traffic.db, by +3.9 TB in 7 days.

I will check /user/hive/warehouse/wmf_traffic.db thoroughly early next week.

Also several of the staging and int models of these jobs can be ephemeral instead being materialised, that will also reduce the week over week accumulation - will review those next week too.

Some of the other paths that are listed in the table: /user/hive/warehouse/wmf_contributors.db and /user/hive/warehouse/edit_history.db are similar - they have production dbt outputs, instead of /wmf/data/wmf_contributors as the location.

WDYT we should do? Should we force a LOCATION, at least for the production tables? Should we have separate database for int, stg, prod, or is that too much? @GGoncalves-WMF perhaps you already have a task for this?

The question of a separate database for staging and intermediate models will be decided in T439690 (just trying to avoid duplicating the discussion).

About LOCATION for marts, I don't have a great grasp on the pros and cons but this sounds like (1) it's not user-facing most of the time, and (2) we can fairly easily adapt to whatever convention we choose, and (3) we can (not as easily, but still feasibly) change it if we get it wrong.

So not a strong opinion, but I think a clear and convenient convention would be a location like /wmf/data/<production schema>/dbt/<dbt domain>/<mart>, e.g., /wmf/data/wmf_contributors/dbt/movement-insights-contributors-metrics/constructive_edits. I've filed T440170 to track deciding and implementing this.

@xcollazo per our discussion, the following staging and intermediate tables can be cleaned up.

wmf_traffc.int_known_clients_daily
wmf_traffc.int_pageview_actor_daily
wmf_traffc.int_traffic_pathways_daily
wmf_traffc.int_webrequest_requestctl_daily
wmf_traffc.stg_known_clients_api_requests
wmf_traffc.stg_pageview_actor
wmf_traffc.stg_pageview_actor_clients
wmf_traffc.stg_webrequest_media_clients
wmf_traffc.stg_webrequest_requestctl_pageviews
wmf_traffc.stg_webrequest_thumbnail_serving
wmf_traffc.stg_webrequest_upload_bandwidth
NOTE: Cut-off date is 2026-08-31

I need last month's data from some of the above tables for ongoing work, but everything before the end of August can be cleared.

This should help to regain 50-60 TB.

@xcollazo per our discussion, the following staging and intermediate tables can be cleaned up.

wmf_traffc.int_known_clients_daily
wmf_traffc.int_pageview_actor_daily
wmf_traffc.int_traffic_pathways_daily
wmf_traffc.int_webrequest_requestctl_daily
wmf_traffc.stg_known_clients_api_requests
wmf_traffc.stg_pageview_actor
wmf_traffc.stg_pageview_actor_clients
wmf_traffc.stg_webrequest_media_clients
wmf_traffc.stg_webrequest_requestctl_pageviews
wmf_traffc.stg_webrequest_thumbnail_serving
wmf_traffc.stg_webrequest_upload_bandwidth
NOTE: Cut-off date is 2026-08-31

I need last month's data from some of the above tables for ongoing work, but everything before the end of August can be cleared.

This should help to regain 50-60 TB.

Clean up done via P96661.

Indeed way less files and much smaller than where we began:

analytics@an-launcher1003:/home/xcollazo$ hdfs dfs -count -h /user/hive/warehouse/wmf_traffic.db
      36.7 K        2.2 M              5.5 T /user/hive/warehouse/wmf_traffic.db

I think we are good with wmf_traffic.db considering we will automate this work on T439690: Implement default expiration for staging and intermediate dbt models.


I did notice that there are many partioning strategies over that set of tables. From P96661:

-- Three partition shapes:
--   day DATE:                 int_known_clients_daily, int_traffic_pathways_daily, stg_known_clients_api_requests
--   year, month, day INT:     int_pageview_actor_daily, int_webrequest_requestctl_daily, stg_pageview_actor,
--                             stg_webrequest_requestctl_pageviews, stg_webrequest_upload_bandwidth
--   hour TIMESTAMP:           stg_pageview_actor_clients, stg_webrequest_media_clients, stg_webrequest_thumbnail_serving

We may want to unify for consistency, but also for ease of automation. But that is a problem for another day.

I dropped all the tables in dr0ptp4kt and the ephemeral ones in multimedia. Original was about 127.4 TB, and now it's 15.7 TB.

stat1010:~$ hdfs dfs -du -h -s /user/hive/warehouse/multimedia.db/
15.7 T  /user/hive/warehouse/multimedia.db
stat1010:~$ hdfs dfs -du -h -s /user/hive/warehouse/dr0ptp4kt.db/
0  /user/hive/warehouse/dr0ptp4kt.db

The remainder are things that we should hold onto permanently (do_not_delete tables) or that we should hold onto otherwise until the Multimedia Metadata Dataset pipeline is updated to reflect upstream table changes and is producing monthly (then eventually daily incrementals). While I'm revising the pipeline the figures will go up and go down, and the thought is to drop tables while doing that work where I can to help contain disk utilization growth. Of course we'll want a few months of retention for the free_ and paid_ tables and then there are the do_not_delete ones.

stat1010:~$ hdfs dfs -du -h  /user/hive/warehouse/multimedia.db/
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
212.6 G  /user/hive/warehouse/multimedia.db/free_backbone_staged_frozen_sourced_at_202605_gil_n_filerev
2.3 G    /user/hive/warehouse/multimedia.db/paid_linearized_embeddings_staged_frozen_sourced_at_202605_gil_n_filerev
5.0 T    /user/hive/warehouse/multimedia.db/paid_thumbnail_staged_frozen_sourced_at_202605_gil_n_filerev
101.6 G  /user/hive/warehouse/multimedia.db/stage_backbone_frozen_sourced_at_202605_gil_n_filerev
10.7 G   /user/hive/warehouse/multimedia.db/stage_cats_frozen_sourced_at_202605_gil_n_filerev
27.4 G   /user/hive/warehouse/multimedia.db/stage_content_frozen_sourced_at_202605_gil_n_filerev
8.4 G    /user/hive/warehouse/multimedia.db/stage_extmetadata_frozen_sourced_at_202605_gil_n_filerev
5.1 T    /user/hive/warehouse/multimedia.db/stage_fabian_thumbs_frozen_20260705_do_not_delete
5.1 T    /user/hive/warehouse/multimedia.db/stage_fabian_thumbs_frozen_20260705_do_not_delete__chunked_64
42.5 G   /user/hive/warehouse/multimedia.db/stage_file_rev_frozen_sourced_at_202605_gil_n_filerev
21.0 G   /user/hive/warehouse/multimedia.db/stage_image_inference_frozen_20260705_do_not_delete
2.4 G    /user/hive/warehouse/multimedia.db/stage_linearized_embeddings_frozen_sourced_at_202605_gil_n_filerev
3.8 G    /user/hive/warehouse/multimedia.db/stage_page_frozen_sourced_at_202605_gil_n_filerev
101.5 G  /user/hive/warehouse/multimedia.db/stage_sdc_commons_entity_frozen_sourced_at_202605_gil_n_filerev
115.6 M  /user/hive/warehouse/multimedia.db/stage_sdc_entity_join_frozen_sourced_at_202605_gil_n_filerev
89.7 G   /user/hive/warehouse/multimedia.db/stage_sdc_harvested_frozen_sourced_at_202605_gil_n_filerev
55.5 G   /user/hive/warehouse/multimedia.db/stage_wikitext_parsed_frozen_sourced_at_202605_gil_n_filerev
1.3 G    /user/hive/warehouse/multimedia.db/stage_xwiki_frozen_sourced_at_202605_gil_n_filerev

I dropped all the tables in dr0ptp4kt and the ephemeral ones in multimedia. Original was about 127.4 TB, and now it's 15.7 TB.

Nice! Thanks @dr0ptp4kt !

Dropped most tables from my own db (~60TB)

$ hdfs dfs -du -h -s  /user/hive/warehouse/fab.db 
1.5 T  /user/hive/warehouse/fab.db

Dropped database edit_history (~7TB)

Cleaned up the traffic_patterns database (~28TB). Also deleted from ~16TB from Ceph S3.

$ hdfs dfs -du -h -s   /user/hive/warehouse/traffic_patterns.db 
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
1.4 T  /user/hive/warehouse/traffic_patterns.db

Dropped most tables from my own db (~60TB)

Dropped database edit_history (~7TB)

Cleaned up the traffic_patterns database (~28TB). Also deleted from ~16TB from Ceph S3.

Thanks @fkaelin!

@Hghani cleaned what could be cleaned out of /user/hive/warehouse/hghani.db.

I think we should be good here, will do a final recalculation and close.

Result

This task reclaimed 513.4 TB of on-disk HDFS space, which includes replication. The tracked databases and fab.db held 615.7 TB on 2026-09-10. On 2026-10-29 they hold 102.3 TB. This is a reduction of 83%. In addition, about 16 TB was deleted from Ceph S3.

Thank you @APizzata-WMF, @dr0ptp4kt, @fkaelin, @Hghani and @KCVelaga_WMF for the cleanup!

Two databases with dbt outputs still grow: wmf_traffic.db and wmf_contributors.db. T439690 tracks the fix. I am closing this task.