You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "kabhishek4 (via GitHub)" <gi...@apache.org> on 2025/11/04 14:24:35 UTC
[PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
kabhishek4 opened a new pull request, #7437:
URL: https://github.com/apache/hbase/pull/7437
…a new active cluster
This change
- Add a logic where active cluster id file is re-created with the newly set active cluster id suffix.
- active cluster id file is created when the read only mode is set to false
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "anmolnar (via GitHub)" <gi...@apache.org>.
anmolnar commented on code in PR #7437:
URL: https://github.com/apache/hbase/pull/7437#discussion_r2543011861
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ReadOnlyController.java:
##########
@@ -411,14 +424,53 @@ public void preCleanupBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx
BulkLoadObserver.super.preCleanupBulkLoad(ctx);
}
+ private void manageActiveClusterIdFile(boolean newValue) {
+ MasterFileSystem mfs = this.masterServices.getMasterFileSystem();
+ FileSystem fs = mfs.getFileSystem();
+ Path rootDir = mfs.getRootDir();
+ Path activeClusterFile = new Path(rootDir, HConstants.ACTIVE_CLUSTER_SUFFIX_FILE_NAME);
+
+ try {
+ if (newValue) {
+ // ENABLING READ-ONLY (false -> true), delete the active cluster file.
+ LOG.debug("Global read-only mode is being ENABLED. Deleting active cluster file: {}",
+ activeClusterFile);
+ try {
+ fs.delete(activeClusterFile, false);
+ LOG.info("Successfully deleted active cluster file: {}", activeClusterFile);
+ } catch (IOException e) {
+ LOG.error(
+ "Failed to delete active cluster file: {}. "
+ + "Read-only flag will be updated, but file system state is inconsistent.",
+ activeClusterFile);
+ }
+ } else {
+ // DISABLING READ-ONLY (true -> false), create the active cluster file id file
+ int wait = mfs.getConfiguration().getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000);
+ FSUtils.setActiveClusterSuffix(fs, rootDir, mfs.getSuffixFileDataToWrite(), wait);
+ }
+ } catch (IOException e) {
+ // We still update the flag, but log that the operation failed.
+ LOG.error("Failed to perform file operation for read-only switch. "
+ + "Flag will be updated, but file system state may be inconsistent.", e);
+ this.globalReadOnlyEnabled = newValue;
+ LOG.info("Config {} has been dynamically changed to {}. Encountered FS error",
+ HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY, this.globalReadOnlyEnabled);
+ }
+ }
+
/* ---- ConfigurationObserver Overrides ---- */
- @Override
public void onConfigurationChange(Configuration conf) {
boolean maybeUpdatedConfValue = conf.getBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY,
HConstants.HBASE_GLOBAL_READONLY_ENABLED_DEFAULT);
if (this.globalReadOnlyEnabled != maybeUpdatedConfValue) {
+ if (this.masterServices != null) {
+ manageActiveClusterIdFile(maybeUpdatedConfValue);
+ } else {
+ LOG.debug("Global R/O flag changed, but not running on master");
+ }
this.globalReadOnlyEnabled = maybeUpdatedConfValue;
- LOG.info("Config {} has been dynamically changed to {}",
+ LOG.debug("Config {} has been dynamically changed to {}. (No FS ops performed 1)",
Review Comment:
> (No FS ops performed 1)
What does it mean and why have you changed the message's severity to debug level?
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ReadOnlyController.java:
##########
@@ -84,7 +91,13 @@ private void internalReadOnlyGuard() throws IOException {
@Override
public void start(CoprocessorEnvironment env) throws IOException {
-
+ if (env instanceof MasterCoprocessorEnvironment) {
+ this.masterServices = ((MasterCoprocessorEnvironment) env).getMasterServices();
+ LOG.info("ReadOnlyController obtained MasterServices reference from start().");
+ } else {
+ LOG.warn("ReadOnlyController loaded in a non-Master environment. "
Review Comment:
This should not be a warning level message. It's completely normal that ReadOnlyController runs on both Master and Region Servers. There's nothing to warn the user about. It could be just a debug level message.
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestReadOnlyController.java:
##########
@@ -154,6 +159,22 @@ private static void notifyObservers() {
hRegionServer.getConfigurationManager().notifyAllObservers(conf);
}
+ private static boolean isActiveClusterIdFileExists() {
+ MasterFileSystem mfs = hMaster.getMasterFileSystem();
+ Path rootDir = mfs.getRootDir();
+ FileSystem fs = mfs.getFileSystem();
+ Path activeClusterFile = new Path(rootDir, HConstants.ACTIVE_CLUSTER_SUFFIX_FILE_NAME);
+ boolean status = false;
+ try {
+ if (fs.exists(activeClusterFile)) {
Review Comment:
Don't catch the exception, because you will hide a potential error situation with the test.
```java
return fs.exists(activeClusterFile);
```
should be fine, because the `FileNotFoundException` is already handled in the method. Other IOExceptions should be propagated back to the test runner.
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ReadOnlyController.java:
##########
@@ -411,14 +424,53 @@ public void preCleanupBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx
BulkLoadObserver.super.preCleanupBulkLoad(ctx);
}
+ private void manageActiveClusterIdFile(boolean newValue) {
+ MasterFileSystem mfs = this.masterServices.getMasterFileSystem();
+ FileSystem fs = mfs.getFileSystem();
+ Path rootDir = mfs.getRootDir();
+ Path activeClusterFile = new Path(rootDir, HConstants.ACTIVE_CLUSTER_SUFFIX_FILE_NAME);
+
+ try {
+ if (newValue) {
+ // ENABLING READ-ONLY (false -> true), delete the active cluster file.
+ LOG.debug("Global read-only mode is being ENABLED. Deleting active cluster file: {}",
+ activeClusterFile);
+ try {
+ fs.delete(activeClusterFile, false);
+ LOG.info("Successfully deleted active cluster file: {}", activeClusterFile);
+ } catch (IOException e) {
+ LOG.error(
+ "Failed to delete active cluster file: {}. "
+ + "Read-only flag will be updated, but file system state is inconsistent.",
+ activeClusterFile);
+ }
+ } else {
+ // DISABLING READ-ONLY (true -> false), create the active cluster file id file
+ int wait = mfs.getConfiguration().getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000);
+ FSUtils.setActiveClusterSuffix(fs, rootDir, mfs.getSuffixFileDataToWrite(), wait);
+ }
+ } catch (IOException e) {
+ // We still update the flag, but log that the operation failed.
+ LOG.error("Failed to perform file operation for read-only switch. "
+ + "Flag will be updated, but file system state may be inconsistent.", e);
+ this.globalReadOnlyEnabled = newValue;
Review Comment:
It's already done in the event handler in line 472.
Please remove it from here.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "Apache-HBase (via GitHub)" <gi...@apache.org>.
Apache-HBase commented on PR #7437:
URL: https://github.com/apache/hbase/pull/7437#issuecomment-3486710623
:broken_heart: **-1 overall**
| Vote | Subsystem | Runtime | Logfile | Comment |
|:----:|----------:|--------:|:--------:|:-------:|
| +0 :ok: | reexec | 0m 17s | | Docker mode activated. |
| -0 :warning: | yetus | 0m 5s | | Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck |
|||| _ Prechecks _ |
|||| _ HBASE-29081 Compile Tests _ |
| +0 :ok: | mvndep | 0m 20s | | Maven dependency ordering for branch |
| +1 :green_heart: | mvninstall | 8m 37s | | HBASE-29081 passed |
| +1 :green_heart: | compile | 2m 43s | | HBASE-29081 passed |
| +1 :green_heart: | javadoc | 1m 25s | | HBASE-29081 passed |
| +1 :green_heart: | shadedjars | 10m 58s | | branch has no errors when building our shaded downstream artifacts. |
|||| _ Patch Compile Tests _ |
| +0 :ok: | mvndep | 0m 16s | | Maven dependency ordering for patch |
| +1 :green_heart: | mvninstall | 7m 8s | | the patch passed |
| +1 :green_heart: | compile | 2m 19s | | the patch passed |
| +1 :green_heart: | javac | 2m 19s | | the patch passed |
| +1 :green_heart: | javadoc | 1m 38s | | the patch passed |
| +1 :green_heart: | shadedjars | 9m 36s | | patch has no errors when building our shaded downstream artifacts. |
|||| _ Other Tests _ |
| +1 :green_heart: | unit | 6m 22s | | hbase-common in the patch passed. |
| -1 :x: | unit | 23m 7s | [/patch-unit-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/1/artifact/yetus-jdk17-hadoop3-check/output/patch-unit-hbase-server.txt) | hbase-server in the patch failed. |
| | | 77m 18s | | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.48 ServerAPI=1.48 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/1/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/hbase/pull/7437 |
| Optional Tests | javac javadoc unit compile shadedjars |
| uname | Linux 4a88bb79520a 6.8.0-1024-aws #26~22.04.1-Ubuntu SMP Wed Feb 19 06:54:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev-support/hbase-personality.sh |
| git revision | HBASE-29081 / 5e7721d99118b2fb7323a0ad94dd7338def4d522 |
| Default Java | Eclipse Adoptium-17.0.11+9 |
| Test Results | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/1/testReport/ |
| Max. process+thread count | 790 (vs. ulimit of 30000) |
| modules | C: hbase-common hbase-server U: . |
| Console output | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/1/console |
| versions | git=2.34.1 maven=3.9.8 |
| Powered by | Apache Yetus 0.15.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "Apache-HBase (via GitHub)" <gi...@apache.org>.
Apache-HBase commented on PR #7437:
URL: https://github.com/apache/hbase/pull/7437#issuecomment-3486576973
:broken_heart: **-1 overall**
| Vote | Subsystem | Runtime | Logfile | Comment |
|:----:|----------:|--------:|:--------:|:-------:|
| +0 :ok: | reexec | 0m 38s | | Docker mode activated. |
|||| _ Prechecks _ |
| +1 :green_heart: | dupname | 0m 0s | | No case conflicting files found. |
| +0 :ok: | codespell | 0m 0s | | codespell was not available. |
| +0 :ok: | detsecrets | 0m 0s | | detect-secrets was not available. |
| +1 :green_heart: | @author | 0m 0s | | The patch does not contain any @author tags. |
| +1 :green_heart: | hbaseanti | 0m 0s | | Patch does not have any anti-patterns. |
|||| _ HBASE-29081 Compile Tests _ |
| +0 :ok: | mvndep | 0m 19s | | Maven dependency ordering for branch |
| +1 :green_heart: | mvninstall | 4m 32s | | HBASE-29081 passed |
| +1 :green_heart: | compile | 4m 59s | | HBASE-29081 passed |
| -0 :warning: | checkstyle | 0m 19s | [/buildtool-branch-checkstyle-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/1/artifact/yetus-general-check/output/buildtool-branch-checkstyle-hbase-server.txt) | The patch fails to run checkstyle in hbase-server |
| +1 :green_heart: | spotbugs | 2m 49s | | HBASE-29081 passed |
| +1 :green_heart: | spotless | 1m 14s | | branch has no errors when running spotless:check. |
|||| _ Patch Compile Tests _ |
| +0 :ok: | mvndep | 0m 11s | | Maven dependency ordering for patch |
| +1 :green_heart: | mvninstall | 4m 3s | | the patch passed |
| +1 :green_heart: | compile | 5m 5s | | the patch passed |
| +1 :green_heart: | javac | 5m 5s | | the patch passed |
| -0 :warning: | blanks | 0m 0s | [/blanks-eol.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/1/artifact/yetus-general-check/output/blanks-eol.txt) | The patch has 1 line(s) that end in blanks. Use git apply --whitespace=fix <<patch_file>>. Refer https://git-scm.com/docs/git-apply |
| -0 :warning: | checkstyle | 0m 18s | [/results-checkstyle-hbase-common.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/1/artifact/yetus-general-check/output/results-checkstyle-hbase-common.txt) | hbase-common: The patch generated 5 new + 0 unchanged - 0 fixed = 5 total (was 0) |
| -0 :warning: | checkstyle | 0m 17s | [/buildtool-patch-checkstyle-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/1/artifact/yetus-general-check/output/buildtool-patch-checkstyle-hbase-server.txt) | The patch fails to run checkstyle in hbase-server |
| +1 :green_heart: | spotbugs | 2m 54s | | the patch passed |
| +1 :green_heart: | hadoopcheck | 13m 41s | | Patch does not cause any errors with Hadoop 3.3.6 3.4.0. |
| -1 :x: | spotless | 0m 14s | | patch has 58 errors when running spotless:check, run spotless:apply to fix. |
|||| _ Other Tests _ |
| +1 :green_heart: | asflicense | 0m 23s | | The patch does not generate ASF License warnings. |
| | | 51m 47s | | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/1/artifact/yetus-general-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/hbase/pull/7437 |
| Optional Tests | dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless |
| uname | Linux d06f83ceefc0 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev-support/hbase-personality.sh |
| git revision | HBASE-29081 / 5e7721d99118b2fb7323a0ad94dd7338def4d522 |
| Default Java | Eclipse Adoptium-17.0.11+9 |
| spotless | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/1/artifact/yetus-general-check/output/patch-spotless.txt |
| Max. process+thread count | 84 (vs. ulimit of 30000) |
| modules | C: hbase-common hbase-server U: . |
| Console output | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/1/console |
| versions | git=2.34.1 maven=3.9.8 spotbugs=4.7.3 |
| Powered by | Apache Yetus 0.15.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "Apache-HBase (via GitHub)" <gi...@apache.org>.
Apache-HBase commented on PR #7437:
URL: https://github.com/apache/hbase/pull/7437#issuecomment-3553457882
:confetti_ball: **+1 overall**
| Vote | Subsystem | Runtime | Logfile | Comment |
|:----:|----------:|--------:|:--------:|:-------:|
| +0 :ok: | reexec | 0m 57s | | Docker mode activated. |
|||| _ Prechecks _ |
| +1 :green_heart: | dupname | 0m 0s | | No case conflicting files found. |
| +0 :ok: | codespell | 0m 0s | | codespell was not available. |
| +0 :ok: | detsecrets | 0m 0s | | detect-secrets was not available. |
| +1 :green_heart: | @author | 0m 0s | | The patch does not contain any @author tags. |
| +1 :green_heart: | hbaseanti | 0m 0s | | Patch does not have any anti-patterns. |
|||| _ HBASE-29081 Compile Tests _ |
| +1 :green_heart: | mvninstall | 6m 18s | | HBASE-29081 passed |
| +1 :green_heart: | compile | 4m 38s | | HBASE-29081 passed |
| -0 :warning: | checkstyle | 0m 20s | [/buildtool-branch-checkstyle-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/5/artifact/yetus-general-check/output/buildtool-branch-checkstyle-hbase-server.txt) | The patch fails to run checkstyle in hbase-server |
| +1 :green_heart: | spotbugs | 2m 4s | | HBASE-29081 passed |
| +1 :green_heart: | spotless | 1m 1s | | branch has no errors when running spotless:check. |
|||| _ Patch Compile Tests _ |
| +1 :green_heart: | mvninstall | 4m 33s | | the patch passed |
| +1 :green_heart: | compile | 4m 38s | | the patch passed |
| +1 :green_heart: | javac | 4m 38s | | the patch passed |
| +1 :green_heart: | blanks | 0m 0s | | The patch has no blanks issues. |
| -0 :warning: | checkstyle | 0m 21s | [/buildtool-patch-checkstyle-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/5/artifact/yetus-general-check/output/buildtool-patch-checkstyle-hbase-server.txt) | The patch fails to run checkstyle in hbase-server |
| +1 :green_heart: | spotbugs | 2m 14s | | the patch passed |
| +1 :green_heart: | hadoopcheck | 18m 2s | | Patch does not cause any errors with Hadoop 3.3.6 3.4.0. |
| +1 :green_heart: | spotless | 1m 20s | | patch has no errors when running spotless:check. |
|||| _ Other Tests _ |
| +1 :green_heart: | asflicense | 0m 12s | | The patch does not generate ASF License warnings. |
| | | 58m 9s | | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/5/artifact/yetus-general-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/hbase/pull/7437 |
| Optional Tests | dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless |
| uname | Linux 612ba3c0388f 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev-support/hbase-personality.sh |
| git revision | HBASE-29081 / ba4e4921f678a0cc5946022cf39c3b928dd11e38 |
| Default Java | Eclipse Adoptium-17.0.11+9 |
| Max. process+thread count | 85 (vs. ulimit of 30000) |
| modules | C: hbase-server U: hbase-server |
| Console output | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/5/console |
| versions | git=2.34.1 maven=3.9.8 spotbugs=4.7.3 |
| Powered by | Apache Yetus 0.15.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "kabhishek4 (via GitHub)" <gi...@apache.org>.
kabhishek4 commented on PR #7437:
URL: https://github.com/apache/hbase/pull/7437#issuecomment-3561653835
> Are unit test failures related? Have you checked them locally @kabhishek4 ?
These tests TestRegionServerReportForDuty, TestReplicationMetricsforUI, TestLogRolling were failed with timout exception and are in flakey in nature. Tests passed when executed locally.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "Apache-HBase (via GitHub)" <gi...@apache.org>.
Apache-HBase commented on PR #7437:
URL: https://github.com/apache/hbase/pull/7437#issuecomment-3554379349
:broken_heart: **-1 overall**
| Vote | Subsystem | Runtime | Logfile | Comment |
|:----:|----------:|--------:|:--------:|:-------:|
| +0 :ok: | reexec | 1m 0s | | Docker mode activated. |
| -0 :warning: | yetus | 0m 3s | | Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck |
|||| _ Prechecks _ |
|||| _ HBASE-29081 Compile Tests _ |
| +1 :green_heart: | mvninstall | 6m 14s | | HBASE-29081 passed |
| +1 :green_heart: | compile | 1m 33s | | HBASE-29081 passed |
| +1 :green_heart: | javadoc | 0m 38s | | HBASE-29081 passed |
| +1 :green_heart: | shadedjars | 8m 9s | | branch has no errors when building our shaded downstream artifacts. |
|||| _ Patch Compile Tests _ |
| +1 :green_heart: | mvninstall | 4m 33s | | the patch passed |
| +1 :green_heart: | compile | 1m 27s | | the patch passed |
| +1 :green_heart: | javac | 1m 27s | | the patch passed |
| +1 :green_heart: | javadoc | 0m 35s | | the patch passed |
| +1 :green_heart: | shadedjars | 7m 36s | | patch has no errors when building our shaded downstream artifacts. |
|||| _ Other Tests _ |
| -1 :x: | unit | 258m 43s | [/patch-unit-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/5/artifact/yetus-jdk17-hadoop3-check/output/patch-unit-hbase-server.txt) | hbase-server in the patch failed. |
| | | 295m 19s | | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/5/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/hbase/pull/7437 |
| Optional Tests | javac javadoc unit compile shadedjars |
| uname | Linux 3b47d5bd7084 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev-support/hbase-personality.sh |
| git revision | HBASE-29081 / ba4e4921f678a0cc5946022cf39c3b928dd11e38 |
| Default Java | Eclipse Adoptium-17.0.11+9 |
| Test Results | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/5/testReport/ |
| Max. process+thread count | 3493 (vs. ulimit of 30000) |
| modules | C: hbase-server U: hbase-server |
| Console output | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/5/console |
| versions | git=2.34.1 maven=3.9.8 |
| Powered by | Apache Yetus 0.15.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "anmolnar (via GitHub)" <gi...@apache.org>.
anmolnar commented on PR #7437:
URL: https://github.com/apache/hbase/pull/7437#issuecomment-3559795813
Are unit test failures related? Have you checked them locally @kabhishek4 ?
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "Apache-HBase (via GitHub)" <gi...@apache.org>.
Apache-HBase commented on PR #7437:
URL: https://github.com/apache/hbase/pull/7437#issuecomment-3486992995
:confetti_ball: **+1 overall**
| Vote | Subsystem | Runtime | Logfile | Comment |
|:----:|----------:|--------:|:--------:|:-------:|
| +0 :ok: | reexec | 0m 49s | | Docker mode activated. |
|||| _ Prechecks _ |
| +1 :green_heart: | dupname | 0m 0s | | No case conflicting files found. |
| +0 :ok: | codespell | 0m 0s | | codespell was not available. |
| +0 :ok: | detsecrets | 0m 0s | | detect-secrets was not available. |
| +1 :green_heart: | @author | 0m 0s | | The patch does not contain any @author tags. |
| +1 :green_heart: | hbaseanti | 0m 0s | | Patch does not have any anti-patterns. |
|||| _ HBASE-29081 Compile Tests _ |
| +0 :ok: | mvndep | 0m 12s | | Maven dependency ordering for branch |
| +1 :green_heart: | mvninstall | 4m 15s | | HBASE-29081 passed |
| +1 :green_heart: | compile | 5m 21s | | HBASE-29081 passed |
| -0 :warning: | checkstyle | 0m 20s | [/buildtool-branch-checkstyle-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/2/artifact/yetus-general-check/output/buildtool-branch-checkstyle-hbase-server.txt) | The patch fails to run checkstyle in hbase-server |
| +1 :green_heart: | spotbugs | 2m 37s | | HBASE-29081 passed |
| +1 :green_heart: | spotless | 1m 0s | | branch has no errors when running spotless:check. |
|||| _ Patch Compile Tests _ |
| +0 :ok: | mvndep | 0m 11s | | Maven dependency ordering for patch |
| +1 :green_heart: | mvninstall | 4m 6s | | the patch passed |
| +1 :green_heart: | compile | 5m 12s | | the patch passed |
| +1 :green_heart: | javac | 5m 12s | | the patch passed |
| +1 :green_heart: | blanks | 0m 0s | | The patch has no blanks issues. |
| -0 :warning: | checkstyle | 0m 22s | [/buildtool-patch-checkstyle-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/2/artifact/yetus-general-check/output/buildtool-patch-checkstyle-hbase-server.txt) | The patch fails to run checkstyle in hbase-server |
| +1 :green_heart: | spotbugs | 3m 2s | | the patch passed |
| +1 :green_heart: | hadoopcheck | 14m 51s | | Patch does not cause any errors with Hadoop 3.3.6 3.4.0. |
| +1 :green_heart: | spotless | 0m 56s | | patch has no errors when running spotless:check. |
|||| _ Other Tests _ |
| +1 :green_heart: | asflicense | 0m 19s | | The patch does not generate ASF License warnings. |
| | | 54m 4s | | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/2/artifact/yetus-general-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/hbase/pull/7437 |
| Optional Tests | dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless |
| uname | Linux e4d6d6c9a7cf 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev-support/hbase-personality.sh |
| git revision | HBASE-29081 / 0075496d83295cf19dad82a1300f5eb761e4bf11 |
| Default Java | Eclipse Adoptium-17.0.11+9 |
| Max. process+thread count | 84 (vs. ulimit of 30000) |
| modules | C: hbase-common hbase-server U: . |
| Console output | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/2/console |
| versions | git=2.34.1 maven=3.9.8 spotbugs=4.7.3 |
| Powered by | Apache Yetus 0.15.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "anmolnar (via GitHub)" <gi...@apache.org>.
anmolnar commented on code in PR #7437:
URL: https://github.com/apache/hbase/pull/7437#discussion_r2515224768
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ReadOnlyController.java:
##########
@@ -400,14 +415,63 @@ public void preCleanupBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx
BulkLoadObserver.super.preCleanupBulkLoad(ctx);
}
+ private void manageActiveClusterIdFile(boolean newValue) {
+ MasterFileSystem mfs = this.masterServices.getMasterFileSystem();
+ FileSystem fs = mfs.getFileSystem();
+ Path rootDir = mfs.getRootDir();
+ Path activeClusterFile = new Path(rootDir, HConstants.ACTIVE_CLUSTER_SUFFIX_FILE_NAME);
+
+ try {
+ if (newValue) {
+ // ENABLING READ-ONLY (false -> true), delete the active cluster file.
+ LOG.debug("Global read-only mode is being ENABLED. Deleting active cluster file: {}",
+ activeClusterFile);
+
+ if (fs.exists(activeClusterFile)) {
+ if (fs.delete(activeClusterFile, false)) {
+ LOG.info("Successfully deleted active cluster file: {}", activeClusterFile);
+ } else {
+ LOG.error(
+ "Failed to delete active cluster file: {}. "
+ + "Read-only flag will be updated, but file system state is inconsistent.",
+ activeClusterFile);
+ }
+ } else {
+ LOG.debug("Active cluster file not present, nothing to delete.");
Review Comment:
This is an error situation, right? Because you're transitioning from R/W -> R/O mode and trying to delete the file which should be there. I would just delete it right away an log the error like this:
```java
try {
fs.delete(activeClusterFile, false));
LOG.info("Successfully deleted active cluster file: {}", activeClusterFile);
} catch (IOException e) {
LOG.error(...);
}
```
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ReadOnlyController.java:
##########
@@ -400,14 +415,63 @@ public void preCleanupBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx
BulkLoadObserver.super.preCleanupBulkLoad(ctx);
}
+ private void manageActiveClusterIdFile(boolean newValue) {
+ MasterFileSystem mfs = this.masterServices.getMasterFileSystem();
+ FileSystem fs = mfs.getFileSystem();
+ Path rootDir = mfs.getRootDir();
+ Path activeClusterFile = new Path(rootDir, HConstants.ACTIVE_CLUSTER_SUFFIX_FILE_NAME);
+
+ try {
+ if (newValue) {
+ // ENABLING READ-ONLY (false -> true), delete the active cluster file.
+ LOG.debug("Global read-only mode is being ENABLED. Deleting active cluster file: {}",
+ activeClusterFile);
+
+ if (fs.exists(activeClusterFile)) {
+ if (fs.delete(activeClusterFile, false)) {
+ LOG.info("Successfully deleted active cluster file: {}", activeClusterFile);
+ } else {
+ LOG.error(
+ "Failed to delete active cluster file: {}. "
+ + "Read-only flag will be updated, but file system state is inconsistent.",
+ activeClusterFile);
+ }
+ } else {
+ LOG.debug("Active cluster file not present, nothing to delete.");
+ }
+ } else {
+ // DISABLING READ-ONLY (true -> false), create the active cluster file id file
+ try (FSDataOutputStream stream = fs.create(activeClusterFile, true)) {
+ stream.writeUTF(new String(mfs.getSuffixFileDataToWrite(), StandardCharsets.UTF_8));
+ LOG.debug(
+ "Global read-only mode is being DISABLED. Successfully created active "
+ + "cluster file {} with suffix {}",
+ activeClusterFile, mfs.getSuffixFileDataToWrite());
+ }
+ }
+ } catch (IOException e) {
+ // We still update the flag, but log that the operation failed.
+ LOG.error("Failed to perform file operation for read-only switch. "
+ + "Flag will be updated, but file system state may be inconsistent.", e);
+ this.globalReadOnlyEnabled = newValue;
+ LOG.info("Config {} has been dynamically changed to {}. Encountered FS error",
+ HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY, this.globalReadOnlyEnabled);
+ }
+ }
+
/* ---- ConfigurationObserver Overrides ---- */
- @Override
public void onConfigurationChange(Configuration conf) {
- boolean maybeUpdatedConfValue = conf.getBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY,
+ boolean newValue = conf.getBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY,
HConstants.HBASE_GLOBAL_READONLY_ENABLED_DEFAULT);
- if (this.globalReadOnlyEnabled != maybeUpdatedConfValue) {
- this.globalReadOnlyEnabled = maybeUpdatedConfValue;
- LOG.info("Config {} has been dynamically changed to {}",
+ if (this.globalReadOnlyEnabled != newValue) {
+ if (this.masterServices != null) {
+ manageActiveClusterIdFile(newValue);
+ } else {
+ LOG.debug("MasterServices is not initialized. Cannot perform file operations for "
Review Comment:
This indicates a problematic situation to me, but it's actually not. I don't think you log anything here, but if you really want to, rephrase to something like 'Global R/O flag changed, but not running on master'
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ReadOnlyController.java:
##########
@@ -400,14 +415,63 @@ public void preCleanupBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx
BulkLoadObserver.super.preCleanupBulkLoad(ctx);
}
+ private void manageActiveClusterIdFile(boolean newValue) {
+ MasterFileSystem mfs = this.masterServices.getMasterFileSystem();
+ FileSystem fs = mfs.getFileSystem();
+ Path rootDir = mfs.getRootDir();
+ Path activeClusterFile = new Path(rootDir, HConstants.ACTIVE_CLUSTER_SUFFIX_FILE_NAME);
+
+ try {
+ if (newValue) {
+ // ENABLING READ-ONLY (false -> true), delete the active cluster file.
+ LOG.debug("Global read-only mode is being ENABLED. Deleting active cluster file: {}",
+ activeClusterFile);
+
+ if (fs.exists(activeClusterFile)) {
+ if (fs.delete(activeClusterFile, false)) {
+ LOG.info("Successfully deleted active cluster file: {}", activeClusterFile);
+ } else {
+ LOG.error(
+ "Failed to delete active cluster file: {}. "
+ + "Read-only flag will be updated, but file system state is inconsistent.",
+ activeClusterFile);
+ }
+ } else {
+ LOG.debug("Active cluster file not present, nothing to delete.");
+ }
+ } else {
+ // DISABLING READ-ONLY (true -> false), create the active cluster file id file
+ try (FSDataOutputStream stream = fs.create(activeClusterFile, true)) {
+ stream.writeUTF(new String(mfs.getSuffixFileDataToWrite(), StandardCharsets.UTF_8));
+ LOG.debug(
+ "Global read-only mode is being DISABLED. Successfully created active "
+ + "cluster file {} with suffix {}",
+ activeClusterFile, mfs.getSuffixFileDataToWrite());
+ }
+ }
+ } catch (IOException e) {
+ // We still update the flag, but log that the operation failed.
+ LOG.error("Failed to perform file operation for read-only switch. "
+ + "Flag will be updated, but file system state may be inconsistent.", e);
+ this.globalReadOnlyEnabled = newValue;
+ LOG.info("Config {} has been dynamically changed to {}. Encountered FS error",
+ HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY, this.globalReadOnlyEnabled);
+ }
+ }
+
/* ---- ConfigurationObserver Overrides ---- */
- @Override
public void onConfigurationChange(Configuration conf) {
- boolean maybeUpdatedConfValue = conf.getBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY,
+ boolean newValue = conf.getBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY,
Review Comment:
nit: I think the previous name of the variable is fine, no need to rename.
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ReadOnlyController.java:
##########
@@ -400,14 +415,63 @@ public void preCleanupBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx
BulkLoadObserver.super.preCleanupBulkLoad(ctx);
}
+ private void manageActiveClusterIdFile(boolean newValue) {
+ MasterFileSystem mfs = this.masterServices.getMasterFileSystem();
+ FileSystem fs = mfs.getFileSystem();
+ Path rootDir = mfs.getRootDir();
+ Path activeClusterFile = new Path(rootDir, HConstants.ACTIVE_CLUSTER_SUFFIX_FILE_NAME);
+
+ try {
+ if (newValue) {
+ // ENABLING READ-ONLY (false -> true), delete the active cluster file.
+ LOG.debug("Global read-only mode is being ENABLED. Deleting active cluster file: {}",
+ activeClusterFile);
+
+ if (fs.exists(activeClusterFile)) {
+ if (fs.delete(activeClusterFile, false)) {
+ LOG.info("Successfully deleted active cluster file: {}", activeClusterFile);
+ } else {
+ LOG.error(
+ "Failed to delete active cluster file: {}. "
+ + "Read-only flag will be updated, but file system state is inconsistent.",
+ activeClusterFile);
+ }
+ } else {
+ LOG.debug("Active cluster file not present, nothing to delete.");
+ }
+ } else {
+ // DISABLING READ-ONLY (true -> false), create the active cluster file id file
+ try (FSDataOutputStream stream = fs.create(activeClusterFile, true)) {
+ stream.writeUTF(new String(mfs.getSuffixFileDataToWrite(), StandardCharsets.UTF_8));
Review Comment:
You already have a helper method for this `FSUtils.setActiveClusterSuffix()`. Why not using it?
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "Apache-HBase (via GitHub)" <gi...@apache.org>.
Apache-HBase commented on PR #7437:
URL: https://github.com/apache/hbase/pull/7437#issuecomment-3517689648
:confetti_ball: **+1 overall**
| Vote | Subsystem | Runtime | Logfile | Comment |
|:----:|----------:|--------:|:--------:|:-------:|
| +0 :ok: | reexec | 0m 45s | | Docker mode activated. |
|||| _ Prechecks _ |
| +1 :green_heart: | dupname | 0m 0s | | No case conflicting files found. |
| +0 :ok: | codespell | 0m 0s | | codespell was not available. |
| +0 :ok: | detsecrets | 0m 0s | | detect-secrets was not available. |
| +1 :green_heart: | @author | 0m 0s | | The patch does not contain any @author tags. |
| +1 :green_heart: | hbaseanti | 0m 0s | | Patch does not have any anti-patterns. |
|||| _ HBASE-29081 Compile Tests _ |
| +1 :green_heart: | mvninstall | 5m 31s | | HBASE-29081 passed |
| +1 :green_heart: | compile | 4m 35s | | HBASE-29081 passed |
| -0 :warning: | checkstyle | 0m 20s | [/buildtool-branch-checkstyle-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/3/artifact/yetus-general-check/output/buildtool-branch-checkstyle-hbase-server.txt) | The patch fails to run checkstyle in hbase-server |
| +1 :green_heart: | spotbugs | 2m 3s | | HBASE-29081 passed |
| +1 :green_heart: | spotless | 1m 6s | | branch has no errors when running spotless:check. |
|||| _ Patch Compile Tests _ |
| +1 :green_heart: | mvninstall | 4m 37s | | the patch passed |
| +1 :green_heart: | compile | 4m 36s | | the patch passed |
| +1 :green_heart: | javac | 4m 36s | | the patch passed |
| +1 :green_heart: | blanks | 0m 0s | | The patch has no blanks issues. |
| -0 :warning: | checkstyle | 0m 21s | [/buildtool-patch-checkstyle-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/3/artifact/yetus-general-check/output/buildtool-patch-checkstyle-hbase-server.txt) | The patch fails to run checkstyle in hbase-server |
| +1 :green_heart: | spotbugs | 2m 14s | | the patch passed |
| +1 :green_heart: | hadoopcheck | 18m 8s | | Patch does not cause any errors with Hadoop 3.3.6 3.4.0. |
| +1 :green_heart: | spotless | 1m 14s | | patch has no errors when running spotless:check. |
|||| _ Other Tests _ |
| +1 :green_heart: | asflicense | 0m 16s | | The patch does not generate ASF License warnings. |
| | | 57m 17s | | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/3/artifact/yetus-general-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/hbase/pull/7437 |
| Optional Tests | dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless |
| uname | Linux 52d3bad49328 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev-support/hbase-personality.sh |
| git revision | HBASE-29081 / c1224ec83c19cc94259324b0b099fc700a94bb98 |
| Default Java | Eclipse Adoptium-17.0.11+9 |
| Max. process+thread count | 85 (vs. ulimit of 30000) |
| modules | C: hbase-server U: hbase-server |
| Console output | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/3/console |
| versions | git=2.34.1 maven=3.9.8 spotbugs=4.7.3 |
| Powered by | Apache Yetus 0.15.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "anmolnar (via GitHub)" <gi...@apache.org>.
anmolnar commented on PR #7437:
URL: https://github.com/apache/hbase/pull/7437#issuecomment-3563139475
Submitted. Thanks @kabhishek4 !
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "anmolnar (via GitHub)" <gi...@apache.org>.
anmolnar merged PR #7437:
URL: https://github.com/apache/hbase/pull/7437
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "anmolnar (via GitHub)" <gi...@apache.org>.
anmolnar commented on code in PR #7437:
URL: https://github.com/apache/hbase/pull/7437#discussion_r2491973658
##########
hbase-common/src/main/java/org/apache/hadoop/hbase/util/CommonFSUtils.java:
##########
@@ -745,5 +745,60 @@ public StreamLacksCapabilityException(String message, Throwable cause) {
public StreamLacksCapabilityException(String message) {
super(message);
}
+
+ }
+
+ /**
+ * Recreates a file.
+ * <p>
+ * This method first deletes the file at the given path. If the deletion fails and the file still
+ * exists, an IOException is thrown. After a successful deletion, it creates a new file with the
+ * specified permissions and overwrite flag.
+ * @param fs The FileSystem
+ * @param path The file path to recreate
+ * @param recursive If true, delete recursively (for a directory)
+ * @param perm The FsPermission to apply to the new file
+ * @param overwrite If true, overwrite an existing file (though it should be deleted by this
Review Comment:
You're trying to recreate a file. This should be always `true`.
##########
hbase-common/src/main/java/org/apache/hadoop/hbase/util/CommonFSUtils.java:
##########
@@ -745,5 +745,60 @@ public StreamLacksCapabilityException(String message, Throwable cause) {
public StreamLacksCapabilityException(String message) {
super(message);
}
+
+ }
+
+ /**
+ * Recreates a file.
+ * <p>
+ * This method first deletes the file at the given path. If the deletion fails and the file still
+ * exists, an IOException is thrown. After a successful deletion, it creates a new file with the
+ * specified permissions and overwrite flag.
+ * @param fs The FileSystem
+ * @param path The file path to recreate
+ * @param recursive If true, delete recursively (for a directory)
+ * @param perm The FsPermission to apply to the new file
+ * @param overwrite If true, overwrite an existing file (though it should be deleted by this
+ * point)
+ * @return The FSDataOutputStream for the newly created file
+ * @throws IOException If the deletion fails and the file still exists, or if the creation fails.
+ */
+ public static FSDataOutputStream recreate(FileSystem fs, Path path, final boolean recursive,
+ FsPermission perm, boolean overwrite) throws IOException {
+ LOG.debug("Attempting to delete path {} (recursive={}) for recreation.", path, recursive);
+ try {
+ if (!fs.delete(path, recursive) && fs.exists(path)) {
+ // fs.delete returned false AND the file is still there. This is a failure.
+ throw new IOException("Failed to delete " + path + " for recreation. "
+ + "delete() returned false and path still exists.");
+ }
+ } catch (IOException e) {
Review Comment:
Why do you need this all complicated logic? Delete either failed or successful, right?
##########
hbase-common/src/main/java/org/apache/hadoop/hbase/util/CommonFSUtils.java:
##########
@@ -745,5 +745,60 @@ public StreamLacksCapabilityException(String message, Throwable cause) {
public StreamLacksCapabilityException(String message) {
super(message);
}
+
+ }
+
+ /**
+ * Recreates a file.
+ * <p>
+ * This method first deletes the file at the given path. If the deletion fails and the file still
+ * exists, an IOException is thrown. After a successful deletion, it creates a new file with the
+ * specified permissions and overwrite flag.
+ * @param fs The FileSystem
+ * @param path The file path to recreate
+ * @param recursive If true, delete recursively (for a directory)
Review Comment:
This is about a single file. 'Recursive' doesn't make sense to me here.
##########
hbase-common/src/main/java/org/apache/hadoop/hbase/util/CommonFSUtils.java:
##########
@@ -745,5 +745,60 @@ public StreamLacksCapabilityException(String message, Throwable cause) {
public StreamLacksCapabilityException(String message) {
super(message);
}
+
+ }
+
+ /**
+ * Recreates a file.
+ * <p>
+ * This method first deletes the file at the given path. If the deletion fails and the file still
+ * exists, an IOException is thrown. After a successful deletion, it creates a new file with the
+ * specified permissions and overwrite flag.
+ * @param fs The FileSystem
+ * @param path The file path to recreate
+ * @param recursive If true, delete recursively (for a directory)
+ * @param perm The FsPermission to apply to the new file
+ * @param overwrite If true, overwrite an existing file (though it should be deleted by this
+ * point)
+ * @return The FSDataOutputStream for the newly created file
+ * @throws IOException If the deletion fails and the file still exists, or if the creation fails.
+ */
+ public static FSDataOutputStream recreate(FileSystem fs, Path path, final boolean recursive,
+ FsPermission perm, boolean overwrite) throws IOException {
+ LOG.debug("Attempting to delete path {} (recursive={}) for recreation.", path, recursive);
+ try {
+ if (!fs.delete(path, recursive) && fs.exists(path)) {
Review Comment:
`fs.exists()` is redundant. `fs.delete()` should give your a clear result about whether the delete operation was successful or not.
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ReadOnlyController.java:
##########
@@ -405,10 +409,70 @@ public void preCleanupBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx
public void onConfigurationChange(Configuration conf) {
boolean maybeUpdatedConfValue = conf.getBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY,
HConstants.HBASE_GLOBAL_READONLY_ENABLED_DEFAULT);
+ try {
+ recreateActiveClusterIdFile(conf);
+ } catch (IOException e) {
+ LOG.error("Encountered I/O exception while recreating the active cluster id file {} ",
+ e.getMessage());
+ }
if (this.globalReadOnlyEnabled != maybeUpdatedConfValue) {
this.globalReadOnlyEnabled = maybeUpdatedConfValue;
LOG.info("Config {} has been dynamically changed to {}",
HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY, this.globalReadOnlyEnabled);
}
}
+
+ /**
+ * Recreates the active cluster ID file with retry logic. This method will attempt to recreate the
+ * file, retrying on IOException until the configured timeout is exceeded.
+ * @param conf The configuration
+ * @throws IOException if the file recreation fails after all retries.
+ */
+ private void recreateActiveClusterIdFile(Configuration conf) throws IOException {
+ Path rootDir = CommonFSUtils.getRootDir(conf);
+ FileSystem fs = rootDir.getFileSystem(conf);
+ FsPermission perms =
+ CommonFSUtils.getFilePermissions(fs, fs.getConf(), HConstants.DATA_FILE_UMASK_KEY);
+ Path activeClusterIdFilePath = new Path(rootDir, HConstants.ACTIVE_CLUSTER_SUFFIX_FILE_NAME);
+
+ long timeout = conf.getLong(HConstants.HBASE_ACTIVE_CLUSTERIDFILE_RECREATE_TIMEOUT_KEY,
+ HConstants.HBASE_ACTIVE_CLUSTERIDFILE__RECREATE_TIMEOUT_DEFAULT);
+ long retryInterval = HConstants.HBASE_ACTIVE_CLUSTERIDFILE__RECREATE_RETRY_INTERVAL_MS;
+ long startTime = System.currentTimeMillis();
+
+ LOG.info("Attempting to recreate active cluster ID file: {}", activeClusterIdFilePath);
+
+ while (true) {
+ try {
+ // Attempt to recreate the file
+ CommonFSUtils.recreate(fs, activeClusterIdFilePath, true, perms, false);
+
+ // Success
+ LOG.info("Successfully recreated active cluster ID file: {}", activeClusterIdFilePath);
+ return;
+ } catch (IOException e) {
+ long elapsedTime = System.currentTimeMillis() - startTime;
+ if (elapsedTime >= timeout) {
+ // Timeout exceeded. Throw the last exception, wrapping it for context.
+ throw new IOException("Failed to recreate active cluster ID file "
+ + activeClusterIdFilePath + " after retrying for " + elapsedTime + "ms", e);
+ }
+
+ // Not timed out, log and sleep before retrying
+ LOG.warn(
+ "Failed to recreate active cluster ID file: {}. Retrying in {}ms... "
Review Comment:
I don't think you need to retry to create the file. Try it only once and log error if it failed. There's no such thing that a filesystem is unavailable for some reason, but will become available at some point and we wait for it. It should be available at all times or something is wrong.
##########
hbase-common/src/main/java/org/apache/hadoop/hbase/util/CommonFSUtils.java:
##########
@@ -745,5 +745,60 @@ public StreamLacksCapabilityException(String message, Throwable cause) {
public StreamLacksCapabilityException(String message) {
super(message);
}
+
+ }
+
+ /**
+ * Recreates a file.
+ * <p>
+ * This method first deletes the file at the given path. If the deletion fails and the file still
+ * exists, an IOException is thrown. After a successful deletion, it creates a new file with the
+ * specified permissions and overwrite flag.
+ * @param fs The FileSystem
+ * @param path The file path to recreate
+ * @param recursive If true, delete recursively (for a directory)
+ * @param perm The FsPermission to apply to the new file
+ * @param overwrite If true, overwrite an existing file (though it should be deleted by this
+ * point)
+ * @return The FSDataOutputStream for the newly created file
+ * @throws IOException If the deletion fails and the file still exists, or if the creation fails.
+ */
+ public static FSDataOutputStream recreate(FileSystem fs, Path path, final boolean recursive,
+ FsPermission perm, boolean overwrite) throws IOException {
+ LOG.debug("Attempting to delete path {} (recursive={}) for recreation.", path, recursive);
+ try {
+ if (!fs.delete(path, recursive) && fs.exists(path)) {
+ // fs.delete returned false AND the file is still there. This is a failure.
+ throw new IOException("Failed to delete " + path + " for recreation. "
+ + "delete() returned false and path still exists.");
+ }
+ } catch (IOException e) {
+ // The delete operation itself threw an exception.
+ // Check if the file is still there before propagating.
+ boolean stillExists = false;
+ try {
+ stillExists = fs.exists(path);
+ } catch (IOException ioe) {
+ // Failed to even check existence. Add this as suppressed.
+ e.addSuppressed(ioe);
+ throw new IOException(
+ "Failed to delete " + path + " and could not " + "verify post-deletion state.", e);
+ }
+
+ if (stillExists) {
+ // Deletion threw, and file is still there. This is a hard failure.
+ throw new IOException(
+ "Failed to delete " + path + " for recreation. " + "Operation threw: " + e.getMessage(),
+ e);
+ }
+ LOG.warn("Delete call for {} threw exception, "
+ + "but file no longer exists. Proceeding with creation.", path, e);
+ }
+
+ LOG.debug("Path {} is clear. Proceeding with creation with perm={} overwrite={}", path, perm,
+ overwrite);
+
+ // Create the new file with the specified permissions
+ return create(fs, path, perm, overwrite);
Review Comment:
You should not recreate the file when read-only mode is turned on. In that case you only need to delete the file and let the active cluster a new. How do cover that scenario?
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "Apache-HBase (via GitHub)" <gi...@apache.org>.
Apache-HBase commented on PR #7437:
URL: https://github.com/apache/hbase/pull/7437#issuecomment-3518564821
:broken_heart: **-1 overall**
| Vote | Subsystem | Runtime | Logfile | Comment |
|:----:|----------:|--------:|:--------:|:-------:|
| +0 :ok: | reexec | 0m 48s | | Docker mode activated. |
| -0 :warning: | yetus | 0m 4s | | Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck |
|||| _ Prechecks _ |
|||| _ HBASE-29081 Compile Tests _ |
| +1 :green_heart: | mvninstall | 5m 35s | | HBASE-29081 passed |
| +1 :green_heart: | compile | 1m 31s | | HBASE-29081 passed |
| +1 :green_heart: | javadoc | 0m 39s | | HBASE-29081 passed |
| +1 :green_heart: | shadedjars | 8m 13s | | branch has no errors when building our shaded downstream artifacts. |
|||| _ Patch Compile Tests _ |
| +1 :green_heart: | mvninstall | 4m 34s | | the patch passed |
| +1 :green_heart: | compile | 1m 19s | | the patch passed |
| +1 :green_heart: | javac | 1m 19s | | the patch passed |
| +1 :green_heart: | javadoc | 0m 35s | | the patch passed |
| +1 :green_heart: | shadedjars | 7m 46s | | patch has no errors when building our shaded downstream artifacts. |
|||| _ Other Tests _ |
| -1 :x: | unit | 247m 52s | [/patch-unit-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/3/artifact/yetus-jdk17-hadoop3-check/output/patch-unit-hbase-server.txt) | hbase-server in the patch failed. |
| | | 284m 17s | | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/3/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/hbase/pull/7437 |
| Optional Tests | javac javadoc unit compile shadedjars |
| uname | Linux 31e1302dfcf2 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev-support/hbase-personality.sh |
| git revision | HBASE-29081 / c1224ec83c19cc94259324b0b099fc700a94bb98 |
| Default Java | Eclipse Adoptium-17.0.11+9 |
| Test Results | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/3/testReport/ |
| Max. process+thread count | 3825 (vs. ulimit of 30000) |
| modules | C: hbase-server U: hbase-server |
| Console output | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/3/console |
| versions | git=2.34.1 maven=3.9.8 |
| Powered by | Apache Yetus 0.15.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "Apache-HBase (via GitHub)" <gi...@apache.org>.
Apache-HBase commented on PR #7437:
URL: https://github.com/apache/hbase/pull/7437#issuecomment-3559233903
:broken_heart: **-1 overall**
| Vote | Subsystem | Runtime | Logfile | Comment |
|:----:|----------:|--------:|:--------:|:-------:|
| +0 :ok: | reexec | 0m 59s | | Docker mode activated. |
| -0 :warning: | yetus | 0m 3s | | Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck |
|||| _ Prechecks _ |
|||| _ HBASE-29081 Compile Tests _ |
| +1 :green_heart: | mvninstall | 5m 27s | | HBASE-29081 passed |
| +1 :green_heart: | compile | 1m 32s | | HBASE-29081 passed |
| +1 :green_heart: | javadoc | 0m 41s | | HBASE-29081 passed |
| +1 :green_heart: | shadedjars | 8m 2s | | branch has no errors when building our shaded downstream artifacts. |
|||| _ Patch Compile Tests _ |
| +1 :green_heart: | mvninstall | 4m 39s | | the patch passed |
| +1 :green_heart: | compile | 1m 23s | | the patch passed |
| +1 :green_heart: | javac | 1m 23s | | the patch passed |
| +1 :green_heart: | javadoc | 0m 35s | | the patch passed |
| +1 :green_heart: | shadedjars | 7m 37s | | patch has no errors when building our shaded downstream artifacts. |
|||| _ Other Tests _ |
| -1 :x: | unit | 250m 45s | [/patch-unit-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/6/artifact/yetus-jdk17-hadoop3-check/output/patch-unit-hbase-server.txt) | hbase-server in the patch failed. |
| | | 286m 50s | | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/6/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/hbase/pull/7437 |
| Optional Tests | javac javadoc unit compile shadedjars |
| uname | Linux 3622bfa0170d 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev-support/hbase-personality.sh |
| git revision | HBASE-29081 / 50ff12cfdfdba975dc8e26e99e92804a81e48e7c |
| Default Java | Eclipse Adoptium-17.0.11+9 |
| Test Results | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/6/testReport/ |
| Max. process+thread count | 4094 (vs. ulimit of 30000) |
| modules | C: hbase-server U: hbase-server |
| Console output | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/6/console |
| versions | git=2.34.1 maven=3.9.8 |
| Powered by | Apache Yetus 0.15.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "Apache-HBase (via GitHub)" <gi...@apache.org>.
Apache-HBase commented on PR #7437:
URL: https://github.com/apache/hbase/pull/7437#issuecomment-3488769572
:broken_heart: **-1 overall**
| Vote | Subsystem | Runtime | Logfile | Comment |
|:----:|----------:|--------:|:--------:|:-------:|
| +0 :ok: | reexec | 0m 13s | | Docker mode activated. |
| -0 :warning: | yetus | 0m 4s | | Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck |
|||| _ Prechecks _ |
|||| _ HBASE-29081 Compile Tests _ |
| +0 :ok: | mvndep | 0m 17s | | Maven dependency ordering for branch |
| +1 :green_heart: | mvninstall | 4m 52s | | HBASE-29081 passed |
| +1 :green_heart: | compile | 1m 39s | | HBASE-29081 passed |
| +1 :green_heart: | javadoc | 0m 57s | | HBASE-29081 passed |
| +1 :green_heart: | shadedjars | 7m 13s | | branch has no errors when building our shaded downstream artifacts. |
|||| _ Patch Compile Tests _ |
| +0 :ok: | mvndep | 0m 14s | | Maven dependency ordering for patch |
| +1 :green_heart: | mvninstall | 4m 24s | | the patch passed |
| +1 :green_heart: | compile | 1m 38s | | the patch passed |
| +1 :green_heart: | javac | 1m 38s | | the patch passed |
| +1 :green_heart: | javadoc | 0m 53s | | the patch passed |
| +1 :green_heart: | shadedjars | 7m 3s | | patch has no errors when building our shaded downstream artifacts. |
|||| _ Other Tests _ |
| +1 :green_heart: | unit | 3m 36s | | hbase-common in the patch passed. |
| -1 :x: | unit | 558m 5s | [/patch-unit-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/2/artifact/yetus-jdk17-hadoop3-check/output/patch-unit-hbase-server.txt) | hbase-server in the patch failed. |
| | | 596m 8s | | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.48 ServerAPI=1.48 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/2/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/hbase/pull/7437 |
| Optional Tests | javac javadoc unit compile shadedjars |
| uname | Linux f46f798effcd 6.8.0-1024-aws #26~22.04.1-Ubuntu SMP Wed Feb 19 06:54:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev-support/hbase-personality.sh |
| git revision | HBASE-29081 / 0075496d83295cf19dad82a1300f5eb761e4bf11 |
| Default Java | Eclipse Adoptium-17.0.11+9 |
| Test Results | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/2/testReport/ |
| Max. process+thread count | 2998 (vs. ulimit of 30000) |
| modules | C: hbase-common hbase-server U: . |
| Console output | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/2/console |
| versions | git=2.34.1 maven=3.9.8 |
| Powered by | Apache Yetus 0.15.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "Apache-HBase (via GitHub)" <gi...@apache.org>.
Apache-HBase commented on PR #7437:
URL: https://github.com/apache/hbase/pull/7437#issuecomment-3558115045
:confetti_ball: **+1 overall**
| Vote | Subsystem | Runtime | Logfile | Comment |
|:----:|----------:|--------:|:--------:|:-------:|
| +0 :ok: | reexec | 1m 5s | | Docker mode activated. |
|||| _ Prechecks _ |
| +1 :green_heart: | dupname | 0m 0s | | No case conflicting files found. |
| +0 :ok: | codespell | 0m 0s | | codespell was not available. |
| +0 :ok: | detsecrets | 0m 0s | | detect-secrets was not available. |
| +1 :green_heart: | @author | 0m 0s | | The patch does not contain any @author tags. |
| +1 :green_heart: | hbaseanti | 0m 0s | | Patch does not have any anti-patterns. |
|||| _ HBASE-29081 Compile Tests _ |
| +1 :green_heart: | mvninstall | 5m 28s | | HBASE-29081 passed |
| +1 :green_heart: | compile | 4m 43s | | HBASE-29081 passed |
| -0 :warning: | checkstyle | 0m 20s | [/buildtool-branch-checkstyle-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/6/artifact/yetus-general-check/output/buildtool-branch-checkstyle-hbase-server.txt) | The patch fails to run checkstyle in hbase-server |
| +1 :green_heart: | spotbugs | 2m 5s | | HBASE-29081 passed |
| +1 :green_heart: | spotless | 1m 1s | | branch has no errors when running spotless:check. |
|||| _ Patch Compile Tests _ |
| +1 :green_heart: | mvninstall | 4m 34s | | the patch passed |
| +1 :green_heart: | compile | 4m 35s | | the patch passed |
| +1 :green_heart: | javac | 4m 35s | | the patch passed |
| +1 :green_heart: | blanks | 0m 0s | | The patch has no blanks issues. |
| -0 :warning: | checkstyle | 0m 21s | [/buildtool-patch-checkstyle-hbase-server.txt](https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/6/artifact/yetus-general-check/output/buildtool-patch-checkstyle-hbase-server.txt) | The patch fails to run checkstyle in hbase-server |
| +1 :green_heart: | spotbugs | 2m 11s | | the patch passed |
| +1 :green_heart: | hadoopcheck | 18m 12s | | Patch does not cause any errors with Hadoop 3.3.6 3.4.0. |
| +1 :green_heart: | spotless | 1m 17s | | patch has no errors when running spotless:check. |
|||| _ Other Tests _ |
| +1 :green_heart: | asflicense | 0m 15s | | The patch does not generate ASF License warnings. |
| | | 57m 22s | | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/6/artifact/yetus-general-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/hbase/pull/7437 |
| Optional Tests | dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless |
| uname | Linux 24fd3121ba9f 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev-support/hbase-personality.sh |
| git revision | HBASE-29081 / 50ff12cfdfdba975dc8e26e99e92804a81e48e7c |
| Default Java | Eclipse Adoptium-17.0.11+9 |
| Max. process+thread count | 83 (vs. ulimit of 30000) |
| modules | C: hbase-server U: hbase-server |
| Console output | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7437/6/console |
| versions | git=2.34.1 maven=3.9.8 spotbugs=4.7.3 |
| Powered by | Apache Yetus 0.15.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-29642 Active cluster file is not being updated after promoting … [hbase]
Posted by "kabhishek4 (via GitHub)" <gi...@apache.org>.
kabhishek4 commented on code in PR #7437:
URL: https://github.com/apache/hbase/pull/7437#discussion_r2545886194
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ReadOnlyController.java:
##########
@@ -411,14 +424,53 @@ public void preCleanupBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx
BulkLoadObserver.super.preCleanupBulkLoad(ctx);
}
+ private void manageActiveClusterIdFile(boolean newValue) {
+ MasterFileSystem mfs = this.masterServices.getMasterFileSystem();
+ FileSystem fs = mfs.getFileSystem();
+ Path rootDir = mfs.getRootDir();
+ Path activeClusterFile = new Path(rootDir, HConstants.ACTIVE_CLUSTER_SUFFIX_FILE_NAME);
+
+ try {
+ if (newValue) {
+ // ENABLING READ-ONLY (false -> true), delete the active cluster file.
+ LOG.debug("Global read-only mode is being ENABLED. Deleting active cluster file: {}",
+ activeClusterFile);
+ try {
+ fs.delete(activeClusterFile, false);
+ LOG.info("Successfully deleted active cluster file: {}", activeClusterFile);
+ } catch (IOException e) {
+ LOG.error(
+ "Failed to delete active cluster file: {}. "
+ + "Read-only flag will be updated, but file system state is inconsistent.",
+ activeClusterFile);
+ }
+ } else {
+ // DISABLING READ-ONLY (true -> false), create the active cluster file id file
+ int wait = mfs.getConfiguration().getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000);
+ FSUtils.setActiveClusterSuffix(fs, rootDir, mfs.getSuffixFileDataToWrite(), wait);
+ }
+ } catch (IOException e) {
+ // We still update the flag, but log that the operation failed.
+ LOG.error("Failed to perform file operation for read-only switch. "
+ + "Flag will be updated, but file system state may be inconsistent.", e);
+ this.globalReadOnlyEnabled = newValue;
+ LOG.info("Config {} has been dynamically changed to {}. Encountered FS error",
+ HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY, this.globalReadOnlyEnabled);
+ }
+ }
+
/* ---- ConfigurationObserver Overrides ---- */
- @Override
public void onConfigurationChange(Configuration conf) {
boolean maybeUpdatedConfValue = conf.getBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY,
HConstants.HBASE_GLOBAL_READONLY_ENABLED_DEFAULT);
if (this.globalReadOnlyEnabled != maybeUpdatedConfValue) {
+ if (this.masterServices != null) {
+ manageActiveClusterIdFile(maybeUpdatedConfValue);
+ } else {
+ LOG.debug("Global R/O flag changed, but not running on master");
+ }
this.globalReadOnlyEnabled = maybeUpdatedConfValue;
- LOG.info("Config {} has been dynamically changed to {}",
+ LOG.debug("Config {} has been dynamically changed to {}. (No FS ops performed 1)",
Review Comment:
It was copy-paste error, corrected it.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org