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-4009 Run UPDATE STATISTICS command by using MR integration on… #433

Merged
merged 3 commits into from
Jan 30, 2019

Conversation

karanmehta93
Copy link
Member

… snapshots (Addendum)

@karanmehta93
Copy link
Member Author

Here's a brief insight on the addendum PR.
A bug was found which was causing compactions to fail on tables if stats were disabled on server side completely (the property QueryServices#STATS_COLLECTION_ENABLED is disabled).
New integration tests are added in NoOpStatsCollectorIT to test that scenario. StatsCollectionDisabledOnServerException is thrown in such conditions.
UngroupedAggregateRegionObserver contains code changes that create appropriate Scanner object on server side.

Others are mostly code refactoring changes and package name changes.
Please review @dbwong @BinShi-SecularBird

@@ -464,6 +464,8 @@ public SQLException newException(SQLExceptionInfo info) {
INSUFFICIENT_MEMORY(999, "50M01", "Unable to allocate enough memory."),
HASH_JOIN_CACHE_NOT_FOUND(900, "HJ01", "Hash Join cache not found"),

STATS_COLLECTION_DISABLED_ON_SERVER(1401, "STS01", "Stats collection attempted but is disabled on server"),
Copy link
Contributor

Choose a reason for hiding this comment

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

In general the error codes appear to be grouped by number/purpose. Do we have system level error code or stats codes? Do we want to reserve a prefix range for this 14XX? Consider moving to a different location for sorting reasons.

Copy link
Member Author

Choose a reason for hiding this comment

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

In general the error codes appear to be grouped by number/purpose. Do we have system level error code or stats codes?

Yes thats correct, there are some conventions. I am not sure if these are followed here. Phoenix has a bunch of its own exception types not really relevant to SQL.

Do we want to reserve a prefix range for this 14XX?

I am not sure if we can do that and if yes, whats the way to do that.

Consider moving to a different location for sorting reasons

Will do

Copy link
Contributor

Choose a reason for hiding this comment

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

@twdsilva Are you aware of any conventions we are trying to hold for SQL exceptions?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm very confusion about the naming convention we used for the first two fields, eg., "1401" and "STS01". The last 4 sql exceptions defined are totally out of orders which mightn't be good.

Copy link
Member Author

Choose a reason for hiding this comment

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

The exceptions are not sorted in the code. The 1401 and STS01 are arbitrarily chosen. Not sure about the next 4 exceptions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Spoke with Thomas offline, he is okay with this. We are not really following SQL conventions here.

/**
* Tests the behavior of stats collection code when stats are disabled on server side
*/
public class NoOpStatsCollectorIT extends ParallelStatsDisabledIT {
Copy link
Contributor

Choose a reason for hiding this comment

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

This class tests a bunch of negative cases. Do we have good coverage on the positive cases such that we are confident the removal of STATS_ENABLED_ATTRIB does not break anything?

Copy link
Member Author

Choose a reason for hiding this comment

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

The property was deprecated more than 2 releases ago. As of now I have removed its total usage.
I don't think that it would break anything.

@@ -70,8 +69,7 @@ public GuidePostsCache(ConnectionQueryServices queryServices, Configuration conf
final long maxTableStatsCacheSize = config.getLong(
QueryServices.STATS_MAX_CACHE_SIZE,
QueryServicesOptions.DEFAULT_STATS_MAX_CACHE_SIZE);
final boolean isStatsEnabled = config.getBoolean(STATS_COLLECTION_ENABLED, DEFAULT_STATS_COLLECTION_ENABLED)
&& config.getBoolean(STATS_ENABLED_ATTRIB, true);
final boolean isStatsEnabled = config.getBoolean(STATS_COLLECTION_ENABLED, DEFAULT_STATS_COLLECTION_ENABLED);
Copy link
Contributor

Choose a reason for hiding this comment

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

alignment problem.

import java.sql.SQLException;

public class StatsCollectionDisabledOnServerException extends SQLException {

Copy link
Contributor

Choose a reason for hiding this comment

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

remove empty line here?

private static final long serialVersionUID = 1L;
private static SQLExceptionCode code = SQLExceptionCode.STATS_COLLECTION_DISABLED_ON_SERVER;

public StatsCollectionDisabledOnServerException() {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to pass table name and call setTableNae in SQLExceptionInfo.Builder.

Copy link
Member Author

Choose a reason for hiding this comment

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

The exception is wrapped around by DoNotRetryIOException from HBase which prints the region name automatically (which contains table name), hence I didn't add it here.

@karanmehta93
Copy link
Member Author

Thanks @BinShi-SecularBird and @dbwong for the review.

@karanmehta93 karanmehta93 merged commit 522a363 into apache:4.x-HBase-1.4 Jan 30, 2019
@karanmehta93 karanmehta93 deleted the PHOENIX-4009 branch January 30, 2019 20:37
karanmehta93 added a commit to karanmehta93/phoenix that referenced this pull request Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants