Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some supplementary logs during partition allocation #15097

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,12 @@
import java.util.Optional;
import java.util.Queue;
import java.util.Set;
import java.util.StringJoiner;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -311,14 +313,19 @@ public SchemaPartitionResp getOrCreateSchemaPartition(final GetOrCreateSchemaPar
final AtomicInteger unassignedSlotNum = new AtomicInteger();
final Map<String, List<TSeriesPartitionSlot>> unassignedSchemaPartitionSlotsMap =
partitionInfo.filterUnassignedSchemaPartitionSlots(req.getPartitionSlotsMap());
StringJoiner errDatabases = new StringJoiner(", ", "[", "]");
unassignedSchemaPartitionSlotsMap.forEach(
(database, unassignedSchemaPartitionSlots) ->
unassignedSlotNum.addAndGet(unassignedSchemaPartitionSlots.size()));
(database, unassignedSchemaPartitionSlots) -> {
if (!unassignedSchemaPartitionSlots.isEmpty()) {
errDatabases.add(database);
unassignedSlotNum.addAndGet(unassignedSchemaPartitionSlots.size());
}
});

final String errMsg =
String.format(
"Lacked %d/%d SchemaPartition allocation result in the response of getOrCreateSchemaPartition method",
unassignedSlotNum.get(), totalSlotNum.get());
"Lacked %d/%d SchemaPartition allocation result when get or create schema partitions for databases: %s",
unassignedSlotNum.get(), totalSlotNum.get(), errDatabases);
LOGGER.error(errMsg);
resp.setStatus(
new TSStatus(TSStatusCode.LACK_PARTITION_ALLOCATION.getStatusCode()).setMessage(errMsg));
Expand Down Expand Up @@ -446,16 +453,26 @@ public DataPartitionResp getOrCreateDataPartition(final GetOrCreateDataPartition
AtomicInteger unassignedSlotNum = new AtomicInteger();
Map<String, Map<TSeriesPartitionSlot, TTimeSlotList>> unassignedDataPartitionSlotsMap =
partitionInfo.filterUnassignedDataPartitionSlots(req.getPartitionSlotsMap());
StringJoiner errDatabases = new StringJoiner(", ", "[", "]");
unassignedDataPartitionSlotsMap.forEach(
(database, unassignedDataPartitionSlots) ->
unassignedDataPartitionSlots.forEach(
(seriesPartitionSlot, timeSlotList) ->
unassignedSlotNum.addAndGet(timeSlotList.getTimePartitionSlots().size())));
(database, unassignedDataPartitionSlots) -> {
AtomicBoolean hasUnassignedSlot = new AtomicBoolean(false);
unassignedDataPartitionSlots.forEach(
(seriesPartitionSlot, timeSlotList) -> {
if (!timeSlotList.getTimePartitionSlots().isEmpty()) {
hasUnassignedSlot.set(true);
unassignedSlotNum.addAndGet(timeSlotList.getTimePartitionSlots().size());
}
});
if (hasUnassignedSlot.get()) {
errDatabases.add(database);
}
});

String errMsg =
String.format(
"Lacked %d/%d DataPartition allocation result in the response of getOrCreateDataPartition method",
unassignedSlotNum.get(), totalSlotNum.get());
"Lacked %d/%d DataPartition allocation result when get or create data partitions for databases: %s",
unassignedSlotNum.get(), totalSlotNum.get(), errDatabases);
LOGGER.error(errMsg);
resp.setStatus(
new TSStatus(TSStatusCode.LACK_PARTITION_ALLOCATION.getStatusCode()).setMessage(errMsg));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ protected Flow executeFromState(
env.getConfigManager()
.getLoadManager()
.clearDataPartitionPolicyTable(deleteDatabaseSchema.getName());
LOG.info("data partition policy table cleared.");
LOG.info(
"[DeleteDatabaseProcedure] The data partition policy table of database: {} is cleared.",
deleteDatabaseSchema.getName());

// Delete Database metrics
PartitionMetrics.unbindDatabaseRelatedMetricsWhenUpdate(
Expand Down
Loading