Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

insertDeletion looks up recognize_fs_deletions by node_id alone, which no index covers — bulk removals scan the whole table per file

已关闭 适合新手
#1,573 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@marcelklehr 已经在做这个了。

开始于 2026年9月29日。

  • #1574 来自 @marcelklehr —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
mariadb, php

调研方向

从 lib/Db/FsActionMapper.php 中的 findByNodeId() 和 insertDeletion() 开始,然后检查 lib/Migration/Version011000001Date20251215094821.php 中现有的 unique index。确认查询使用了可用的 storage_id 和 node_id 覆盖范围,或评估 node_id 迁移方案。完成标准是批量删除能够避免为每个文件执行完整的索引扫描;使用 EXPLAIN 和已报告的 files:scan 场景验证查询计划。

由索引模型根据 Issue 内容生成。

描述

bug

FileListener::postDelete() calls FsActionMapper::insertDeletion() for every file under a removed node. insertDeletion() first runs findByNodeId(), i.e. SELECT … FROM oc_recognize_fs_deletions WHERE node_id = ?. The table's only secondary index is the unique (storage_id, node_id) (recognize_fs_del_uniq), which cannot serve a node_id-only predicate, so each call reads the whole index.

On Nextcloud 34.0.2 / Recognize 12.0.2, MariaDB 11.4, with ~512,000 queued rows, an occ files:scan that removed 131,004 files ran at 8–20 files/s and would have taken 1–3 h (EXPLAIN showed type: index, ~539,000 rows per lookup). After ALTER TABLE oc_recognize_fs_deletions ADD INDEX (node_id) the same scan took 5 m 39 s.

Suggested fix: look the row up by (storage_id, node_id), which insertDeletion() already has and the existing unique index covers — or add a node_id index in a migration. The code is the same at the installed tag v12.0.2 (lib/Db/FsActionMapper.php findByNodeId() / insertDeletion(), lib/Migration/Version011000001Date20251215094821.php) and still present on main at dc45cc1.

主要语言
PHP
星标
701
派生
70
平均合并
10 天 22 小时
30 天内合并 PR
2

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nextcloud/recognize 的其他 Issue

查看 nextcloud/recognize 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。