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

Fix bug where the configuration of the hbaseRootdir at the role level is ignored #584

Merged
merged 7 commits into from
Nov 15, 2024

Conversation

maltesander
Copy link
Member

@maltesander maltesander commented Nov 13, 2024

Description

The problem was defaulting in the product config callbacks like:

 result.insert( 
     HBASE_ROOTDIR.to_string(), 
     Some( 
         self.hbase_rootdir 
             .as_deref() 
             .unwrap_or(HBASE_ROOT_DIR_DEFAULT) 
             .to_string(), 
     ), 
 ); 

If the hbaseRootdir was only set on the role, we defaulted the rolegroup to HBASE_ROOT_DIR_DEFAULT ("/hbase"), which during merging overrode the value set on the role. The solution here is to remove the defaulting and it works.
One problem remained, if hbaseRootdir was not set at all, there was no default set anymore. The product config did not add the default due to the field being marked as not required.
In order to keep the defaulting behavior as is and not mess with existing defaulted installation, the default for hbase.root.dir in the product config was changed to "/hbase" and the field marked as required (on all roles).
The docs state though:

The directory shared by region servers and into which HBase persists. The URL should be 'fully-qualified' to include the filesystem scheme. For example, to specify the HDFS directory '/hbase' where the HDFS instance's namenode is running at namenode.example.org on port 9000, set this value to: hdfs://namenode.example.org:9000/hbase. By default, we write to whatever ${hbase.tmp.dir} is set too -- usually /tmp -- so change this configuration or else all data will be lost on machine restart.

So i think we can only use it on the regionservers? Ping @lfrancke

Edit: Lars would bet its at least required in the masters, so i would keep it as is (required in all roles in the product config)

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

Preview Give feedback

Reviewer

Preview Give feedback

Acceptance

Preview Give feedback

@maltesander maltesander linked an issue Nov 13, 2024 that may be closed by this pull request
rust/crd/src/lib.rs Show resolved Hide resolved
deploy/config-spec/properties.yaml Outdated Show resolved Hide resolved
Copy link
Member

@siegfriedweber siegfriedweber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@siegfriedweber siegfriedweber added this pull request to the merge queue Nov 15, 2024
Merged via the queue into main with commit 101f50b Nov 15, 2024
16 of 17 checks passed
@siegfriedweber siegfriedweber deleted the fix/hbaseRootdir-role-level-config-ignore branch November 15, 2024 16:22
@lfrancke
Copy link
Member

I'm a bit confused by the comment. That seems to indicate that it's not required by the RegionServer?

@siegfriedweber
Copy link
Member

I'm a bit confused by the comment. That seems to indicate that it's not required by the RegionServer?

The master apparently tells the RegionServers where the root dir is located. I have not checked this assumption in the code but I tested it:

If I set different root dirs for the roles ...

$ git diff
diff --git a/tests/templates/kuttl/smoke/30-install-hbase.yaml.j2 b/tests/templates/kuttl/smoke/30-install-hbase.yaml.j2
index ac1bed8..ea5d883 100644
--- a/tests/templates/kuttl/smoke/30-install-hbase.yaml.j2
+++ b/tests/templates/kuttl/smoke/30-install-hbase.yaml.j2
@@ -21,6 +21,7 @@ spec:
 {% endif %}
   masters:
     config:
+      hbaseRootdir: /rtmaster
       logging:
         enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
     roleGroups:
@@ -32,6 +33,7 @@ spec:
         replicas: 2
   regionServers:
     config:
+      hbaseRootdir: /rtregion
       logging:
         enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
     roleGroups:
@@ -43,6 +45,7 @@ spec:
         replicas: 2
   restServers:
     config:
+      hbaseRootdir: /rtrest
       logging:
         enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
     roleGroups:

... then the one set for the master is effective:

$ bin/hdfs dfs -fs hdfs://test-hdfs/ -ls /
Found 1 items
drwxr-xr-x   - stackable supergroup          0 2024-11-15 11:00 /rtmaster
$ bin/hdfs dfs -fs hdfs://test-hdfs/ -ls /rtmaster
Found 12 items
drwxr-xr-x   - stackable supergroup          0 2024-11-15 11:00 /rtmaster/.hbck
drwxr-xr-x   - stackable supergroup          0 2024-11-15 11:00 /rtmaster/.tmp
drwxr-xr-x   - stackable supergroup          0 2024-11-15 11:00 /rtmaster/MasterData
drwxr-xr-x   - stackable supergroup          0 2024-11-15 11:00 /rtmaster/WALs
drwxr-xr-x   - stackable supergroup          0 2024-11-15 11:10 /rtmaster/archive
drwxr-xr-x   - stackable supergroup          0 2024-11-15 11:00 /rtmaster/corrupt
drwxr-xr-x   - stackable supergroup          0 2024-11-15 11:01 /rtmaster/data
-rw-r--r--   3 stackable supergroup         42 2024-11-15 11:00 /rtmaster/hbase.id
-rw-r--r--   3 stackable supergroup          7 2024-11-15 11:00 /rtmaster/hbase.version
drwxr-xr-x   - stackable supergroup          0 2024-11-15 11:00 /rtmaster/mobdir
drwxr-xr-x   - stackable supergroup          0 2024-11-15 11:00 /rtmaster/oldWALs
drwx--x--x   - stackable supergroup          0 2024-11-15 11:00 /rtmaster/staging

@maltesander
Copy link
Member Author

To add to this, we (or I?) decided to still set the hbaseRootdir on the region and rest server (even if not required) in order to keep existing "functionality" or at least avoid restarts in exitsting installations due to config changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

The configuration of the hbaseRootdir at the role level is ignored
3 participants