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

remove #2807

Open
wants to merge 1 commit into
base: release-2.5
Choose a base branch
from
Open

remove #2807

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

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,15 @@ package com.pingcap.tispark.listener

import com.pingcap.tikv.event.CacheInvalidateEvent
import com.pingcap.tikv.region.RegionManager
import com.pingcap.tispark.accumulator.CacheInvalidateAccumulator
import com.pingcap.tispark.handler.CacheInvalidateEventHandler
import org.apache.spark.SparkContext
import org.slf4j.LoggerFactory

class CacheInvalidateListener()
extends Serializable
with java.util.function.Function[CacheInvalidateEvent, Void] {
final val CACHE_ACCUMULATOR_NAME = "CacheInvalidateAccumulator"
final val CACHE_INVALIDATE_ACCUMULATOR = new CacheInvalidateAccumulator

override def apply(t: CacheInvalidateEvent): Void = {
// this operation shall be executed in executor nodes
CACHE_INVALIDATE_ACCUMULATOR.add(t)
null
}
}
Expand Down Expand Up @@ -71,12 +66,5 @@ object CacheInvalidateListener {
def init(
sc: SparkContext,
regionManager: RegionManager,
manager: CacheInvalidateListener): Unit =
if (sc != null && regionManager != null) {
sc.register(manager.CACHE_INVALIDATE_ACCUMULATOR, manager.CACHE_ACCUMULATOR_NAME)
sc.addSparkListener(
new PDCacheInvalidateListener(
manager.CACHE_INVALIDATE_ACCUMULATOR,
CacheInvalidateEventHandler(regionManager)))
}
manager: CacheInvalidateListener): Unit = {}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public RegionManager(ReadOnlyPDClient pdClient) {
}

public synchronized void setCacheInvalidateCallback(
Function<CacheInvalidateEvent, Void> cacheInvalidateCallback) {
Function<CacheInvalidateEvent, Void> cacheInvalidateCallback) {
this.cacheInvalidateCallback = cacheInvalidateCallback;
}

Expand Down Expand Up @@ -195,7 +195,7 @@ public void invalidateRegion(TiRegion region) {
}

public void invalidateRange(ByteString startKey, ByteString endKey) {
cache.invalidateRange(startKey,endKey);
cache.invalidateRange(startKey, endKey);
}

public static class RegionCache {
Expand Down Expand Up @@ -263,7 +263,8 @@ private synchronized TiRegion getRegionFromCache(Key key) {
private synchronized void invalidateRange(ByteString startKey, ByteString endKey) {
regionCache.remove(makeRange(startKey, endKey));
if (logger.isDebugEnabled()) {
logger.debug(String.format("invalidateRange success, startKey[%s], endKey[%s]", startKey, endKey));
logger.debug(
String.format("invalidateRange success, startKey[%s], endKey[%s]", startKey, endKey));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ private List<RangeSplitter.RegionTask> handleCopResponse(
// we need to invalidate cache when region not find
if (regionError.hasRegionNotFound()) {
logger.info("invalidateRange when Re-splitting region task because of region not find.");
this.regionManager.invalidateRange(region.getStartKey(),region.getEndKey());
this.regionManager.invalidateRange(region.getStartKey(), region.getEndKey());
}
// Split ranges
return RangeSplitter.newSplitter(this.regionManager).splitRangeByRegion(ranges, storeType);
Expand Down