Skip to content

[MOD-13431] Add logs to index commands#8036

Merged
lerman25 merged 4 commits intomasterfrom
omerl-add-index-logs
Jan 14, 2026
Merged

[MOD-13431] Add logs to index commands#8036
lerman25 merged 4 commits intomasterfrom
omerl-add-index-logs

Conversation

@lerman25
Copy link
Collaborator

@lerman25 lerman25 commented Jan 13, 2026

Add logging for index lifecycle operations
Added structured logging for index creation, alteration, and deletion operations to improve observability and debugging.

Changes:
FT.CREATE: Log before creation ("Creating index") and after success ("Successfully created index {name}")
Note: we don't log the index name at creating since the spec is not created yet, and to log the obfuscated will introduce necessary code complexity
FT.ALTER: Log before alteration ("Altering index {name}") and after success ("Successfully altered index {name}")
FT.DROPINDEX : Log after successful deletion ("Successfully dropped index {name}")
Note: the index name is duplicated before deletion to avoid use-after-free, as the IndexSpec is freed during the operation.

All logs respect the hideUserDataFromLog configuration flag:

  • When enabled: Index names are obfuscated using SHA-1 hash
  • When disabled: Real index names are logged

This follows the existing pattern used throughout the codebase for logging user data.


Note

Improves observability of index lifecycle events.

  • Log success for FT.CREATE (“Successfully created index …”), FT.ALTER (“Successfully altered index …”), and FT.DROPINDEX (“Successfully dropped index …”)
  • Use IndexSpec_FormatName(...) honoring hideUserDataFromLog to obfuscate names when configured
  • Safely capture index name before drop by duplicating it to avoid use-after-free
  • No behavior changes to command execution or replication

Written by Cursor Bugbot for commit b89ce7a. This will update automatically on new commits. Configure here.

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.83%. Comparing base (f6b0ca0) to head (b89ce7a).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8036      +/-   ##
==========================================
- Coverage   83.86%   83.83%   -0.04%     
==========================================
  Files         366      366              
  Lines       55186    55193       +7     
  Branches    14393    14393              
==========================================
- Hits        46281    46269      -12     
- Misses       8743     8762      +19     
  Partials      162      162              
Flag Coverage Δ
flow 84.86% <100.00%> (-0.14%) ⬇️
unit 50.70% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

src/module.c Outdated
}

// Log index creation
RedisModule_Log(ctx, "notice", "Creating index");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the logs before the creations succeed

@lerman25 lerman25 enabled auto-merge January 14, 2026 09:51
@lerman25 lerman25 added this pull request to the merge queue Jan 14, 2026
Merged via the queue into master with commit 4f0fdfa Jan 14, 2026
32 checks passed
@lerman25 lerman25 deleted the omerl-add-index-logs branch January 14, 2026 12:11
@redisearch-backport-pull-request
Copy link
Contributor

Backport failed for 2.8, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.8
git worktree add -d .worktree/backport-8036-to-2.8 origin/2.8
cd .worktree/backport-8036-to-2.8
git switch --create backport-8036-to-2.8
git cherry-pick -x 4f0fdfae3e77d583c397cbe22785c6a43bb7639d

@redisearch-backport-pull-request
Copy link
Contributor

Backport failed for 2.10, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.10
git worktree add -d .worktree/backport-8036-to-2.10 origin/2.10
cd .worktree/backport-8036-to-2.10
git switch --create backport-8036-to-2.10
git cherry-pick -x 4f0fdfae3e77d583c397cbe22785c6a43bb7639d

@redisearch-backport-pull-request
Copy link
Contributor

Backport failed for 8.2, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 8.2
git worktree add -d .worktree/backport-8036-to-8.2 origin/8.2
cd .worktree/backport-8036-to-8.2
git switch --create backport-8036-to-8.2
git cherry-pick -x 4f0fdfae3e77d583c397cbe22785c6a43bb7639d

@redisearch-backport-pull-request
Copy link
Contributor

Backport failed for 8.4, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 8.4
git worktree add -d .worktree/backport-8036-to-8.4 origin/8.4
cd .worktree/backport-8036-to-8.4
git switch --create backport-8036-to-8.4
git cherry-pick -x 4f0fdfae3e77d583c397cbe22785c6a43bb7639d

lerman25 added a commit that referenced this pull request Jan 15, 2026
* Add logs to index commands

* Avoid use after free

* remove logs before command
github-merge-queue bot pushed a commit that referenced this pull request Jan 15, 2026
[MOD-13431] Add logs to index commands (#8036)

* Add logs to index commands

* Avoid use after free

* remove logs before command
redisearch-backport-pull-request bot pushed a commit that referenced this pull request Jan 15, 2026
[MOD-13431] Add logs to index commands (#8036)

* Add logs to index commands

* Avoid use after free

* remove logs before command

(cherry picked from commit 7707b97)
github-merge-queue bot pushed a commit that referenced this pull request Jan 17, 2026
[8.4] [MOD-13431] Add logs to index commands  (#8049)

[MOD-13431] Add logs to index commands (#8036)

* Add logs to index commands

* Avoid use after free

* remove logs before command

(cherry picked from commit 7707b97)

Co-authored-by: lerman25 <[email protected]>
lerman25 added a commit that referenced this pull request Jan 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants