001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.regionserver.storefiletracker;
019
020import org.apache.hadoop.conf.Configuration;
021import org.apache.hadoop.hbase.CompoundConfiguration;
022import org.apache.hadoop.hbase.HBaseIOException;
023import org.apache.hadoop.hbase.TableName;
024import org.apache.hadoop.hbase.client.TableDescriptor;
025import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
026import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv;
027import org.apache.yetus.audience.InterfaceAudience;
028
029@InterfaceAudience.Private
030public class ModifyTableStoreFileTrackerProcedure extends ModifyStoreFileTrackerProcedure {
031
032  public ModifyTableStoreFileTrackerProcedure() {
033  }
034
035  public ModifyTableStoreFileTrackerProcedure(MasterProcedureEnv env, TableName tableName,
036    String dstSFT) throws HBaseIOException {
037    super(env, tableName, dstSFT);
038  }
039
040  @Override
041  protected void preCheck(TableDescriptor current) {
042  }
043
044  @Override
045  protected Configuration createConf(Configuration conf, TableDescriptor current) {
046    return new CompoundConfiguration().add(conf).addBytesMap(current.getValues());
047  }
048
049  @Override
050  protected TableDescriptor createRestoreTableDescriptor(TableDescriptor current,
051    String restoreSFT) {
052    return TableDescriptorBuilder.newBuilder(current)
053      .setValue(StoreFileTrackerFactory.TRACKER_IMPL, restoreSFT).build();
054  }
055
056  @Override
057  protected TableDescriptor createMigrationTableDescriptor(Configuration conf,
058    TableDescriptor current) {
059    TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(current);
060    migrate(conf, builder::setValue);
061    return builder.build();
062  }
063
064  @Override
065  protected TableDescriptor createFinishTableDescriptor(TableDescriptor current) {
066    TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(current);
067    finish(builder::setValue, builder::removeValue);
068    return builder.build();
069  }
070
071}