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

removes unused zookeeper nodes in upgrade #4712

Merged
merged 3 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 0 additions & 4 deletions core/src/main/java/org/apache/accumulo/core/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ public class Constants {
public static final String ZMONITOR_LOCK = ZMONITOR + "/lock";
public static final String ZMONITOR_HTTP_ADDR = ZMONITOR + "/http_addr";

// used by < 2.1 table and namespace configurations
public static final String ZCONF_LEGACY = "/conf";
public static final String ZCONFIG = "/config";

public static final String ZTSERVERS = "/tservers";
Expand All @@ -78,8 +76,6 @@ public class Constants {
public static final String ZDEAD = "/dead";
public static final String ZDEADTSERVERS = ZDEAD + "/tservers";

public static final String ZTRACERS = "/tracers";

public static final String ZPROBLEMS = "/problems";

public static final String BULK_ARBITRATOR_TYPE = "bulkTx";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,20 @@ public class Upgrader11to12 implements Upgrader {
static final Set<Text> UPGRADE_FAMILIES =
Set.of(DataFileColumnFamily.NAME, CHOPPED, ExternalCompactionColumnFamily.NAME);

public static final String ZTRACERS = "/tracers";

@Override
public void upgradeZookeeper(@NonNull ServerContext context) {
log.debug("Upgrade ZooKeeper: upgrading to data version {}", METADATA_FILE_JSON_ENCODING);
var rootBase = ZooUtil.getRoot(context.getInstanceID()) + ZROOT_TABLET;
var zooRoot = ZooUtil.getRoot(context.getInstanceID());
var rootBase = zooRoot + ZROOT_TABLET;

try {
var zrw = context.getZooReaderWriter();

// clean up nodes no longer in use
zrw.recursiveDelete(zooRoot + ZTRACERS, ZooUtil.NodeMissingPolicy.SKIP);

Stat stat = new Stat();
byte[] rootData = zrw.getData(rootBase, stat);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.fate.zookeeper.ZooReaderWriter;
import org.apache.accumulo.core.fate.zookeeper.ZooUtil;
import org.apache.accumulo.core.metadata.StoredTabletFile;
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ChoppedColumnFamily;
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
Expand Down Expand Up @@ -366,6 +367,10 @@ public void upgradeZooKeeperTest() throws Exception {
expect(zrw.overwritePersistentData(eq("/accumulo/" + iid.canonical() + "/root_tablet"),
capture(byteCapture), eq(123))).andReturn(true).once();

zrw.recursiveDelete("/accumulo/" + iid.canonical() + "/tracers",
ZooUtil.NodeMissingPolicy.SKIP);
expectLastCall().once();

replay(context, zrw);

upgrader.upgradeZookeeper(context);
Expand Down