Skip to content

Commit ff627fa

Browse files
authored
Merge branch 'main' into improvement-enable-disable
2 parents d0e2c59 + 1650c20 commit ff627fa

File tree

12 files changed

+209
-164
lines changed

12 files changed

+209
-164
lines changed

.github/dependabot.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
8+
- package-ecosystem: "gradle"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"
12+
13+
- package-ecosystem: "npm"
14+
directory: "/web/web"
15+
schedule:
16+
interval: "weekly"

core/src/main/java/org/apache/gravitino/Configs.java

+8
Original file line numberDiff line numberDiff line change
@@ -310,4 +310,12 @@ private Configs() {}
310310
.version(ConfigConstants.VERSION_0_7_0)
311311
.stringConf()
312312
.createWithDefault(SimpleFormatterV2.class.getName());
313+
314+
public static final ConfigEntry<List<String>> VISIBLE_CONFIGS =
315+
new ConfigBuilder("gravitino.server.visibleConfigs")
316+
.doc("List of configs that are visible in the config servlet")
317+
.version(ConfigConstants.VERSION_0_9_0)
318+
.stringConf()
319+
.toSequence()
320+
.createWithDefault(Collections.emptyList());
313321
}

core/src/main/java/org/apache/gravitino/config/ConfigConstants.java

+3
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,7 @@ private ConfigConstants() {}
7070

7171
/** The version number for the 0.8.0 release. */
7272
public static final String VERSION_0_8_0 = "0.8.0";
73+
74+
/** The version number for the 0.9.0 release. */
75+
public static final String VERSION_0_9_0 = "0.9.0";
7376
}

core/src/main/java/org/apache/gravitino/lock/LockManager.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ private void startDeadLockChecker() {
112112

113113
deadLockChecker.scheduleAtFixedRate(
114114
() -> {
115-
LOG.info("Start to check the dead lock...");
115+
LOG.debug("Start to check the dead lock...");
116116
checkDeadLock(treeLockRootNode);
117-
LOG.info("Finish to check the dead lock...");
117+
LOG.debug("Finish to check the dead lock...");
118118
},
119119
0,
120120
60,
@@ -161,12 +161,12 @@ private void startNodeCleaner() {
161161
lockCleaner.scheduleAtFixedRate(
162162
() -> {
163163
long nodeCount = totalNodeCount.get();
164-
LOG.info("Total tree lock node count: {}", nodeCount);
164+
LOG.debug("Total tree lock node count: {}", nodeCount);
165165
// If the total node count is greater than the maxTreeNodeInMemory * 0.5, we will do the
166166
// clear up in case of the memory explosion.
167167
if (nodeCount > maxTreeNodeInMemory * 0.5) {
168168
StopWatch watch = StopWatch.createStarted();
169-
LOG.trace("Start to clean up the stale tree lock nodes...");
169+
LOG.info("Start to clean up the stale tree lock nodes...");
170170
treeLockRootNode
171171
.getAllChildren()
172172
.forEach(child -> evictStaleNodes(child, treeLockRootNode));

core/src/main/java/org/apache/gravitino/storage/relational/RelationalGarbageCollector.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ public void start() {
7171
@VisibleForTesting
7272
public void collectAndClean() {
7373
long threadId = Thread.currentThread().getId();
74-
LOG.info("Thread {} start to collect garbage...", threadId);
74+
LOG.debug("Thread {} start to collect garbage...", threadId);
7575

7676
try {
77-
LOG.info("Start to collect and delete legacy data by thread {}", threadId);
77+
LOG.debug("Start to collect and delete legacy data by thread {}", threadId);
7878
long legacyTimeline = System.currentTimeMillis() - storeDeleteAfterTimeMillis;
7979
for (Entity.EntityType entityType : Entity.EntityType.values()) {
8080
long deletedCount = Long.MAX_VALUE;
81-
LOG.info(
81+
LOG.debug(
8282
"Try to physically delete {} legacy data that has been marked deleted before {}",
8383
entityType,
8484
legacyTimeline);
@@ -94,7 +94,7 @@ public void collectAndClean() {
9494
LOG.info("Start to collect and delete old version data by thread {}", threadId);
9595
for (Entity.EntityType entityType : Entity.EntityType.values()) {
9696
long deletedCount = Long.MAX_VALUE;
97-
LOG.info(
97+
LOG.debug(
9898
"Try to softly delete {} old version data that has been over retention count {}",
9999
entityType,
100100
versionRetentionCount);
@@ -109,7 +109,7 @@ public void collectAndClean() {
109109
} catch (Exception e) {
110110
LOG.error("Thread {} failed to collect and clean garbage.", threadId, e);
111111
} finally {
112-
LOG.info("Thread {} finish to collect garbage.", threadId);
112+
LOG.debug("Thread {} finish to collect garbage.", threadId);
113113
}
114114
}
115115

docs/gravitino-server-config.md

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ The `gravitino.conf` file lists the configuration items in the following table.
3737
| `gravitino.server.shutdown.timeout` | Time in milliseconds to gracefully shut down of the Gravitino webserver. | `3000` | No | 0.2.0 |
3838
| `gravitino.server.webserver.customFilters` | Comma-separated list of filter class names to apply to the API. | (none) | No | 0.4.0 |
3939
| `gravitino.server.rest.extensionPackages` | Comma-separated list of REST API packages to expand | (none) | No | 0.6.0-incubating |
40+
| `gravitino.server.visibleConfigs` | List of configs that are visible in the config servlet | (none) | No | 0.9.0-incubating |
4041

4142
The filter in the customFilters should be a standard javax servlet filter.
4243
You can also specify filter parameters by setting configuration entries of the form `gravitino.server.webserver.<class name of filter>.param.<param name>=<value>`.

server/src/main/java/org/apache/gravitino/server/web/ConfigServlet.java

+10
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.google.common.collect.Maps;
2323
import java.io.IOException;
2424
import java.io.PrintWriter;
25+
import java.util.List;
2526
import java.util.Map;
2627
import javax.servlet.http.HttpServlet;
2728
import javax.servlet.http.HttpServletRequest;
@@ -58,6 +59,15 @@ public ConfigServlet(ServerConfig serverConfig) {
5859
configs.put(key.getKey(), serverConfig.get(key));
5960
}
6061
}
62+
63+
List<String> visibleConfigs = serverConfig.get(Configs.VISIBLE_CONFIGS);
64+
65+
for (String config : visibleConfigs) {
66+
String configValue = serverConfig.getRawString(config);
67+
if (configValue != null) {
68+
configs.put(config, configValue);
69+
}
70+
}
6171
}
6272

6373
@Override

server/src/test/java/org/apache/gravitino/server/web/TestConfigServlet.java

+30
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@
2222
import static org.mockito.Mockito.verify;
2323
import static org.mockito.Mockito.when;
2424

25+
import com.google.common.collect.Lists;
2526
import java.io.PrintWriter;
2627
import javax.servlet.http.HttpServletResponse;
28+
import org.apache.gravitino.Configs;
29+
import org.apache.gravitino.config.ConfigBuilder;
30+
import org.apache.gravitino.config.ConfigConstants;
31+
import org.apache.gravitino.config.ConfigEntry;
2732
import org.apache.gravitino.server.ServerConfig;
2833
import org.junit.jupiter.api.Test;
2934

@@ -43,4 +48,29 @@ public void testConfigServlet() throws Exception {
4348
"{\"gravitino.authorization.enable\":false,\"gravitino.authenticators\":[\"simple\"]}");
4449
configServlet.destroy();
4550
}
51+
52+
@Test
53+
public void testConfigServletWithVisibleConfigs() throws Exception {
54+
ServerConfig serverConfig = new ServerConfig();
55+
56+
ConfigEntry<String> customConfig =
57+
new ConfigBuilder("gravitino.extended.custom.config")
58+
.doc("Gravitino custom config")
59+
.version(ConfigConstants.VERSION_0_9_0)
60+
.stringConf()
61+
.createWithDefault("default");
62+
63+
serverConfig.set(customConfig, "test");
64+
serverConfig.set(Configs.VISIBLE_CONFIGS, Lists.newArrayList(customConfig.getKey()));
65+
ConfigServlet configServlet = new ConfigServlet(serverConfig);
66+
configServlet.init();
67+
HttpServletResponse res = mock(HttpServletResponse.class);
68+
PrintWriter writer = mock(PrintWriter.class);
69+
when(res.getWriter()).thenReturn(writer);
70+
configServlet.doGet(null, res);
71+
verify(writer)
72+
.write(
73+
"{\"gravitino.extended.custom.config\":\"test\",\"gravitino.authorization.enable\":false,\"gravitino.authenticators\":[\"simple\"]}");
74+
configServlet.destroy();
75+
}
4676
}

web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/MetalakePageTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void testCreateMultipleMetalakes() throws InterruptedException {
104104

105105
for (int i = 0; i < twoPagesCount; i++) {
106106
try {
107-
Thread.sleep(ACTION_SLEEP_MILLIS);
107+
Thread.sleep(ACTION_SLEEP * 1000);
108108
} catch (Exception e) {
109109
LOG.error(e.getMessage(), e);
110110
}

0 commit comments

Comments
 (0)