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

feat: add logs for upgrading candidate region and updating metadata #3077

Merged
merged 3 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion src/datanode/src/heartbeat/handler/upgrade_region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use common_error::ext::ErrorExt;
use common_meta::instruction::{InstructionReply, UpgradeRegion, UpgradeRegionReply};
use common_telemetry::warn;
use common_telemetry::{info, warn};
use futures_util::future::BoxFuture;
use store_api::region_request::{RegionCatchupRequest, RegionRequest};

Expand Down Expand Up @@ -56,6 +56,7 @@ impl HandlerContext {
.try_register(
region_id,
Box::pin(async move {
info!("Executing region: {region_id} catchup to: last entry id {last_entry_id:?}");
region_server_moved
.handle_request(
region_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

use common_meta::key::datanode_table::RegionInfo;
use common_meta::rpc::router::RegionRoute;
use common_meta::rpc::router::{region_distribution, RegionRoute};
use common_telemetry::{info, warn};
use snafu::{ensure, OptionExt, ResultExt};

Expand Down Expand Up @@ -144,6 +144,11 @@ impl UpdateMetadata {
} = datanode_table_value.region_info.clone();
let table_route_value = ctx.get_table_route_value().await?;

let region_distribution = region_distribution(&region_routes);
info!(
"Trying to update region routes to {region_distribution:?} for table: {}",
region_id.table_id()
WenyXu marked this conversation as resolved.
Show resolved Hide resolved
);
if let Err(err) = table_metadata_manager
.update_table_route(
region_id.table_id(),
Expand Down
9 changes: 9 additions & 0 deletions src/mito2/src/worker/handle_catchup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@

use std::sync::Arc;

use common_telemetry::info;
use snafu::ensure;
use store_api::logstore::LogStore;
use store_api::region_request::{AffectedRows, RegionCatchupRequest};
use store_api::storage::RegionId;
use tokio::time::Instant;

use crate::error::{self, Result};
use crate::region::opener::{replay_memtable, RegionOpener};
Expand All @@ -44,6 +46,7 @@ impl<S: LogStore> RegionWorkerLoop<S> {

// Utilizes the short circuit evaluation.
let region = if !is_mutable_empty || region.manifest_manager.has_update().await? {
info!("Reopening the region: {region_id}");
WenyXu marked this conversation as resolved.
Show resolved Hide resolved
let reopened_region = Arc::new(
RegionOpener::new(
region_id,
Expand All @@ -67,6 +70,8 @@ impl<S: LogStore> RegionWorkerLoop<S> {
};

let flushed_entry_id = region.version_control.current().last_entry_id;
info!("Trying to replay memtable for region: {region_id}");
WenyXu marked this conversation as resolved.
Show resolved Hide resolved
let timer = Instant::now();
let last_entry_id = replay_memtable(
&self.wal,
&region.wal_options,
Expand All @@ -75,6 +80,10 @@ impl<S: LogStore> RegionWorkerLoop<S> {
&region.version_control,
)
.await?;
info!(
"Region: {region_id} catchup finished, elapsed: {:?}. last entry id: {last_entry_id}, expected: {:?}.",
request.entry_id, timer.elapsed()
WenyXu marked this conversation as resolved.
Show resolved Hide resolved
);
if let Some(expected_last_entry_id) = request.entry_id {
ensure!(
expected_last_entry_id == last_entry_id,
Expand Down
Loading