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

improve for metacache load #913

Merged
merged 1 commit into from
Nov 20, 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import com.ctrip.xpipe.concurrent.AbstractExceptionLogTask;
import com.ctrip.xpipe.redis.console.config.ConsoleConfig;
import com.ctrip.xpipe.redis.core.entity.XpipeMeta;
import org.xml.sax.SAXException;


import java.io.IOException;
import java.util.*;
import java.util.concurrent.TimeUnit;

Expand All @@ -27,14 +29,15 @@ void loadCache() throws Exception {
TransactionMonitor.DEFAULT.logTransaction("MetaCacheApi", "load", new Task() {

@Override
public void go() {
public void go() throws IOException, SAXException {
try {
XpipeMeta xpipeMeta = consolePortalService.getXpipeAllMeta(getVersion());
checkMeta(xpipeMeta, config.maxRemovedDcsCnt(), config.maxRemovedClustersPercent());
refreshMetaParts(xpipeMeta);
refreshMeta(xpipeMeta);
} catch (Throwable th) {
logger.error("[MetaCacheApi][load]", th);
throw th;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.ctrip.xpipe.redis.core.route.RouteChooseStrategyFactory;
import com.ctrip.xpipe.utils.ObjectUtils;
import com.ctrip.xpipe.utils.VisibleForTesting;
import com.ctrip.xpipe.utils.XpipeThreadFactory;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PreDestroy;
Expand Down Expand Up @@ -68,7 +69,8 @@ public class DefaultMetaCache extends AbstractMetaCache implements MetaCache, Co

private List<TimeBoundCache<String>> xmlFormatXPipeMetaParts = null;

protected ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1);
protected ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1,
XpipeThreadFactory.create("MetaCacheLoad"));

protected ScheduledFuture<?> future;

Expand Down
Loading