Skip to content
Merged
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
27 changes: 27 additions & 0 deletions fe/src/com/baidu/palo/alter/RollupJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ public int tryFinishJob() {
MaterializedIndex rollupIndex = this.partitionIdToRollupIndex.get(partitionId);
Preconditions.checkNotNull(rollupIndex);

long rollupRowCount = 0L;
// 1. record replica info
for (Tablet tablet : rollupIndex.getTablets()) {
long tabletId = tablet.getId();
Expand All @@ -634,8 +635,21 @@ public int tryFinishJob() {
replica.getDataSize(), replica.getRowCount());
this.partitionIdToReplicaInfos.put(partitionId, replicaInfo);
}

// calculate rollup index row count
long tabletRowCount = 0L;
for (Replica replica : tablet.getReplicas()) {
long replicaRowCount = replica.getRowCount();
if (replicaRowCount > tabletRowCount) {
tabletRowCount = replicaRowCount;
}
}
rollupRowCount += tabletRowCount;

} // end for tablets

rollupIndex.setRowCount(rollupRowCount);

// 2. add to partition
partition.createRollupIndex(rollupIndex);

Expand Down Expand Up @@ -717,11 +731,24 @@ public void unprotectedReplayFinish(Database db) {
Partition partition = olapTable.getPartition(partitionId);
MaterializedIndex rollupIndex = entry.getValue();

long rollupRowCount = 0L;
for (Tablet tablet : rollupIndex.getTablets()) {
for (Replica replica : tablet.getReplicas()) {
replica.setState(ReplicaState.NORMAL);
}

// calculate rollup index row count
long tabletRowCount = 0L;
for (Replica replica : tablet.getReplicas()) {
long replicaRowCount = replica.getRowCount();
if (replicaRowCount > tabletRowCount) {
tabletRowCount = replicaRowCount;
}
}
rollupRowCount += tabletRowCount;
}

rollupIndex.setRowCount(rollupRowCount);
rollupIndex.setState(IndexState.NORMAL);

MaterializedIndex baseIndex = partition.getIndex(baseIndexId);
Expand Down