-
Notifications
You must be signed in to change notification settings - Fork 999
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-7115 Create separate handler thread pool for invalidating server metadata cache #1748
Conversation
@palashc Can you please review this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a few check-style fixes, but LGTM otherwise. Thank you!
@@ -604,6 +608,8 @@ public static PName newPName(byte[] keyBuffer, int keyOffset, int keyLength) { | |||
|
|||
private MetricsMetadataSource metricsSource; | |||
private long metadataCacheInvalidationTimeoutMs; | |||
private Connection invalidateMetadataCacheConnection = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shahrs87 As discussed offline, wondering whether this connection for invalidation can be wrapped inside CQSI. It might be useful to provide an interface through CQSI. This will be in line with our current packaging of hConnections inside CQSI. Another advantage will be we can then use PhoenixConnection/CQSI to invoke this from out-of-band tools and clients too.
To begin with, the invalidation API can be exposed only for server-side connection and be a no-op for other clients/profiles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After making this change here, there are few test failures in:
BackwardCompatibilityIT.testSelectUpsertWithNewClientWithMaxLookBackAge#org.apache.phoenix:phoenix-client-hbase-2.4:5.1.0
- org.apache.phoenix.end2end.LoadSystemTableSnapshotIT#testPhoenixUpgrade
See the failing jenkins job here.
From the jenkins logs, I am not able to root cause the failure. @jpisaac Can you please help here?
Configuration clonedConfiguration = PropertiesUtil.cloneConfig(this.config); | ||
clonedConfiguration.setClass(CUSTOM_CONTROLLER_CONF_KEY, | ||
InvalidateMetadataCacheControllerFactory.class, RpcControllerFactory.class); | ||
invalidateMetadataCacheConnection = ConnectionFactory.createConnection(clonedConfiguration); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
openConnection()
method uses HBaseFactoryProvider.getHConnectionFactory()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored openConnection and closeConnection methods here.
44ad655
to
e8fda04
Compare
@@ -2090,6 +2090,8 @@ public void createTable(RpcController controller, CreateTableRequest request, | |||
schemaName = rowKeyMetaData[PhoenixDatabaseMetaData.SCHEMA_NAME_INDEX]; | |||
tableName = rowKeyMetaData[PhoenixDatabaseMetaData.TABLE_NAME_INDEX]; | |||
fullTableName = SchemaUtil.getTableName(schemaName, tableName); | |||
LOGGER.info("RSS create table, tenantID {}, schemaName: {}, table name: {}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Was this for debug purposes?
CUSTOM_CONTROLLER_CONF_KEY to instantiate InvalidateMetadataCacheController which has | ||
a special priority for invalidate metadata cache operations. | ||
*/ | ||
public Connection getInvalidateMetadataCacheConnection() throws SQLException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Refactoring suggestions -
Maybe the initialization of the invalidateMetadataCacheConnection can be done in CQSI init itself, since these are one time actions. Instead of late binding/initialization. You may be able to simplify the connection creation without cloning the config and overriding the CUSTOM_CONTROLLER_CONF_KEY. See ServerSideRPCControllerFactory usage for eg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @shahrs87 for pointing out the need for overriding the CUSTOM_CONTROLLER_CONF_KEY. Since we are going to late binding, may make sense to provide some synchronization, as it probably will be invoked via multiple threads and then we may have some leaky hConnections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, left some general refactoring suggestions. Also maybe refactor the invalidateServerMetadataCache method itself into CQSI as we discussed offline.
…ver metadata cache
4df8210
to
271e78c
Compare
@jpisaac Can you please review the patch once again? I have moved invalidateServerMetadataCache to CQSI completely. Thank you for the feedback. |
@@ -3546,9 +3586,6 @@ public Void call() throws Exception { | |||
success = true; | |||
return null; | |||
} | |||
nSequenceSaltBuckets = ConnectionQueryServicesImpl.this.props.getInt( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving initialization of nSequenceSaltBuckets to the constructor since SKIP_SYSTEM_TABLES_EXISTENCE_CHECK can be set to true and we return early at L3587 and this will leave nSequenceSaltBuckets initiliazed to default value i.e 0.
All the 3 failing tests are known flappers.
I am merging this patch since all the review comments are addressed. Thank you @jpisaac @palashc for the reviews. |
No description provided.