Skip to content

PHOENIX-6405 Disallow bulk loading into non-empty tables with global … - #1265

Merged
richardantal merged 1 commit into
apache:masterfrom
richardantal:PHOENIX-6405
Jul 19, 2021
Merged

PHOENIX-6405 Disallow bulk loading into non-empty tables with global …#1265
richardantal merged 1 commit into
apache:masterfrom
richardantal:PHOENIX-6405

Conversation

@richardantal

Copy link
Copy Markdown
Contributor

…secondary indexes

// There must be a better solution for this

String tn = sName == null ? "\"" + tName + "\"" : "\"" + sName + "\".\"" + tName + "\"";
ResultSet rsempty = conn.createStatement().executeQuery("SELECT * FROM " + tn);

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.

Add limit 1 to hopefully reduce the load.

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.

Also I'm sure we already have a utility function somewhere to generate the table name from the components.

List<TargetTableRef> tablesToBeLoaded = new ArrayList<TargetTableRef>();
PTable table = PhoenixRuntime.getTable(conn, qualifiedTableName);

boolean isImmutable = table.isImmutableRows();

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.

I think that bulk loading does not observe immutability, and you can modify rows with it.
If that's true, then we shouldn't treat immuable tables any different than normal ones.
Could you please check this ?

@stoty

Copy link
Copy Markdown
Contributor

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec5m 29sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
+1 💚@author0m 0sThe patch does not contain any @author tags.
-1 ❌test4tests0m 0sThe patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ master Compile Tests _
+1 💚mvninstall23m 57smaster passed
+0hbaserecompile30m 51sHBase recompiled.
+1 💚compile1m 6smaster passed
+1 💚checkstyle0m 46smaster passed
+1 💚javadoc0m 53smaster passed
+0 🆗spotbugs3m 18sphoenix-core in master has 962 extant spotbugs warnings.
_ Patch Compile Tests _
+1 💚mvninstall16m 53sthe patch passed
+0hbaserecompile27m 18sHBase recompiled.
+1 💚compile1m 6sthe patch passed
+1 💚javac1m 6sthe patch passed
-1 ❌checkstyle0m 45sphoenix-core: The patch generated 28 new + 856 unchanged - 15 fixed = 884 total (was 871)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc0m 51sthe patch passed
-1 ❌spotbugs3m 33sphoenix-core generated 2 new + 962 unchanged - 0 fixed = 964 total (was 962)
_ Other Tests _
-1 ❌unit156m 53sphoenix-core in the patch failed.
+1 💚asflicense0m 53sThe patch does not generate ASF License warnings.
233m 36s
ReasonTests
FindBugsmodule:phoenix-core
org.apache.phoenix.mapreduce.AbstractBulkLoadTool.loadData(Configuration, CommandLine) may fail to clean up java.sql.Statement Obligation to clean up resource created at AbstractBulkLoadTool.java:clean up java.sql.Statement Obligation to clean up resource created at AbstractBulkLoadTool.java:[line 235] is not discharged
org.apache.phoenix.mapreduce.AbstractBulkLoadTool.loadData(Configuration, CommandLine) may fail to close Statement At AbstractBulkLoadTool.java:close Statement At AbstractBulkLoadTool.java:[line 235]
Failed junit testsphoenix.monitoring.PhoenixTableLevelMetricsIT
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1265/3/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#1265
Optional Testsdupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile
unameLinux 6f1fc8332592 4.15.0-128-generic #131-Ubuntu SMP Wed Dec 9 06:57:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev/phoenix-personality.sh
git revisionmaster / 00d9031
Default JavaPrivate Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08
checkstylehttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1265/3/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt
spotbugshttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1265/3/artifact/yetus-general-check/output/new-spotbugs-phoenix-core.html
unithttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1265/3/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt
Test Resultshttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1265/3/testReport/
Max. process+thread count6321 (vs. ulimit of 30000)
modulesC: phoenix-core U: phoenix-core
Console outputhttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1265/3/console
versionsgit=2.7.4 maven=3.3.9 spotbugs=4.1.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@stotystoty 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.

Some minor nits.

String sName = SchemaUtil.normalizeIdentifier(schemaName);
String tName = SchemaUtil.normalizeIdentifier(tableName);

// There must be a better solution for this

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.

nit:
I don't think there really is.
We could query the table via HBase API directly, but that wouldn't really help.

}

if(hasGlobalIndexes && tableNotEmpty && !cmdLine.hasOption(ENABLE_CORRUPT_INDEXES.getOpt())){
throw new IllegalStateException("Bulk Loader error: Bulk loading is disabled for" +

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.

A bit more context may help:

Bulk Loading error: Bulk loading is disabled for non empty tables with global indexes, because it will corrupt the global index table in most cases.
Use the --corruptindexes option to override this check.

…secondary indexes
Change-Id: I55e2f6138f69add7ffa028baab6d8ea80681acf0

@stotystoty 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.

+1 LGTM

@stoty

Copy link
Copy Markdown
Contributor

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec5m 13sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
+1 💚@author0m 0sThe patch does not contain any @author tags.
-1 ❌test4tests0m 0sThe patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ master Compile Tests _
+1 💚mvninstall25m 23smaster passed
+0hbaserecompile32m 56sHBase recompiled.
+1 💚compile1m 15smaster passed
+1 💚checkstyle0m 52smaster passed
+1 💚javadoc0m 57smaster passed
+0 🆗spotbugs4m 4sphoenix-core in master has 962 extant spotbugs warnings.
_ Patch Compile Tests _
+1 💚mvninstall14m 29sthe patch passed
+0hbaserecompile25m 39sHBase recompiled.
+1 💚compile1m 2sthe patch passed
+1 💚javac1m 2sthe patch passed
-1 ❌checkstyle0m 55sphoenix-core: The patch generated 28 new + 856 unchanged - 15 fixed = 884 total (was 871)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc0m 51sthe patch passed
-1 ❌spotbugs3m 21sphoenix-core generated 2 new + 962 unchanged - 0 fixed = 964 total (was 962)
_ Other Tests _
-1 ❌unit117m 7sphoenix-core in the patch failed.
+1 💚asflicense0m 42sThe patch does not generate ASF License warnings.
194m 23s
ReasonTests
FindBugsmodule:phoenix-core
org.apache.phoenix.mapreduce.AbstractBulkLoadTool.loadData(Configuration, CommandLine) may fail to clean up java.sql.Statement Obligation to clean up resource created at AbstractBulkLoadTool.java:clean up java.sql.Statement Obligation to clean up resource created at AbstractBulkLoadTool.java:[line 233] is not discharged
org.apache.phoenix.mapreduce.AbstractBulkLoadTool.loadData(Configuration, CommandLine) may fail to close Statement At AbstractBulkLoadTool.java:close Statement At AbstractBulkLoadTool.java:[line 233]
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1265/4/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#1265
Optional Testsdupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile
unameLinux c56a3ee10be8 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev/phoenix-personality.sh
git revisionmaster / 00d9031
Default JavaPrivate Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08
checkstylehttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1265/4/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt
spotbugshttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1265/4/artifact/yetus-general-check/output/new-spotbugs-phoenix-core.html
unithttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1265/4/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt
Test Resultshttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1265/4/testReport/
Max. process+thread count12917 (vs. ulimit of 30000)
modulesC: phoenix-core U: phoenix-core
Console outputhttps://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1265/4/console
versionsgit=2.7.4 maven=3.3.9 spotbugs=4.1.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@richardantal
richardantal merged commit 9a1baf7 into apache:masterJul 19, 2021
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.

2 participants

@richardantal@stoty