Skip to content

Conversation

micheleRP
Copy link
Contributor

@micheleRP micheleRP commented Oct 10, 2025

Description

This pull request improves documentation related to deleting records from a topic in Redpanda. The main focus is on clarifying the risks of using timestamps with the rpk topic trim-prefix command and ensuring users are aware of potential unintended data loss.

  • Added a new shared warning partial (warning-delete-records.adoc) that explains the risks of using timestamps with rpk topic trim-prefix, including potential for truncating an entire partition if timestamps are unordered.
  • Included the new warning partial in both the general topic record deletion documentation (delete-topic-records.adoc) and the rpk topic trim-prefix reference documentation to alert users in both contexts. [1] [2]

Resolves https://redpandadata.atlassian.net/browse/DOC-1720
Review deadline:

Page previews

rpk topic trim prefix (SM, Cloud)
Delete records from a topic (SM, Cloud)

Checks

  • New feature
  • Content gap
  • Support Follow-up
  • Small fix (typos, links, copyedits, etc)

Copy link

netlify bot commented Oct 10, 2025

Deploy Preview for redpanda-docs-preview ready!

Name Link
🔨 Latest commit 9b45d78
🔍 Latest deploy log https://app.netlify.com/projects/redpanda-docs-preview/deploys/68f118e0acd6f30008ad70ee
😎 Deploy Preview https://deploy-preview-1388--redpanda-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

coderabbitai bot commented Oct 10, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

  • Updated delete-topic-records.adoc text to non-imperative phrasing and added UI as a deletion method.
  • Inserted shared warning partial include (shared:partial$warning-delete-records.adoc) into delete-topic-records.adoc and rpk-topic-trim-prefix.adoc.
  • Reflowed --offset option description in rpk-topic-trim-prefix.adoc and expanded examples/usage blocks.
  • Added new shared warning partial warning-delete-records.adoc explaining timestamp-based delete behavior and potential truncation when timestamps are out of order, with an example command.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • Feediver1
  • paulohtb6

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive The current title only references the Jira ticket and a generic “Delete Records” phrase and does not clearly convey the primary change of adding risk warnings for timestamp‐based deletion and improving documentation flow. Consider renaming the title to something more descriptive and concise such as “Add warning about potential data loss when trimming prefixes by timestamp” to better summarize the main documentation changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues Check ✅ Passed The changes deliver on the linked issue’s requirements by adding a shared warning partial that explains the timestamp‐based deletion logic and risk of truncation due to out‐of‐order timestamps, and by inserting that warning into both the general topic deletion and rpk trim-prefix reference pages as requested.
Out of Scope Changes Check ✅ Passed All modifications are confined to documentation, updating phrasing, examples, and including the new warning partial in the specified files; there are no unrelated or out‐of‐scope changes present.
Description Check ✅ Passed The pull request description adheres to the repository template by including a clear Description section with the Jira resolution link, the Review deadline placeholder, Page previews with proper URLs, and a completed Checks list; it provides context and links matching the template structure.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Comment @coderabbitai help to get the list of available commands and usage tips.

@micheleRP micheleRP marked this pull request as ready for review October 13, 2025 15:07
@micheleRP micheleRP requested a review from a team as a code owner October 13, 2025 15:07
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
modules/reference/pages/rpk/rpk-topic/rpk-topic-trim-prefix.adoc (1)

7-9: Fix typo and tighten wording.

  • “less then” → “less than”
  • Consider simplifying phrasing for readability.

Apply this diff:

-sets the LogStartOffset for partitions to the requested offset. All segments
-whose base offset is less then the requested offset are deleted, and any records
-within the segment before the requested offset can no longer be read.
+sets the LogStartOffset for partitions to the requested offset. All segments
+whose base offset is less than the requested offset are deleted, and any records
+within a remaining segment before the requested offset can no longer be read.
🧹 Nitpick comments (3)
modules/reference/pages/rpk/rpk-topic/rpk-topic-trim-prefix.adoc (2)

11-13: Avoid “low watermark” (can be confused with Kafka LSO).

Use “start offset (LogStartOffset)” consistently to prevent confusion with last stable offset (LSO).

Apply this diff:

-The `--offset/-o` flag allows you to indicate which index you want to set the
-partition's low watermark (start offset) to. It can be a single integer value
+The `--offset/-o` flag lets you set the partition's start offset (LogStartOffset).
+It can be a single integer value
 denoting the offset, or it can be a timestamp if you prefix the offset with an '@'. You can select which partition you want to trim the offset from with the `--partitions/-p` flag.

37-43: Fix grammar and clarify timestamp formats

-* Trim records in all partitions of topic foo previous to an specific timestamp:
+* Trim records in all partitions of topic 'foo' prior to a specific timestamp:

Add that -o "@<timestamp>" supports:

  • 13-digit Unix milliseconds (e.g. 1622505600000)
  • 9-digit Unix seconds (e.g. 1622505600)
  • date-only (YYYY-MM-DD in UTC)
  • RFC3339 datetimes (YYYY-MM-DDTHH:MM:SSZ, optional fractional seconds)
  • relative durations (e.g. -48h, 1h, 3ms)

See rpk topic trim-prefix and rpk topic consume docs for details.

modules/shared/partials/warning-delete-records.adoc (1)

3-3: Clarify trim-prefix timestamp boundary and source

In modules/shared/partials/warning-delete-records.adoc line 3, note that rpk topic trim-prefix @<timestamp> resolves to the earliest offset whose record timestamp is ≥ the specified timestamp, and that the timestamp used comes from the topic’s message.timestamp.type (CreateTime = producer-supplied, LogAppendTime = broker append time).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 49f3198 and 23e807b.

📒 Files selected for processing (3)
  • modules/develop/partials/delete-topic-records.adoc (1 hunks)
  • modules/reference/pages/rpk/rpk-topic/rpk-topic-trim-prefix.adoc (2 hunks)
  • modules/shared/partials/warning-delete-records.adoc (1 hunks)
🔇 Additional comments (3)
modules/develop/partials/delete-topic-records.adoc (1)

14-14: Good call including the shared warning here.

This centralizes the timestamp caveats for all delete flows.

modules/reference/pages/rpk/rpk-topic/rpk-topic-trim-prefix.adoc (1)

26-26: Good inclusion of the shared warning partial.

Ensures users see the truncation risk right where they execute the command.

modules/shared/partials/warning-delete-records.adoc (1)

5-8: %d supports Go-style timestamps Confirmed that rpk topic consume --format '%o %d{go[2006-01-02T15:04:05Z07:00]} %k %v' is valid.

@micheleRP micheleRP requested a review from WillemKauf October 13, 2025 15:26
@@ -0,0 +1,9 @@
[WARNING]
====
When you delete records from a topic with a timestamp, Redpanda advances the partition start offset to the first record whose timestamp is after the threshold. If record timestamps are not in order with respect to offsets, this may truncate an entire partition. Before using a timestamp, verify that timestamps increase in the same order as offsets in the topic to avoid unintended data loss. For example:
Copy link
Contributor

Choose a reason for hiding this comment

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

this may truncate an entire partition

Is like the worst case scenario, maybe want something like

If record timestamps are not in order with respect to offsets, this may result in unintended deletion of data

@rjustice-rp
Copy link

Reviewed:
rpk topic trim prefix (SM, Cloud)
Delete records from a topic (SM, Cloud)
and these look good to me

Copy link

@rjustice-rp rjustice-rp left a comment

Choose a reason for hiding this comment

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

Reviewed:
rpk topic trim prefix (SM, Cloud)
Delete records from a topic (SM, Cloud)
and these look good to me!

Copy link
Contributor

@Feediver1 Feediver1 left a comment

Choose a reason for hiding this comment

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

lgtm

@micheleRP micheleRP merged commit a7097ad into main Oct 16, 2025
3 checks passed
@micheleRP micheleRP deleted the DOC-1720-Customer-Incident-Delete-Records-prior-to-a-timestamp-for-All-Partitions-truncated-several-partitions-that-had-data-forward-from-timestamp branch October 16, 2025 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants