Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
import org.apache.hadoop.hbase.master.http.MasterRedirectServlet;
import org.apache.hadoop.hbase.master.http.MasterStatusServlet;
import org.apache.hadoop.hbase.master.http.api_v1.ResourceConfigFactory;
import org.apache.hadoop.hbase.master.http.hbck.HbckConfigFactory;
import org.apache.hadoop.hbase.master.janitor.CatalogJanitor;
import org.apache.hadoop.hbase.master.locking.LockManager;
import org.apache.hadoop.hbase.master.migrate.RollingUpgradeChore;
Expand Down Expand Up @@ -760,6 +761,7 @@ protected MasterRpcServices createRpcServices() throws IOException {
protected void configureInfoServer(InfoServer infoServer) {
infoServer.addUnprivilegedServlet("master-status", "/master-status", MasterStatusServlet.class);
infoServer.addUnprivilegedServlet("api_v1", "/api/v1/*", buildApiV1Servlet());
infoServer.addUnprivilegedServlet("hbck", "/hbck/*", buildHbckServlet());

infoServer.setAttribute(MASTER, this);
}
Expand All @@ -769,6 +771,11 @@ private ServletHolder buildApiV1Servlet() {
return new ServletHolder(new ServletContainer(config));
}

private ServletHolder buildHbckServlet() {
final ResourceConfig config = HbckConfigFactory.createResourceConfig(conf, this);
return new ServletHolder(new ServletContainer(config));
}

@Override
protected Class<? extends HttpServlet> getDumpServlet() {
return MasterDumpServlet.class;
Expand Down Expand Up @@ -4253,6 +4260,7 @@ public SyncReplicationReplayWALManager getSyncReplicationReplayWALManager() {
return this.syncReplicationReplayWALManager;
}

@Override
public HbckChore getHbckChore() {
return this.hbckChore;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.hadoop.hbase.executor.ExecutorService;
import org.apache.hadoop.hbase.favored.FavoredNodesManager;
import org.apache.hadoop.hbase.master.assignment.AssignmentManager;
import org.apache.hadoop.hbase.master.hbck.HbckChore;
import org.apache.hadoop.hbase.master.janitor.CatalogJanitor;
import org.apache.hadoop.hbase.master.locking.LockManager;
import org.apache.hadoop.hbase.master.normalizer.RegionNormalizerManager;
Expand Down Expand Up @@ -106,6 +107,9 @@ public interface MasterServices extends Server {
/** Returns Master's instance of {@link CatalogJanitor} */
CatalogJanitor getCatalogJanitor();

/** Returns Master's instance of {@link HbckChore} */
HbckChore getHbckChore();

/** Returns Master's instance of {@link ProcedureExecutor} */
ProcedureExecutor<MasterProcedureEnv> getMasterProcedureExecutor();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.master.http.hbck;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.http.jersey.ResponseEntityMapper;
import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.master.http.gson.GsonSerializationFeature;
import org.apache.hadoop.hbase.master.http.jersey.MasterFeature;
import org.apache.yetus.audience.InterfaceAudience;

import org.apache.hbase.thirdparty.org.glassfish.jersey.server.ResourceConfig;
import org.apache.hbase.thirdparty.org.glassfish.jersey.server.ServerProperties;
import org.apache.hbase.thirdparty.org.glassfish.jersey.server.TracingConfig;

@InterfaceAudience.Private
public class HbckConfigFactory {
private HbckConfigFactory() {
}

public static ResourceConfig createResourceConfig(Configuration conf, HMaster master) {
return new ResourceConfig().setApplicationName("hbck")
.packages(HbckConfigFactory.class.getPackage().getName())
// TODO: anything registered here that does not have necessary bindings won't inject properly
// at annotation sites and will result in a WARN logged by o.a.h.t.o.g.j.i.inject.Providers.
// These warnings should be treated by the service as fatal errors, but I have not found a
// callback API for registering a failed binding handler.
.register(ResponseEntityMapper.class).register(GsonSerializationFeature.class)
.register(new MasterFeature(master))

// devs: enable TRACING to see how jersey is dispatching to resources.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for adding this note.

// in hbase-site.xml, set 'hbase.http.jersey.tracing.type=ON_DEMAND` and
// to curl, add `-H X-Jersey-Tracing-Accept:true`
.property(ServerProperties.TRACING,
conf.get("hbase.http.jersey.tracing.type", TracingConfig.OFF.name()))
.property(ServerProperties.TRACING_THRESHOLD,
conf.get("hbase.http.jersey.tracing.threshold", "TRACE"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.master.http.hbck.model;

import org.apache.yetus.audience.InterfaceAudience;

@InterfaceAudience.Private
public class HbckEmptyRegionInfo {
private final String regionInfo;

public HbckEmptyRegionInfo(String emptyRegionInfo) {
this.regionInfo = emptyRegionInfo;
}

public String getRegionInfo() {
return regionInfo;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.master.http.hbck.model;

import java.util.List;
import org.apache.yetus.audience.InterfaceAudience;

@InterfaceAudience.Private
public class HbckInconsistentRegions {
private final String regionId;
private final HbckServerName serverNameInMeta;
private final List<HbckServerName> listOfServers;

public HbckInconsistentRegions(String inconsistentRegionId, HbckServerName serverNameInMeta,
List<HbckServerName> listOfServerName) {
this.regionId = inconsistentRegionId;
this.serverNameInMeta = serverNameInMeta;
this.listOfServers = listOfServerName;
}

public String getRegionId() {
return regionId;
}

public HbckServerName getServerNameInMeta() {
return serverNameInMeta;
}

public List<HbckServerName> getListOfServers() {
return listOfServers;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.master.http.hbck.model;

import java.util.List;
import org.apache.yetus.audience.InterfaceAudience;

@InterfaceAudience.Private
public class HbckMetrics {

private final long hbckReportStartTime;
private final long hbckReportEndTime;
private final List<HbckOrphanRegionsOnFS> hbckOrphanRegionsOnFs;
private final List<HbckOrphanRegionsOnRS> hbckOrphanRegionsOnRs;
private final List<HbckInconsistentRegions> hbckInconsistentRegions;
private final List<HbckRegionHoles> hbckHoles;
private final List<HbckOverlapRegions> hbckOverlaps;
private final List<HbckUnknownServers> hbckUnknownServers;
private final List<HbckEmptyRegionInfo> hbckEmptyRegionInfo;

public HbckMetrics(long hbckReportStartTime, long hbckReportEndTime,
List<HbckOrphanRegionsOnFS> hbckOrphanRegionsOnFs,
List<HbckOrphanRegionsOnRS> hbckOrphanRegionsOnRs,
List<HbckInconsistentRegions> hbckInconsistentRegions, List<HbckRegionHoles> hbckHoles,
List<HbckOverlapRegions> hbckOverlaps, List<HbckUnknownServers> hbckUnknownServers,
List<HbckEmptyRegionInfo> hbckEmptyRegionInfo) {
this.hbckReportStartTime = hbckReportStartTime;
this.hbckReportEndTime = hbckReportEndTime;
this.hbckOrphanRegionsOnFs = hbckOrphanRegionsOnFs;
this.hbckOrphanRegionsOnRs = hbckOrphanRegionsOnRs;
this.hbckInconsistentRegions = hbckInconsistentRegions;
this.hbckHoles = hbckHoles;
this.hbckOverlaps = hbckOverlaps;
this.hbckUnknownServers = hbckUnknownServers;
this.hbckEmptyRegionInfo = hbckEmptyRegionInfo;
}

public long gethbckReportStartTime() {
return hbckReportStartTime;
}

public long gethbckReportEndTime() {
return hbckReportEndTime;
}

public List<HbckOrphanRegionsOnFS> gethbckOrphanRegionsOnFs() {
return hbckOrphanRegionsOnFs;
}

public List<HbckOrphanRegionsOnRS> gethbckOrphanRegionsOnRs() {
return hbckOrphanRegionsOnRs;
}

public List<HbckInconsistentRegions> gethbckInconsistentRegions() {
return hbckInconsistentRegions;
}

public List<HbckRegionHoles> gethbckHoles() {
return hbckHoles;
}

public List<HbckOverlapRegions> gethbckOverlaps() {
return hbckOverlaps;
}

public List<HbckUnknownServers> gethbckUnknownServers() {
return hbckUnknownServers;
}

public List<HbckEmptyRegionInfo> gethbckEmptyRegionInfo() {
return hbckEmptyRegionInfo;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.master.http.hbck.model;

import org.apache.yetus.audience.InterfaceAudience;

@InterfaceAudience.Private
public class HbckOrphanRegionsOnFS {
private final String regionId;
private final String regionHdfsPath;

public HbckOrphanRegionsOnFS(String regionId, String orphanRegionHdfsPath) {
this.regionId = regionId;
this.regionHdfsPath = orphanRegionHdfsPath;
}

public String getRegionId() {
return regionId;
}

public String getRegionHdfsPath() {
return regionHdfsPath;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.master.http.hbck.model;

import org.apache.yetus.audience.InterfaceAudience;

@InterfaceAudience.Private
public class HbckOrphanRegionsOnRS {
private final String regionId;
private final HbckServerName rsName;

public HbckOrphanRegionsOnRS(String orphanRegionId, HbckServerName orphanRegionRsName) {
this.regionId = orphanRegionId;
this.rsName = orphanRegionRsName;
}

public String getRegionId() {
return regionId;
}

public HbckServerName getRsName() {
return rsName;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.master.http.hbck.model;

import org.apache.yetus.audience.InterfaceAudience;

@InterfaceAudience.Private
public class HbckOverlapRegions {
private final HbckRegionDetails region1;
private final HbckRegionDetails region2;

public HbckOverlapRegions(HbckRegionDetails overlapRegion1, HbckRegionDetails overlapRegion2) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be region1, region2 as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

this.region1 = overlapRegion1;
this.region2 = overlapRegion2;
}

public HbckRegionDetails getRegion1() {
return region1;
}

public HbckRegionDetails getRegion2() {
return region2;
}
}
Loading