Skip to content

Commit

Permalink
rpc: ignore offline/unassigned regions during cache warmup
Browse files Browse the repository at this point in the history
When warming up the cache, ignore regions that are offline/unassigned.
They could exist for many reasons:
- parent region after a split, until daughter regions are compacted
- regions that are merged together, until compaction happens
- region moving due to HBase LoadBalancer, RegionServer shutting down or
  manually
- etc

It's not critical if we are missing a few regions in the cache during
warmup. The most important thing is for the warmup to be fast and to
fill in with as many regions as possible. Other regions will be fetched
later as needed.
  • Loading branch information
dethi committed Oct 23, 2024
1 parent 1b7b7bd commit a245718
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ func createAllRegionSearchKey(table []byte) []byte {
return metaKey
}

// metaLookupForTable checks meta table for all the region in which the given table is.
// metaLookupForTable checks meta table for all the open table regions.
func (c *client) metaLookupForTable(ctx context.Context,
table []byte) ([]regionInfoAndAddr, error) {
metaKey := createAllRegionSearchKey(table)
Expand All @@ -780,7 +780,12 @@ func (c *client) metaLookupForTable(ctx context.Context,

reg, addr, err := region.ParseRegionInfo(resp)
if err != nil {
return nil, err
// Ignore error, but log if it's anything else than OfflineRegionError. This really
// shouldn't happen unless HBase meta table is corrupted/changed format.
if _, ok := err.(region.OfflineRegionError); !ok {
c.logger.Debug("failed to parse region", "err", err)
}
continue
}

regions = append(regions, regionInfoAndAddr{regionInfo: reg, addr: addr})
Expand Down

0 comments on commit a245718

Please sign in to comment.