Skip to content

Commit

Permalink
feat: set readonly first when deregister region (#2391)
Browse files Browse the repository at this point in the history
* feat: set readonly first when deregister region

* revert distxxx
  • Loading branch information
fengjiachun authored Sep 14, 2023
1 parent a84a8ad commit d1adb91
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/datanode/src/region_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl RegionServerHandler for RegionServer {
for result in results {
match result
.map_err(BoxedError::new)
.context(servers_error::ExecuteGrpcRequestSnafu)?
.context(ExecuteGrpcRequestSnafu)?
{
Output::AffectedRows(rows) => affected_rows += rows,
Output::Stream(_) | Output::RecordBatches(_) => {
Expand Down Expand Up @@ -242,7 +242,9 @@ impl RegionServerInner {
}
RegionChange::Deregisters => {
info!("Region {region_id} is deregistered from engine {engine_type}");
self.region_map.remove(&region_id);
self.region_map
.remove(&region_id)
.map(|(id, engine)| engine.set_writable(id, false));
}
}

Expand Down Expand Up @@ -417,7 +419,7 @@ impl SchemaProvider for DummySchemaProvider {
}
}

/// For [TableProvider](datafusion::datasource::TableProvider) and [DummyCatalogList]
/// For [TableProvider](TableProvider) and [DummyCatalogList]
#[derive(Clone)]
struct DummyTableProvider {
region_id: RegionId,
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

pub mod distributed;
mod distributed;
mod grpc;
mod influxdb;
mod opentsdb;
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/statement/ddl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl StatementExecutor {
let table_id = resp.table_id.context(error::UnexpectedSnafu {
violated: "expected table_id",
})?;
info!("Successfully created distributed table '{table_name}' with table id {table_id}");
info!("Successfully created table '{table_name}' with table id {table_id}");

table_info.ident.table_id = table_id;
let engine = table_info.meta.engine.to_string();
Expand Down

0 comments on commit d1adb91

Please sign in to comment.