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-5881 - Port PHOENIX-5645 (MaxLookbackAge) to 5.x #857

Merged
merged 1 commit into from
Aug 19, 2020

Conversation

gjacoby126
Copy link
Contributor

No description provided.

@gjacoby126
Copy link
Contributor Author

Note that since HBase 2.1 and HBase 2.2 lack HBASE-24321, a lot of the logic is behind a 2.3 compatibility shim.

@gjacoby126 gjacoby126 requested a review from stoty August 14, 2020 17:30
@gjacoby126
Copy link
Contributor Author

@stoty - I'm curious about your opinion on how I'm using your compatibility projects to get version-specific coproc logic, plus version-specific feature flags.

@stoty
Copy link
Contributor

stoty commented Aug 14, 2020

In 4.x we use org.apache.phoenix.compat.hbase.HbaseCompatCapabilities for the feature flags, It would be more consistent to move the feature flags there.

I did not go through the code in detail, but it seems that extending BaseScannerRegionObserver from CompatBaseScannerRegionObserver would be a more elegant , and perhaps marginally faster solution than calling it explicitly.

@gjacoby126
Copy link
Contributor Author

@stoty - introduced HbaseCompatCapabilities and subclassed from ComaptBaseScannerRegionObserver, as you suggested.

Copy link
Contributor

@stoty stoty left a comment

Choose a reason for hiding this comment

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

The compatibility stuff in general LGTM.


import org.apache.hadoop.conf.Configuration;

public class ScanInfoUtil {
Copy link
Contributor

@stoty stoty Aug 18, 2020

Choose a reason for hiding this comment

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

This doesn't seem to be referenced anywhere.

@@ -367,4 +374,16 @@ RegionScanner getWrappedScanner(final ObserverContext<RegionCoprocessorEnvironme
dataRegion, indexMaintainer, null, viewConstants, null, null, projector, ptr, useQualiferAsListIndex);
}

@Override
public void preStoreScannerOpen(ObserverContext<RegionCoprocessorEnvironment> ctx, Store store,
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to do anything since the subclassing.

}

//In HBase 2.1 and 2.2, a lookback query won't return any results if covered by a future delete
public static boolean isLookbackBeyondDeletesSupported() { return false; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: indent like above in both files?

Copy link
Contributor

@stoty stoty left a comment

Choose a reason for hiding this comment

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

+1 LGTM

getConfiguration().getInt(CompatBaseScannerRegionObserver.PHOENIX_MAX_LOOKBACK_AGE_CONF_KEY,
CompatBaseScannerRegionObserver.DEFAULT_PHOENIX_MAX_LOOKBACK_AGE);
long now = EnvironmentEdgeManager.currentTimeMillis();
if (maxLookBackAge > 0 && now - maxLookBackAge * 1000L > scn){
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: would be good in understanding if s -> ms conversion happens outside of if condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I follow? The configuration property is in seconds (to correspond with HBase TTL, which is also in seconds), but we convert to ms in the if-block to compare with the current timestamp.

Copy link
Contributor

Choose a reason for hiding this comment

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

maxLookBackAge*1000 can be stored into a variable like done for ttl in other function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@swaroopak Switched to using an existing helper function to get the millisecond version of the max lookback config.

Copy link
Contributor

@swaroopak swaroopak left a comment

Choose a reason for hiding this comment

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

minor nit, rest LGTM.

@gjacoby126
Copy link
Contributor Author

Thanks for the reviews, @stoty and @swaroopak .

@gjacoby126 gjacoby126 merged commit cabab87 into apache:master Aug 19, 2020
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