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

server: hot ranges api #74377

Merged
merged 4 commits into from
Mar 2, 2022
Merged

server: hot ranges api #74377

merged 4 commits into from
Mar 2, 2022

Commits on Mar 2, 2022

  1. server: hot ranges api

    This change implements second version of hot ranges api that's required
    for UI to represent enhanced Hot Ranges page.
    
    Before, Hot ranges (under Advanced debugging page) used former version of
    HotRanges api that provided information about hot ranges with internal/
    sensitive data (see: cockroachdb#53212)
    that should not be exposed to users.
    
    Now, in addition to existing endpoint, additional one is implemented that is
    based on a former version and provides hot ranges information that is only
    needed for Hot Ranges page (range id, qps, table, db, and index names for
    particular range).
    
    The list of hot ranges and their QPS is provided by `HotRanges` service and
    then information like DB, table and index names are retrieved from range's
    `StartKey` that might include this info or not (in case if it's meta range,
    or range that stores index itself for instance).
    
    `HotRange` and `HotRangeV2` services expect the same request type as an
    argument but return different responses.
    `HotRangeV2` service returns a flat list of hot ranges instead of grouped
    ranges per node/store.
    
    Release note: None
    
    server: add leaseholder node id to hot ranges api
    
    Current change extends `statuspb.HotRangesResponse` to
    include `LeaseholderNodeID` field to indicate the
    node id that contains leaseholder replica for
    current hot range.
    
    This change was made in `localHotRanges` function (that is
    used by `HotRanges` that in turn used by `HotRangeV2` service)
    to reuse existing logic of iteration over the stores and querying
    hot ranges. It extends its response by `LeaseholderNodeID` field.
    Otherwise, the same logic should be implemented in `HotRangeV2`
    service by calling `VisitStores` iterator.
    
    Release note: None
    
    Release justification: bug fixes and low-risk updates
    to new functionality
    koorosh committed Mar 2, 2022
    Configuration menu
    Copy the full SHA
    c248ac6 View commit details
    Browse the repository at this point in the history
  2. server: update hot ranges api/v2 version

    Before, `listHotRanges` request handler of `apiV2Server` relied
    on `HotRanges` service that is now should be replaced by new
    `HotRangesV2` implementation.
    
    Current change reuses HotRangeV2 service in `api/v2/ranges/hot`
    api. It allows to share the same logic between REST and gRPC
    endpoints and gradually migrate to new version of API.
    
    Release note: None
    
    Release justification: bug fixes and low-risk updates
    to new functionality
    koorosh committed Mar 2, 2022
    Configuration menu
    Copy the full SHA
    af84b8a View commit details
    Browse the repository at this point in the history
  3. server, ui: use POST request method for HotRangesV2 service

    Initially, `HotRangesV2` service in status server was defined
    to use GET method to handle HTTP request. It was convenient way
    to display response data in Advanced debugging page since it allowed
    to render response body right on to page.
    
    But now, hot ranges will be used on user facing page and request
    dispatching for hot ranges api should follow generic workflow:
    initialize `HotRangesRequest` protobuf message and dispatch request
    with `src/util/api` service. This restriction forces to use POST
    method (since GET method doesn't allow to provide request body).
    
    In addition, Hot Ranges debugging page is refactored to use `api`
    service.
    
    Release note: None
    
    Release justification: bug fixes and low-risk updates
    to new functionality
    koorosh committed Mar 2, 2022
    Configuration menu
    Copy the full SHA
    35d2b78 View commit details
    Browse the repository at this point in the history
  4. server: add pagination to hot ranges API

    This change extends hot ranges API to support pagination
    of responses. It is also possible to avoid pagination when
    page size is set to 0.
    
    Release note: None
    
    Release justification: bug fixes and low-risk updates
    to new functionality
    koorosh committed Mar 2, 2022
    Configuration menu
    Copy the full SHA
    af62e80 View commit details
    Browse the repository at this point in the history