Skip to content

Commit e5c9923

Browse files
authored
feat(horaemeta): drop metadata of partition table by http api (#1477)
## Rationale Currently, not suppport to delete a partitioned table through HTTP API, as it results in a "shard not found" error. ## Detailed Changes Since the partition table is not assigned to a shard, deleting the table metadata directly. ## Test Plan Manual test.
1 parent ebca8a7 commit e5c9923

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

horaemeta/server/cluster/manager.go

+11
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,17 @@ func (m *managerImpl) DropTable(ctx context.Context, clusterName, schemaName, ta
307307
return errors.WithMessage(err, "get table")
308308
}
309309

310+
// If the table is partitioned, delete the table metadata directly.
311+
if table.IsPartitioned() {
312+
_, err = cluster.metadata.DropTableMetadata(ctx, schemaName, tableName)
313+
if err != nil {
314+
return errors.WithMessage(err, "cluster drop table metadata")
315+
}
316+
return nil
317+
}
318+
319+
// If the table is not a partition table, delete the table metadata and remove the table from the shard.
320+
// So we need to check if the table has been assigned to a shard.
310321
getShardNodeResult, err := cluster.metadata.GetShardNodeByTableIDs([]storage.TableID{table.ID})
311322
if err != nil {
312323
return errors.WithMessage(err, "get shard node by tableID")

0 commit comments

Comments
 (0)