Skip to content
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
profile:
- {name: 'unit-tests', javaver: 11, args: 'verify -PskipQA -DskipTests=false'}
- {name: 'qa-checks', javaver: 11, args: 'verify javadoc:jar -Psec-bugs -DskipTests -Dspotbugs.timeout=3600000'}
- {name: 'compat', javaver: 11, args: 'package -DskipTests -Dhadoop.version=3.0.3 -Dzookeeper.version=3.5.10'}
- {name: 'compat', javaver: 11, args: 'package -DskipTests -Dhadoop.version=3.0.3 -Dzookeeper.version=3.6.4'}
- {name: 'errorprone', javaver: 11, args: 'verify -Perrorprone,skipQA'}
- {name: 'jdk17', javaver: 17, args: 'verify -DskipITs'}
fail-fast: false
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/org/apache/accumulo/core/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class Constants {
public static final String ZTABLE_COMPACT_CANCEL_ID = "/compact-cancel-id";
public static final String ZTABLE_NAMESPACE = "/namespace";

public static final String ZTABLET_CACHE = "/tablet_cache";

public static final String ZNAMESPACES = "/namespaces";
public static final String ZNAMESPACE_NAME = "/name";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ private void setLocationOnce(String val, String qual, LocationType lt) {
}

@VisibleForTesting
static TabletMetadata create(String id, String prevEndRow, String endRow) {
public static TabletMetadata create(String id, String prevEndRow, String endRow) {
TabletMetadata te = new TabletMetadata();
te.tableId = TableId.of(id);
te.sawPrevEndRow = true;
Expand Down
10 changes: 9 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<!-- bouncycastle version for test dependencies -->
<bouncycastle.version>1.70</bouncycastle.version>
<!-- Curator version -->
<curator.version>5.3.0</curator.version>
<curator.version>5.4.0</curator.version>
<!-- relative path for Eclipse format; should override in child modules if necessary -->
<eclipseFormatterStyle>${project.parent.basedir}/contrib/Eclipse-Accumulo-Codestyle.xml</eclipseFormatterStyle>
<errorprone.version>2.15.0</errorprone.version>
Expand Down Expand Up @@ -545,6 +545,14 @@
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.apache.accumulo.core.fate.zookeeper.ZooReader;
import org.apache.accumulo.core.fate.zookeeper.ZooReaderWriter;
import org.apache.accumulo.core.metadata.schema.Ample;
import org.apache.accumulo.core.metadata.schema.AmpleImpl;
import org.apache.accumulo.core.rpc.SslConnectionParams;
import org.apache.accumulo.core.singletons.SingletonReservation;
import org.apache.accumulo.core.spi.crypto.CryptoServiceFactory;
Expand All @@ -68,6 +69,7 @@
import org.apache.accumulo.server.fs.VolumeManager;
import org.apache.accumulo.server.mem.LowMemoryDetector;
import org.apache.accumulo.server.metadata.ServerAmpleImpl;
import org.apache.accumulo.server.metadata.TabletMetadataCache;
import org.apache.accumulo.server.rpc.SaslServerConnectionParams;
import org.apache.accumulo.server.rpc.ThriftServerType;
import org.apache.accumulo.server.security.AuditedSecurityOperation;
Expand All @@ -87,6 +89,7 @@
* and have access to the system files and configuration.
*/
public class ServerContext extends ClientContext {

private static final Logger log = LoggerFactory.getLogger(ServerContext.class);

private final ServerInfo info;
Expand All @@ -104,6 +107,9 @@ public class ServerContext extends ClientContext {
private final Supplier<AuditedSecurityOperation> securityOperation;
private final Supplier<CryptoServiceFactory> cryptoFactorySupplier;
private final Supplier<LowMemoryDetector> lowMemoryDetector;
private final Supplier<TabletMetadataCache> tabletMetadataCache;

private volatile boolean tabletMetadataCacheInitialized = false;

public ServerContext(SiteConfiguration siteConfig) {
this(new ServerInfo(siteConfig));
Expand All @@ -130,6 +136,8 @@ private ServerContext(ServerInfo info) {
memoize(() -> new AuditedSecurityOperation(this, SecurityOperation.getAuthorizor(this),
SecurityOperation.getAuthenticator(this), SecurityOperation.getPermHandler(this)));
lowMemoryDetector = memoize(() -> new LowMemoryDetector());
tabletMetadataCache = memoize(
() -> new TabletMetadataCache(info.getInstanceID(), zooReaderWriter, new AmpleImpl(this)));
}

/**
Expand Down Expand Up @@ -460,4 +468,24 @@ public LowMemoryDetector getLowMemoryDetector() {
return lowMemoryDetector.get();
}

public TabletMetadataCache getTabletMetadataCache() {
try {
return tabletMetadataCache.get();
} finally {
tabletMetadataCacheInitialized = true;
}
}

public boolean isTabletMetadataCacheInitialized() {
return tabletMetadataCacheInitialized;
}

@Override
public synchronized void close() {
super.close();
if (tabletMetadataCacheInitialized) {
this.tabletMetadataCache.get().close();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ void initialize(final ServerContext context, final boolean clearInstanceName,
ZooUtil.NodeExistsPolicy.FAIL);
zoo.putPersistentData(zkInstanceRoot + Constants.ZSSERVERS, EMPTY_BYTE_ARRAY,
ZooUtil.NodeExistsPolicy.FAIL);
zoo.putPersistentData(zkInstanceRoot + Constants.ZTABLET_CACHE, EMPTY_BYTE_ARRAY,
ZooUtil.NodeExistsPolicy.FAIL);
}

/**
Expand Down
Loading