Skip to content

Conversation

discord9
Copy link
Contributor

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

as title, related instructions for running gc worker

PR Checklist

Please convert it to a draft if some of the following conditions are not met.

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.
  • API changes are backward compatible.
  • Schema or data changes are backward compatible.

@github-actions github-actions bot added size/M docs-not-required This change does not impact docs. labels Oct 20, 2025
@discord9 discord9 marked this pull request as draft October 22, 2025 03:59
Signed-off-by: discord9 <[email protected]>
Signed-off-by: discord9 <[email protected]>
@discord9 discord9 marked this pull request as ready for review October 22, 2025 11:53
Signed-off-by: discord9 <[email protected]>
Comment on lines +346 to +358
pub fn into_extensions(&self, extensions: &mut std::collections::HashMap<String, Vec<u8>>) {
let bytes = serde_json::to_vec(self).unwrap_or_default();
extensions.insert(Self::GC_STAT_KEY.to_string(), bytes);
}

pub fn from_extensions(
extensions: &std::collections::HashMap<String, Vec<u8>>,
) -> Option<Self> {
extensions
.get(Self::GC_STAT_KEY)
.and_then(|bytes| serde_json::from_slice(bytes).ok())
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

How's the safety to ignore the serde errors(using default and none)?

get_file_refs: GetFileRefs,
) -> Option<InstructionReply> {
let region_server = self.region_server;
info!("Getting mito Engine");
Copy link
Collaborator

Choose a reason for hiding this comment

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

seems like a meaningless log

error: Some("MitoEngine not found".to_string()),
}));
};
info!(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
info!(
debug!(

gc_regions: GcRegions,
) -> Option<InstructionReply> {
let region_ids = gc_regions.regions.clone();
info!("Received gc regions instruction: {:?}", region_ids);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
info!("Received gc regions instruction: {:?}", region_ids);
debug!("Received gc regions instruction: {:?}", region_ids);

let region_ids = gc_regions.regions.clone();
info!("Received gc regions instruction: {:?}", region_ids);

let mut table_id = None;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems this table_id is useless?

| ParseAddr { .. }
| TomlFormat { .. } => StatusCode::InvalidArguments,
| TomlFormat { .. }
| InvalidGcArgs { .. } => StatusCode::InvalidArguments,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I remember InvalidArguments is for hinting user. But InvalidGcArgs is produced by us, so it should be "internal".


#[snafu(display("Failed to run gc for mito engine"))]
GcMitoEngine {
region_id: RegionId,
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be presented in the error message, otherwise why carry it

ref_files.extend(files);
}
}
info!("Unfiltered ref files: {:?}", ref_files);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
info!("Unfiltered ref files: {:?}", ref_files);
debug!("Unfiltered ref files: {:?}", ref_files);

Copy link
Collaborator

Choose a reason for hiding this comment

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

please check other places that info logs are too verbose

.iter()
.filter(|file_id| !in_use_filenames.contains(*file_id))
.copied()
.copied()
Copy link
Collaborator

Choose a reason for hiding this comment

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

why copy twice

Suggested change
.copied()

/// ```
#[derive(Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub struct RegionId(u64);
pub struct RegionId(#[serde(deserialize_with = "str_or_u64")] u64);
Copy link
Collaborator

Choose a reason for hiding this comment

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

When is region id being serialized as string at the first place?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-not-required This change does not impact docs. size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants