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

PHOENIX-6273: Add support to handle MR Snapshot restore externally #1079

Merged
merged 11 commits into from
Jan 22, 2021
Merged

PHOENIX-6273: Add support to handle MR Snapshot restore externally #1079

merged 11 commits into from
Jan 22, 2021

Conversation

sakshamgangwar
Copy link
Contributor

@stoty
Copy link
Contributor

stoty commented Jan 8, 2021

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 2m 7s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The 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 💚 mvninstall 18m 11s master passed
+1 💚 compile 1m 22s master passed
+1 💚 checkstyle 0m 33s master passed
+1 💚 javadoc 0m 52s master passed
+0 🆗 spotbugs 3m 59s phoenix-core in master has 956 extant spotbugs warnings.
_ Patch Compile Tests _
-1 ❌ mvninstall 1m 39s root in the patch failed.
+1 💚 compile 1m 16s the patch passed
+1 💚 javac 1m 16s the patch passed
-1 ❌ checkstyle 0m 39s phoenix-core: The patch generated 9 new + 175 unchanged - 2 fixed = 184 total (was 177)
-1 ❌ whitespace 0m 0s The patch 3 line(s) with tabs.
+1 💚 javadoc 0m 53s the patch passed
+1 💚 spotbugs 3m 51s the patch passed
_ Other Tests _
-1 ❌ unit 198m 2s phoenix-core in the patch failed.
+1 💚 asflicense 0m 25s The patch does not generate ASF License warnings.
236m 54s
Reason Tests
Failed junit tests phoenix.end2end.index.ImmutableIndexExtendedIT
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #1079
Optional Tests dupname asflicense javac javadoc unit spotbugs hbaseanti checkstyle compile
uname Linux 4904e88ab7e1 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev/phoenix-personality.sh
git revision master / edbd6e8
Default Java Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08
mvninstall https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/1/artifact/yetus-general-check/output/patch-mvninstall-root.txt
checkstyle https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/1/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt
whitespace https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/1/artifact/yetus-general-check/output/whitespace-tabs.txt
unit https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/1/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt
Test Results https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/1/testReport/
Max. process+thread count 5803 (vs. ulimit of 30000)
modules C: phoenix-core U: phoenix-core
Console output https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/1/console
versions git=2.7.4 maven=3.3.9 spotbugs=4.1.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@stoty
Copy link
Contributor

stoty commented Jan 15, 2021

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 5m 49s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The 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 💚 mvninstall 16m 43s master passed
+0 hbaserecompile 24m 39s HBase recompiled.
+1 💚 compile 1m 5s master passed
+1 💚 checkstyle 0m 34s master passed
+1 💚 javadoc 0m 55s master passed
+0 🆗 spotbugs 3m 17s phoenix-core in master has 955 extant spotbugs warnings.
_ Patch Compile Tests _
-1 ❌ mvninstall 0m 29s root in the patch failed.
+0 hbaserecompile 10m 42s HBase recompiled.
-1 ❌ compile 0m 18s phoenix-core in the patch failed.
-1 ❌ javac 0m 18s phoenix-core in the patch failed.
-1 ❌ checkstyle 0m 34s phoenix-core: The patch generated 21 new + 174 unchanged - 3 fixed = 195 total (was 177)
-1 ❌ whitespace 0m 0s The patch 26 line(s) with tabs.
+1 💚 javadoc 0m 51s the patch passed
-1 ❌ spotbugs 0m 16s phoenix-core in the patch failed.
_ Other Tests _
-1 ❌ unit 0m 16s phoenix-core in the patch failed.
+1 💚 asflicense 0m 13s The patch does not generate ASF License warnings.
47m 17s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #1079
Optional Tests dupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile
uname Linux e092a77fa222 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev/phoenix-personality.sh
git revision master / 4b444cd
Default Java Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08
mvninstall https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/2/artifact/yetus-general-check/output/patch-mvninstall-root.txt
compile https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/2/artifact/yetus-general-check/output/patch-compile-phoenix-core.txt
javac https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/2/artifact/yetus-general-check/output/patch-compile-phoenix-core.txt
checkstyle https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/2/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt
whitespace https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/2/artifact/yetus-general-check/output/whitespace-tabs.txt
spotbugs https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/2/artifact/yetus-general-check/output/patch-spotbugs-phoenix-core.txt
unit https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/2/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt
Test Results https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/2/testReport/
Max. process+thread count 86 (vs. ulimit of 30000)
modules C: phoenix-core U: phoenix-core
Console output https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/2/console
versions git=2.7.4 maven=3.3.9 spotbugs=4.1.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@sakshamgangwar
Copy link
Contributor Author

@gjacoby126 Can you review again? As discussed offline, I have added configuration to handle whether we want to take care of snapshot restore within phoenix (this is being set as default) or we want to do it externally.

@stoty
Copy link
Contributor

stoty commented Jan 16, 2021

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 19s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The 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 💚 mvninstall 17m 13s master passed
+0 hbaserecompile 24m 18s HBase recompiled.
+1 💚 compile 1m 26s master passed
+1 💚 checkstyle 1m 2s master passed
+1 💚 javadoc 1m 8s master passed
+0 🆗 spotbugs 4m 3s phoenix-core in master has 955 extant spotbugs warnings.
_ Patch Compile Tests _
+1 💚 mvninstall 12m 8s the patch passed
+0 hbaserecompile 26m 51s HBase recompiled.
+1 💚 compile 1m 47s the patch passed
+1 💚 javac 1m 47s the patch passed
-1 ❌ checkstyle 1m 17s phoenix-core: The patch generated 43 new + 656 unchanged - 9 fixed = 699 total (was 665)
-1 ❌ whitespace 0m 0s The patch 26 line(s) with tabs.
+1 💚 javadoc 1m 26s the patch passed
+1 💚 spotbugs 5m 35s the patch passed
_ Other Tests _
-1 ❌ unit 153m 5s phoenix-core in the patch failed.
+1 💚 asflicense 0m 52s The patch does not generate ASF License warnings.
223m 25s
Reason Tests
Failed junit tests phoenix.schema.stats.NamespaceDisabledStatsCollectorIT
phoenix.schema.stats.NamespaceEnabledStatsCollectorIT
phoenix.end2end.IndexExtendedIT
phoenix.end2end.TableSnapshotReadsMapReduceIT
phoenix.end2end.PermissionNSEnabledIT
phoenix.end2end.MaxLookbackIT
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/3/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #1079
Optional Tests dupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile
uname Linux 6ab67f130801 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev/phoenix-personality.sh
git revision master / 4b444cd
Default Java Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08
checkstyle https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/3/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt
whitespace https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/3/artifact/yetus-general-check/output/whitespace-tabs.txt
unit https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/3/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt
Test Results https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/3/testReport/
Max. process+thread count 9804 (vs. ulimit of 30000)
modules C: phoenix-core U: phoenix-core
Console output https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/3/console
versions git=2.7.4 maven=3.3.9 spotbugs=4.1.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@stoty
Copy link
Contributor

stoty commented Jan 16, 2021

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 19s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The 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 💚 mvninstall 17m 32s master passed
+0 hbaserecompile 24m 57s HBase recompiled.
+1 💚 compile 1m 6s master passed
+1 💚 checkstyle 0m 44s master passed
+1 💚 javadoc 0m 58s master passed
+0 🆗 spotbugs 3m 30s phoenix-core in master has 955 extant spotbugs warnings.
_ Patch Compile Tests _
+1 💚 mvninstall 10m 5s the patch passed
+0 hbaserecompile 20m 42s HBase recompiled.
+1 💚 compile 1m 8s the patch passed
+1 💚 javac 1m 8s the patch passed
-1 ❌ checkstyle 0m 42s phoenix-core: The patch generated 22 new + 663 unchanged - 2 fixed = 685 total (was 665)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 javadoc 0m 54s the patch passed
+1 💚 spotbugs 3m 35s the patch passed
_ Other Tests _
-1 ❌ unit 165m 53s phoenix-core in the patch failed.
+1 💚 asflicense 0m 36s The patch does not generate ASF License warnings.
225m 38s
Reason Tests
Failed junit tests phoenix.end2end.BinaryRowKeyIT
phoenix.end2end.PermissionNSEnabledWithCustomAccessControllerIT
phoenix.end2end.TableSnapshotReadsMapReduceIT
phoenix.end2end.PowerFunctionEnd2EndIT
phoenix.end2end.PermissionNSEnabledIT
phoenix.end2end.UpsertSelectIT
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/4/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #1079
Optional Tests dupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile
uname Linux 0d2f8f34f893 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev/phoenix-personality.sh
git revision master / f80e221
Default Java Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08
checkstyle https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/4/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt
unit https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/4/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt
Test Results https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/4/testReport/
Max. process+thread count 5601 (vs. ulimit of 30000)
modules C: phoenix-core U: phoenix-core
Console output https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/4/console
versions git=2.7.4 maven=3.3.9 spotbugs=4.1.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

for (RegionInfo restoredRegion : restoredRegions) {
if (isValidRegion(restoredRegion)) {
this.regions.add(restoredRegion);
if (PhoenixConfigurationUtil.getMRSnapshotManagedInternally(configuration)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I get this, We are again restoring per iterator which is per scan? Isn't this what caused the issue in the first place. I see that it is guarded by a configuration option but ideally we want to avoid this in all cases right? or to rephrase my question, who wants to set this to true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bharathv doing the restore per MR job can be handled at one place but I was not able to get any spot to delete/cleanup the restore right after the job is done on phoenix side. On the caller side, I am able to do the cleanup, so in order to handle it in a clean way: I added this configuration to explicitly say: whether or not restore needs to be managed internally or externally. If internally I am keeping the original flow (with issue) as it is. Externally: restore + delete happens on the MR job caller side.

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO the original flow is wrong and can lead to pretty bad outcomes (like a file blow up), so we should get rid of restoring per task. If you still want to use this SnapshotManagedInternally() configuration, I'd suggest move it to once at setup and not once per scan.

@sakshamgangwar sakshamgangwar changed the title Phoenix-6273: All the map tasks should operate on the same restored snapshot Phoenix-6273: Add support to handle MR Snapshot restore externally Jan 21, 2021
@sakshamgangwar
Copy link
Contributor Author

@bharathv @gjacoby126 Can you review it one more time? Made changes based on review comments.

@shahrs87
Copy link
Contributor

If you change the title to all caps PHOENIX (for e.g.: PHOENIX-6273: Add support to handle MR Snapshot restore externally), it will link the PR to jira so that anyone can go directly from jira to this PR.

@@ -191,6 +190,12 @@
// provide an absolute path to inject your multi input mapper logic
public static final String MAPREDUCE_MULTI_INPUT_MAPPER_TRACKER_CLAZZ = "phoenix.mapreduce.multi.mapper.tracker.path";

// provide control to whether or not handle MR snapshot restore on phoenix side or handled by caller externally
Copy link
Contributor

Choose a reason for hiding this comment

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

The naming convention for all other conf property starts with MAPREDUCE. Do you mind changing the property name to something like: "MAPREDUCE_SNAPSHOT_RESTORE_EXTERNAL" ? and prefix with DEFAULT for default value ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also please change the phoenix conf string from phoenix.mr.manage.snapshot.restore.externally to "phoenix.mapreduce.snapshot.restore.externally" to be consistent with other property names.

Copy link
Contributor

@shahrs87 shahrs87 left a comment

Choose a reason for hiding this comment

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

Many minor nits. otherwise changes looks good.


public static boolean isMRSnapshotManagedExternally(final Configuration configuration) {
Preconditions.checkNotNull(configuration);
boolean isSnapshotRestoreManagedInternally =
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo in the variable name: isSnapshotRestoreManagedInternally. Should it be isSnapshotRestoreManagedExternally ?

@@ -191,6 +190,12 @@
// provide an absolute path to inject your multi input mapper logic
public static final String MAPREDUCE_MULTI_INPUT_MAPPER_TRACKER_CLAZZ = "phoenix.mapreduce.multi.mapper.tracker.path";

// provide control to whether or not handle MR snapshot restore on phoenix side or handled by caller externally
Copy link
Contributor

Choose a reason for hiding this comment

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

Also could you please add couple of lines on what does it mean to manage internally vs externally ?

import java.util.Properties;

import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import static org.apache.phoenix.query.QueryServices.USE_STATS_FOR_PARALLELIZATION;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think all the static imports go to the top of the import list. Also all the java.util.* imports should come before org.apache.phoenix.* imports. Please change that.

public static void setMRSnapshotManagedExternally(Configuration configuration, Boolean isSnapshotRestoreManagedExternally) {
Preconditions.checkNotNull(configuration);
Preconditions.checkNotNull(isSnapshotRestoreManagedExternally);
configuration.set(MANAGE_MR_SNAPSHOT_RESTORE_EXTERNALLY,
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use setBoolean so that you don't have to convert boolean to string.

@@ -191,6 +190,12 @@
// provide an absolute path to inject your multi input mapper logic
public static final String MAPREDUCE_MULTI_INPUT_MAPPER_TRACKER_CLAZZ = "phoenix.mapreduce.multi.mapper.tracker.path";

// provide control to whether or not handle MR snapshot restore on phoenix side or handled by caller externally
Copy link
Contributor

Choose a reason for hiding this comment

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

Also please change the phoenix conf string from phoenix.mr.manage.snapshot.restore.externally to "phoenix.mapreduce.snapshot.restore.externally" to be consistent with other property names.

import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
import org.apache.phoenix.monitoring.ScanMetricsHolder;
import org.apache.phoenix.schema.tuple.Tuple;
import org.apache.phoenix.util.ServerUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment about the import order as other comment.

@@ -274,6 +293,9 @@ private void configureJob(Job job, String tableName, String inputQuery, String c

assertFalse("Should only have stored" + result.size() + "rows in the table for the timestamp!", rs.next());
} finally {
if (isSnapshotRestoreDoneExternally) {
assertRestoreDirCount(conf, tmpDir.toString(), 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you assert the restoredircount is more than 1 if isSnapshotRestoreDoneExternally is set to false ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shahrs87 There were two levels of subdirectories getting created for snapshot restore on every scan:

PhoenixConfigurationUtil.setRestoreDirKey(configuration, new Path(restoreDir, UUID.randomUUID().toString()).toString());

this.restoreDir = new Path(configuration.get(PhoenixConfigurationUtil.RESTORE_DIR_KEY),

I have removed those in the original flow so now the directory gets cleaned up every single scan and gets created again for the next scan with the same directory structure.

I can assert here no existence of the restore directory in the original flow.

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
Copy link
Contributor

Choose a reason for hiding this comment

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

Import order is changed for all the files. Please revert back to original format.

@stoty
Copy link
Contributor

stoty commented Jan 21, 2021

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 22s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The 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 💚 mvninstall 17m 15s master passed
+0 hbaserecompile 24m 50s HBase recompiled.
+1 💚 compile 1m 4s master passed
+1 💚 checkstyle 0m 44s master passed
+1 💚 javadoc 0m 53s master passed
+0 🆗 spotbugs 3m 15s phoenix-core in master has 955 extant spotbugs warnings.
_ Patch Compile Tests _
+1 💚 mvninstall 10m 5s the patch passed
+0 hbaserecompile 20m 23s HBase recompiled.
+1 💚 compile 1m 5s the patch passed
+1 💚 javac 1m 5s the patch passed
-1 ❌ checkstyle 0m 48s phoenix-core: The patch generated 25 new + 749 unchanged - 3 fixed = 774 total (was 752)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 javadoc 0m 51s the patch passed
+1 💚 spotbugs 3m 28s the patch passed
_ Other Tests _
-1 ❌ unit 118m 59s phoenix-core in the patch failed.
+1 💚 asflicense 0m 37s The patch does not generate ASF License warnings.
178m 15s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/5/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #1079
Optional Tests dupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile
uname Linux b71602df69b8 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev/phoenix-personality.sh
git revision master / e74857b
Default Java Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08
checkstyle https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/5/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt
unit https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/5/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt
Test Results https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/5/testReport/
Max. process+thread count 4765 (vs. ulimit of 30000)
modules C: phoenix-core U: phoenix-core
Console output https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/5/console
versions git=2.7.4 maven=3.3.9 spotbugs=4.1.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@sakshamgangwar sakshamgangwar changed the title Phoenix-6273: Add support to handle MR Snapshot restore externally PHOENIX-6273: Add support to handle MR Snapshot restore externally Jan 21, 2021
@sakshamgangwar
Copy link
Contributor Author

@shahrs87 @gjacoby126 Addressed comments on this PR, can you review again? Thanks!

@@ -78,8 +80,7 @@ public TableSnapshotResultIterator(Configuration configuration, Scan scan, ScanM
this.scan = scan;
this.scanMetricsHolder = scanMetricsHolder;
this.scanIterator = UNINITIALIZED_SCANNER;
this.restoreDir = new Path(configuration.get(PhoenixConfigurationUtil.RESTORE_DIR_KEY),
UUID.randomUUID().toString());
this.restoreDir = new Path(configuration.get(PhoenixConfigurationUtil.RESTORE_DIR_KEY));
Copy link
Contributor

Choose a reason for hiding this comment

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

Will it change any semantics if we are not adding uuid to the restoreDir path when isMRSnapshotManagedExternally is set to false ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shahrs87 I don't think so. I believe the original flow was faulty in itself and for every scan, we were creating a subdirectory, not instead of that, we have the same subdirectory for restore and every scan restore happens there and clean up also happens per scan. So there should not be any issue. We want to get rid of this structure because when we do an external restore or external cleanup, we need to provide exact restore directory for reading it.

Copy link
Contributor

Choose a reason for hiding this comment

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

@sakshamgangwar - Remember that scans are taking place in parallel as multiple mappers may be running at the same time. Until we fix the automation to only create once in a future JIRA, don't we need to keep the restored files in separate directories so tasks won't step on each other?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gjacoby126I missed that part, thanks for catching that. I will guard the directories with the same config as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gjacoby126 Can you review again? I have kept old behavior as it is, as well as in the assertion for restore directory I am asserting whether or not snapshot directory exists (in case of externally cleaned up) or not (cleaned up per scan).

Copy link
Contributor

@bharathv bharathv left a comment

Choose a reason for hiding this comment

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

meat of the patch lgtm, haven't looked at the tests but looks like other reviewers are taking a deeper look. +1.

@stoty
Copy link
Contributor

stoty commented Jan 21, 2021

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 2m 26s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The 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 💚 mvninstall 18m 0s master passed
+0 hbaserecompile 26m 26s HBase recompiled.
+1 💚 compile 1m 6s master passed
+1 💚 checkstyle 0m 43s master passed
+1 💚 javadoc 0m 54s master passed
+0 🆗 spotbugs 3m 24s phoenix-core in master has 955 extant spotbugs warnings.
_ Patch Compile Tests _
+1 💚 mvninstall 9m 58s the patch passed
+0 hbaserecompile 21m 20s HBase recompiled.
+1 💚 compile 1m 4s the patch passed
+1 💚 javac 1m 4s the patch passed
-1 ❌ checkstyle 0m 44s phoenix-core: The patch generated 27 new + 749 unchanged - 3 fixed = 776 total (was 752)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 javadoc 0m 54s the patch passed
+1 💚 spotbugs 3m 34s the patch passed
_ Other Tests _
-1 ❌ unit 122m 0s phoenix-core in the patch failed.
+1 💚 asflicense 0m 43s The patch does not generate ASF License warnings.
185m 15s
Reason Tests
Failed junit tests phoenix.end2end.PermissionNSEnabledWithCustomAccessControllerIT
phoenix.end2end.ProductMetricsIT
phoenix.end2end.PermissionNSDisabledWithCustomAccessControllerIT
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/8/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #1079
JIRA Issue PHOENIX-6273
Optional Tests dupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile
uname Linux 9322e9fd16c5 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev/phoenix-personality.sh
git revision master / e19cc3f
Default Java Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08
checkstyle https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/8/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt
unit https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/8/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt
Test Results https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/8/testReport/
Max. process+thread count 8149 (vs. ulimit of 30000)
modules C: phoenix-core U: phoenix-core
Console output https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/8/console
versions git=2.7.4 maven=3.3.9 spotbugs=4.1.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

if (PhoenixConfigurationUtil.isMRSnapshotManagedExternally(configuration)) {
this.restoreDir = new Path(configuration.get(PhoenixConfigurationUtil.RESTORE_DIR_KEY));
} else {
this.restoreDir = new Path(configuration.get(PhoenixConfigurationUtil.RESTORE_DIR_KEY),
Copy link
Contributor

Choose a reason for hiding this comment

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

@sakshamgangwar why do we do the UUID in both the PhoenixMapReduceUtil and TableSnapshotResultIterator? Shouldn't it be one or the other? (If so, putting here in TableSnapshotResultIterator seems clearer to me.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gjacoby126 that existed before this change as well, this is not a necessary code, I believe at job level in PhoenixMapReduceUtil we update the configuration restoreDir to a new path so as to make sure that even if restoreDir configuration sent from the caller is same for multiple jobs, it should be able to handle it internally by adding a new sub-directory (which we are also doing at scan level too :) ). Whereas in externally managed now we take full responsibility for the restoreDir creation/usage/deletion.

Copy link
Contributor

@gjacoby126 gjacoby126 left a comment

Choose a reason for hiding this comment

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

+1, assuming tests pass. Thanks @sakshamgangwar .

@stoty
Copy link
Contributor

stoty commented Jan 22, 2021

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 58s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The 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 💚 mvninstall 17m 18s master passed
+0 hbaserecompile 24m 39s HBase recompiled.
+1 💚 compile 1m 7s master passed
+1 💚 checkstyle 0m 43s master passed
+1 💚 javadoc 0m 57s master passed
+0 🆗 spotbugs 3m 35s phoenix-core in master has 955 extant spotbugs warnings.
_ Patch Compile Tests _
+1 💚 mvninstall 10m 37s the patch passed
+0 hbaserecompile 22m 21s HBase recompiled.
+1 💚 compile 1m 5s the patch passed
+1 💚 javac 1m 5s the patch passed
-1 ❌ checkstyle 0m 43s phoenix-core: The patch generated 28 new + 749 unchanged - 3 fixed = 777 total (was 752)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 javadoc 0m 51s the patch passed
+1 💚 spotbugs 3m 30s the patch passed
_ Other Tests _
-1 ❌ unit 149m 58s phoenix-core in the patch failed.
+1 💚 asflicense 0m 36s The patch does not generate ASF License warnings.
211m 38s
Reason Tests
Failed junit tests phoenix.tx.TransactionIT
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/9/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #1079
JIRA Issue PHOENIX-6273
Optional Tests dupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile
uname Linux da70eef4e1f8 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev/phoenix-personality.sh
git revision master / e19cc3f
Default Java Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08
checkstyle https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/9/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt
unit https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/9/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt
Test Results https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/9/testReport/
Max. process+thread count 9715 (vs. ulimit of 30000)
modules C: phoenix-core U: phoenix-core
Console output https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/9/console
versions git=2.7.4 maven=3.3.9 spotbugs=4.1.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@stoty
Copy link
Contributor

stoty commented Jan 22, 2021

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 30s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The 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 💚 mvninstall 17m 5s master passed
+0 hbaserecompile 25m 16s HBase recompiled.
+1 💚 compile 1m 5s master passed
+1 💚 checkstyle 0m 44s master passed
+1 💚 javadoc 0m 55s master passed
+0 🆗 spotbugs 3m 20s phoenix-core in master has 955 extant spotbugs warnings.
_ Patch Compile Tests _
+1 💚 mvninstall 10m 3s the patch passed
+0 hbaserecompile 20m 55s HBase recompiled.
+1 💚 compile 1m 6s the patch passed
+1 💚 javac 1m 6s the patch passed
-1 ❌ checkstyle 0m 45s phoenix-core: The patch generated 26 new + 749 unchanged - 3 fixed = 775 total (was 752)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 javadoc 0m 52s the patch passed
+1 💚 spotbugs 3m 31s the patch passed
_ Other Tests _
-1 ❌ unit 114m 41s phoenix-core in the patch failed.
+1 💚 asflicense 0m 37s The patch does not generate ASF License warnings.
174m 55s
Reason Tests
Failed junit tests phoenix.end2end.PermissionNSDisabledWithCustomAccessControllerIT
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/10/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #1079
JIRA Issue PHOENIX-6273
Optional Tests dupname asflicense javac javadoc unit spotbugs hbaserebuild hbaseanti checkstyle compile
uname Linux af35a6197b37 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev/phoenix-personality.sh
git revision master / e19cc3f
Default Java Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08
checkstyle https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/10/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt
unit https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/10/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt
Test Results https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/10/testReport/
Max. process+thread count 9563 (vs. ulimit of 30000)
modules C: phoenix-core U: phoenix-core
Console output https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/10/console
versions git=2.7.4 maven=3.3.9 spotbugs=4.1.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@gjacoby126
Copy link
Contributor

@shahrs87 , when you get a minute could you please take another look and approve or request further changes?

@sakshamgangwar
Copy link
Contributor Author

@gjacoby126 @shahrs87 I am observing only one test failure which is not related to my changes:
https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1079/10/testReport/
PermissionNSDisabledWithCustomAccessControllerIT.testSuperUserCanChangePerms

@gjacoby126 gjacoby126 merged commit 317f3b7 into apache:master Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants