5151import org .apache .hadoop .hbase .ServerName ;
5252import org .apache .hadoop .hbase .TableName ;
5353import org .apache .hadoop .hbase .client .Admin ;
54- import org .apache .hadoop .hbase .client .ClusterConnection ;
54+ import org .apache .hadoop .hbase .client .Connection ;
5555import org .apache .hadoop .hbase .client .ConnectionFactory ;
5656import org .apache .hadoop .hbase .client .Hbck ;
5757import org .apache .hadoop .hbase .client .Put ;
@@ -151,7 +151,7 @@ public class HBCK2 extends Configured implements org.apache.hadoop.util.Tool {
151151 * Check for HBCK support. Expects created connection.
152152 * @param supportedVersions list of zero or more supported versions.
153153 */
154- void checkHBCKSupport (ClusterConnection connection , String cmd , String ... supportedVersions )
154+ void checkHBCKSupport (Connection connection , String cmd , String ... supportedVersions )
155155 throws IOException {
156156 if (skipCheck ) {
157157 LOG .info ("Skipped {} command version check; 'skip' set" , cmd );
@@ -172,7 +172,7 @@ void checkHBCKSupport(ClusterConnection connection, String cmd, String... suppor
172172 }
173173 }
174174
175- void checkFunctionSupported (ClusterConnection connection , String cmd ) throws IOException {
175+ void checkFunctionSupported (Connection connection , String cmd ) throws IOException {
176176 if (skipCheck ) {
177177 LOG .info ("Skipped {} command version check; 'skip' set" , cmd );
178178 return ;
@@ -234,12 +234,12 @@ TableState setTableState(Hbck hbck, TableName tableName, TableState.State state)
234234 return hbck .setTableStateInMeta (new TableState (tableName , state ));
235235 }
236236
237- int setRegionState (ClusterConnection connection , String region , RegionState .State newState )
237+ int setRegionState (Connection connection , String region , RegionState .State newState )
238238 throws IOException {
239239 return setRegionState (connection , region , 0 , newState );
240240 }
241241
242- int setRegionState (ClusterConnection connection , String [] args ) throws IOException {
242+ int setRegionState (Connection connection , String [] args ) throws IOException {
243243 Options options = new Options ();
244244 Option inputFile = Option .builder ("i" ).longOpt ("inputFiles" ).build ();
245245 options .addOption (inputFile );
@@ -267,7 +267,7 @@ int setRegionState(ClusterConnection connection, String[] args) throws IOExcepti
267267 }
268268 }
269269
270- int setRegionStateByArgs (ClusterConnection connection , String [] args ) throws IOException {
270+ int setRegionStateByArgs (Connection connection , String [] args ) throws IOException {
271271 if (args == null || args .length < 3 ) {
272272 return EXIT_FAILURE ;
273273 }
@@ -276,7 +276,7 @@ int setRegionStateByArgs(ClusterConnection connection, String[] args) throws IOE
276276 return setRegionState (connection , args [0 ], replicaId , state );
277277 }
278278
279- int setRegionState (ClusterConnection connection , String region , int replicaId ,
279+ int setRegionState (Connection connection , String region , int replicaId ,
280280 RegionState .State newState ) throws IOException {
281281 if (newState == null ) {
282282 throw new IllegalArgumentException ("State can't be null." );
@@ -571,7 +571,7 @@ List<Boolean> bypass(String[] args) throws IOException {
571571 List <Long > pids = Arrays .stream (pidStrs ).map (Long ::valueOf ).collect (Collectors .toList ());
572572
573573 // Process here
574- try (ClusterConnection connection = connect (); Hbck hbck = connection .getHbck ()) {
574+ try (Connection connection = connect (); Hbck hbck = connection .getHbck ()) {
575575 checkFunctionSupported (connection , BYPASS );
576576 if (batchSize == NO_BATCH_SIZE ) {
577577 return hbck .bypassProcedure (pids , lockWait , overrideFlag , recursiveFlag );
@@ -615,7 +615,7 @@ void regionInfoMismatch(String[] args) throws Exception {
615615 CommandLineParser parser = new DefaultParser ();
616616 CommandLine commandLine = parser .parse (options , args , false );
617617 final boolean fix = commandLine .hasOption (dryRunOption .getOpt ());
618- try (ClusterConnection connection = connect ()) {
618+ try (Connection connection = connect ()) {
619619 new RegionInfoMismatchTool (connection ).run (fix );
620620 }
621621 }
@@ -1140,8 +1140,8 @@ public int run(String[] args) throws IOException {
11401140 * Create connection. Needs to be called before we go against remote server. Be sure to close when
11411141 * done.
11421142 */
1143- ClusterConnection connect () throws IOException {
1144- return ( ClusterConnection ) ConnectionFactory .createConnection (getConf ());
1143+ Connection connect () throws IOException {
1144+ return ConnectionFactory .createConnection (getConf ());
11451145 }
11461146
11471147 /**
@@ -1166,7 +1166,7 @@ private int doCommandLine(CommandLine commandLine, Options options) throws IOExc
11661166 + " takes tablename and state arguments: e.g. user ENABLED, or a list of input files" );
11671167 return EXIT_FAILURE ;
11681168 }
1169- try (ClusterConnection connection = connect (); Hbck hbck = connection .getHbck ()) {
1169+ try (Connection connection = connect (); Hbck hbck = connection .getHbck ()) {
11701170 checkFunctionSupported (connection , command );
11711171 setTableState (hbck , purgeFirst (commands ));
11721172 }
@@ -1177,7 +1177,7 @@ private int doCommandLine(CommandLine commandLine, Options options) throws IOExc
11771177 showErrorMessage (command + " takes one or more encoded region names" );
11781178 return EXIT_FAILURE ;
11791179 }
1180- try (ClusterConnection connection = connect (); Hbck hbck = connection .getHbck ()) {
1180+ try (Connection connection = connect (); Hbck hbck = connection .getHbck ()) {
11811181 checkFunctionSupported (connection , command );
11821182 System .out .println (assigns (hbck , purgeFirst (commands )));
11831183 }
@@ -1206,7 +1206,7 @@ private int doCommandLine(CommandLine commandLine, Options options) throws IOExc
12061206 showErrorMessage (command + " takes one or more encoded region names" );
12071207 return EXIT_FAILURE ;
12081208 }
1209- try (ClusterConnection connection = connect (); Hbck hbck = connection .getHbck ()) {
1209+ try (Connection connection = connect (); Hbck hbck = connection .getHbck ()) {
12101210 checkFunctionSupported (connection , command );
12111211 System .out .println (toString (unassigns (hbck , purgeFirst (commands ))));
12121212 }
@@ -1219,13 +1219,13 @@ private int doCommandLine(CommandLine commandLine, Options options) throws IOExc
12191219 return EXIT_FAILURE ;
12201220 }
12211221
1222- try (ClusterConnection connection = connect ()) {
1222+ try (Connection connection = connect ()) {
12231223 checkHBCKSupport (connection , command );
12241224 return setRegionState (connection , purgeFirst (commands ));
12251225 }
12261226
12271227 case FILESYSTEM :
1228- try (ClusterConnection connection = connect ()) {
1228+ try (Connection connection = connect ()) {
12291229 checkHBCKSupport (connection , command );
12301230 try (FileSystemFsck fsfsck = new FileSystemFsck (getConf ())) {
12311231 Pair <CommandLine , List <String >> pair =
@@ -1237,7 +1237,7 @@ private int doCommandLine(CommandLine commandLine, Options options) throws IOExc
12371237 }
12381238
12391239 case REPLICATION :
1240- try (ClusterConnection connection = connect ()) {
1240+ try (Connection connection = connect ()) {
12411241 checkHBCKSupport (connection , command , "2.1.1" , "2.2.0" , "3.0.0" );
12421242 try (ReplicationFsck replicationFsck = new ReplicationFsck (getConf ())) {
12431243 Pair <CommandLine , List <String >> pair =
@@ -1253,7 +1253,7 @@ private int doCommandLine(CommandLine commandLine, Options options) throws IOExc
12531253 showErrorMessage (command + " takes one or more serverNames" );
12541254 return EXIT_FAILURE ;
12551255 }
1256- try (ClusterConnection connection = connect (); Hbck hbck = connection .getHbck ()) {
1256+ try (Connection connection = connect (); Hbck hbck = connection .getHbck ()) {
12571257 checkFunctionSupported (connection , command );
12581258 System .out .println (toString (scheduleRecoveries (hbck , purgeFirst (commands ))));
12591259 }
@@ -1264,7 +1264,7 @@ private int doCommandLine(CommandLine commandLine, Options options) throws IOExc
12641264 showErrorMessage (command + " doesn't take any arguments" );
12651265 return EXIT_FAILURE ;
12661266 }
1267- try (ClusterConnection connection = connect (); Hbck hbck = connection .getHbck ()) {
1267+ try (Connection connection = connect (); Hbck hbck = connection .getHbck ()) {
12681268 checkFunctionSupported (connection , command );
12691269 System .out .println (toString (recoverUnknown (hbck )));
12701270 }
@@ -1275,7 +1275,7 @@ private int doCommandLine(CommandLine commandLine, Options options) throws IOExc
12751275 showErrorMessage (command + " doesn't take any arguments" );
12761276 return EXIT_FAILURE ;
12771277 }
1278- try (ClusterConnection connection = connect (); Hbck hbck = connection .getHbck ()) {
1278+ try (Connection connection = connect (); Hbck hbck = connection .getHbck ()) {
12791279 checkFunctionSupported (connection , command );
12801280 hbck .fixMeta ();
12811281 System .out .println ("Server-side processing of fixMeta triggered." );
@@ -1320,7 +1320,7 @@ private int doCommandLine(CommandLine commandLine, Options options) throws IOExc
13201320 List <String > tableNames = Arrays .asList (purgeFirst (commands ));
13211321 MissingTableDescriptorGenerator tableInfoGenerator =
13221322 new MissingTableDescriptorGenerator (getConf ());
1323- try (ClusterConnection connection = connect ()) {
1323+ try (Connection connection = connect ()) {
13241324 tableInfoGenerator .generateTableDescriptorFileIfMissing (connection .getAdmin (),
13251325 tableNames );
13261326 } catch (IOException e ) {
0 commit comments