mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-15 01:32:56 +00:00
fix(fulltext-index): clean up 0-value timer (#4423)
Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
This commit is contained in:
@@ -263,15 +263,13 @@ impl<'a> IndexerBuilder<'a> {
|
||||
|
||||
let err = match creator {
|
||||
Ok(creator) => {
|
||||
if creator.is_empty() {
|
||||
if creator.is_none() {
|
||||
debug!(
|
||||
"Skip creating full-text index due to no columns require indexing, region_id: {}, file_id: {}",
|
||||
self.metadata.region_id, self.file_id,
|
||||
);
|
||||
return None;
|
||||
} else {
|
||||
return Some(creator);
|
||||
}
|
||||
return creator;
|
||||
}
|
||||
Err(err) => err,
|
||||
};
|
||||
|
||||
@@ -57,7 +57,7 @@ impl FulltextIndexer {
|
||||
metadata: &RegionMetadataRef,
|
||||
compress: bool,
|
||||
mem_limit: usize,
|
||||
) -> Result<Self> {
|
||||
) -> Result<Option<Self>> {
|
||||
let mut creators = HashMap::new();
|
||||
|
||||
for column in &metadata.column_metadatas {
|
||||
@@ -102,11 +102,11 @@ impl FulltextIndexer {
|
||||
);
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
Ok((!creators.is_empty()).then(move || Self {
|
||||
creators,
|
||||
aborted: false,
|
||||
stats: Statistics::new(TYPE_FULLTEXT_INDEX),
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
/// Updates the index with the given batch.
|
||||
@@ -167,10 +167,6 @@ impl FulltextIndexer {
|
||||
pub fn column_ids(&self) -> impl Iterator<Item = ColumnId> + '_ {
|
||||
self.creators.keys().copied()
|
||||
}
|
||||
|
||||
pub(crate) fn is_empty(&self) -> bool {
|
||||
self.creators.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
impl FulltextIndexer {
|
||||
@@ -468,6 +464,7 @@ mod tests {
|
||||
1024,
|
||||
)
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
|
||||
let batch = new_batch(rows);
|
||||
|
||||
Reference in New Issue
Block a user