yuqi1129 opened a new issue, #11221:
URL: https://github.com/apache/gravitino/issues/11221
### What would you like to be improved?
`bin/gravitino.sh.template` decides "is this install already running?" via
this grep in `found_gravitino_server_pid()`:
```sh
process_name='GravitinoServer';
RUNNING_PIDS=$(ps x | grep ${process_name} | grep -v grep | awk '{print
$1}');
```
This matches **any** Java process containing the string `GravitinoServer`
anywhere in its command line — across the whole host. The match isn't scoped to
the install (`GRAVITINO_HOME`) that the script belongs to. Concretely:
- Two co-located Gravitino installs (e.g. one staged at `/path/A` and
another at `/path/B`, sharing one SQL backend for multi-instance testing)
cannot both be started by their own `bin/gravitino.sh`. The second `start`
invocation sees the first install's JVM and short-circuits with `Gravitino
Server is already running` without ever launching — its `logs/` directory isn't
even created.
- This bit the new `.github/workflows/multi-instance-consistency-test.yml`
(#11212), which had to work around it by patching the line at staging time.
- `stop` / `restart` / `status` have the same blind spot in the other
direction: they may operate on a sibling install's JVM instead of their own.
### How should we improve?
Tighten the grep to require the running JVM's command line to also contain
this install's `GRAVITINO_HOME`. The JVM is launched as `java ... -cp
${GRAVITINO_CLASSPATH} GravitinoServer`, and `GRAVITINO_CLASSPATH` contains
paths derived from `GRAVITINO_HOME` (`${GRAVITINO_HOME}/libs/*`,
`${GRAVITINO_HOME}/conf`, …), so the install path is always present in the
command line of every JVM that this script started.
Minimal patch in `bin/gravitino.sh.template`:
```diff
function found_gravitino_server_pid() {
process_name='GravitinoServer';
- RUNNING_PIDS=$(ps x | grep ${process_name} | grep -v grep | awk '{print
$1}');
+ RUNNING_PIDS=$(ps x | grep ${process_name} | grep "${GRAVITINO_HOME}" |
grep -v grep | awk '{print $1}');
```
Effect: each install only ever finds its own JVM, regardless of how many
sibling installs are running on the same host.
The same change applies to the aux-service launchers if they have a parallel
pattern (`bin/gravitino-iceberg-rest-server.sh.template`,
`bin/gravitino-lance-rest-server.sh.template`) — please grep for the same
`RUNNING_PIDS=$(ps x | grep ...)` shape and apply consistently.
The CI workflow in #11212 can drop its in-line patch once this lands.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]