Skip to content

HBASE-28484: Add ability to replicate to a different tableName - #6578

Open
eab148 wants to merge 10 commits into
apache:masterfrom
HubSpot:HBASE-28484-eboland-impl
Open

HBASE-28484: Add ability to replicate to a different tableName#6578
eab148 wants to merge 10 commits into
apache:masterfrom
HubSpot:HBASE-28484-eboland-impl

Conversation

@eab148

Copy link
Copy Markdown
Contributor

Design document

Jira

Currently, replication can only occur if the source and sink clusters both house tables with the same (tableName, family) pairs. This requirement exists so that the sink cluster knows where to persist the data it receives from the source cluster. In this PR, we loosen the naming constraint and give clients more configuration power over the name of their sink namespaces and tableNames.

@eab148
eab148force-pushed the HBASE-28484-eboland-impl branch from 0ad9568 to 670844cCompareJanuary 8, 2025 19:34
@eab148
eab148force-pushed the HBASE-28484-eboland-impl branch from 670844c to 0448f31CompareJanuary 8, 2025 19:36
@eab148

Copy link
Copy Markdown
ContributorAuthor

@Apache9 Happy New Year! Do you have any thoughts on the new design and implementation? Thank you for all of your help so far!

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 28sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+0 🆗codespell0m 0scodespell was not available.
+0 🆗detsecrets0m 0sdetect-secrets was not available.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
_ master Compile Tests _
+0 🆗mvndep0m 10sMaven dependency ordering for branch
+1 💚mvninstall2m 54smaster passed
+1 💚compile3m 36smaster passed
+1 💚checkstyle0m 47smaster passed
+1 💚spotbugs2m 0smaster passed
+1 💚spotless0m 43sbranch has no errors when running spotless:check.
_ Patch Compile Tests _
+0 🆗mvndep0m 11sMaven dependency ordering for patch
+1 💚mvninstall2m 49sthe patch passed
+1 💚compile3m 41sthe patch passed
+1 💚javac3m 41sthe patch passed
+1 💚blanks0m 0sThe patch has no blanks issues.
+1 💚checkstyle0m 49sthe patch passed
+1 💚spotbugs2m 15sthe patch passed
+1 💚hadoopcheck10m 43sPatch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚spotless0m 41spatch has no errors when running spotless:check.
_ Other Tests _
+1 💚asflicense0m 17sThe patch does not generate ASF License warnings.
39m 5s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6578/6/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#6578
JIRA IssueHBASE-28484
Optional Testsdupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
unameLinux 31118b2d8ce1 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 0c2d864
Default JavaEclipse Adoptium-17.0.11+9
Max. process+thread count83 (vs. ulimit of 30000)
modulesC: hbase-common hbase-server U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6578/6/console
versionsgit=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache9
Apache9 self-requested a review January 13, 2025 14:17
@Apache9

Copy link
Copy Markdown
Contributor

Will take a look soon.

Thanks for preparing the design doc and also the PR.

@krconv

Copy link
Copy Markdown

@Apache9 Would you mind taking a look at this when you get a chance?

@Apache9Apache9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The solution looks OK, but there are still some concerns about how to make use of the ReplicationSinkTranslator...

Class<? extends SourceFSConfigurationProvider> c =
Class.forName(className).asSubclass(SourceFSConfigurationProvider.class);
this.provider = c.getDeclaredConstructor().newInstance();
} catch (RuntimeException e) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is for debug?

filter = walEntryFilterClass == null
? null
: (WALEntrySinkFilter) walEntryFilterClass.getDeclaredConstructor().newInstance();
} catch (RuntimeException e) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here too.

public static final String REPLICATION_SINK_SERVICE_CLASSNAME_DEFAULT =
"org.apache.hadoop.hbase.replication.ReplicationSinkServiceImpl";
public static final String REPLICATION_BULKLOAD_ENABLE_KEY = "hbase.replication.bulkload.enabled";
public static final String REPLICATION_SINK_TRANSLATOR = "hbase.replication.sink.translator";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We'd better not put things in HConstants, put them into the package where we use it?

import org.apache.hadoop.hbase.TableName;
import org.apache.yetus.audience.InterfaceAudience;

@InterfaceAudience.Public

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be IA.LimitedPrivate("CONFIG")? Do we expected users to use it directly in their code?

Class<?> translatorClass = this.conf.getClass(HConstants.REPLICATION_SINK_TRANSLATOR,
IdentityReplicationSinkTranslator.class, ReplicationSinkTranslator.class);
try {
return (ReplicationSinkTranslator) translatorClass.getDeclaredConstructor().newInstance();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IIRC we have a ReflectionUtils or something to call constructors of a class, here we do not need to pass the Configuration object to it? Maybe the translator needs to load some configurations?

throw e;
} catch (Exception e) {
LOG.warn("Failed to instantiate " + translatorClass);
return new IdentityReplicationSinkTranslator();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this the right choice to fallback to default implementation? I'm not sure...

import org.apache.yetus.audience.InterfaceAudience;

@InterfaceAudience.Public
public interface ReplicationSinkTranslator {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Better add some javadoc's to explain the meanings of the methods and the usage of this class?

mutation.setClusterIds(clusterIds);
mutation.setAttribute(ReplicationUtils.REPLICATION_ATTR_NAME,
TableName sinkTableName = translator.getSinkTableName(tableName);
ExtendedCell sinkCell = translator.getSinkExtendedCell(tableName, cell);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is the reason why I want to see the javadoc for this method,as why do we need to pass the original table name in? And I think we will just do tableName mapping, so we do not need to call the above getSinkTableName everytime as all the cells from the WALEntry are for the same table?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@eab148@Apache-HBase@Apache9@krconv