[
https://issues.apache.org/jira/browse/PHOENIX-1263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14152890#comment-14152890
]
James Taylor commented on PHOENIX-1263:
---------------------------------------
Still setting start/stop row in post scanner open:
{code}
- // We are setting the start row and stop row such that it covers
the entire region. As part
- // of Phonenix-1263 we are storing the guideposts against the
physical table rather than
- // individual tenant specific tables.
scan.setStartRow(HConstants.EMPTY_START_ROW);
scan.setStopRow(HConstants.EMPTY_END_ROW);
{code}
This code in ParallelIterators is going to be a problem, as physicalTable won't
be the physical table. If you get null here, it means it's in the cache, do do
this instead. It'd be best if you hid the logic behind a new MetaDataClient
method.
{code}
+ if(physicalTable == null) {
+ physicalTable = connection.getMetaDataCache().getTable(new
PTableKey(null, fullTableName));
+ }
{code}
Revert these changes:
{code}
public long getCurrentTime(String schemaName, String tableName) throws
SQLException {
- MetaDataMutationResult result = updateCache(schemaName, tableName,
true);
+ boolean systemTable = SYSTEM_CATALOG_SCHEMA.equals(schemaName);
+ PName tenantId = systemTable ? null : connection.getTenantId();
+ MetaDataMutationResult result = updateCache(tenantId, schemaName,
tableName, true);
return result.getMutationTime();
}
@@ -289,14 +291,21 @@ public class MetaDataClient {
* @throws SQLException
*/
public MetaDataMutationResult updateCache(String schemaName, String
tableName) throws SQLException {
- return updateCache(schemaName, tableName, false);
+ boolean systemTable = SYSTEM_CATALOG_SCHEMA.equals(schemaName);
+ PName tenantId = systemTable ? null : connection.getTenantId();
+ return updateCache(tenantId, schemaName, tableName, false);
}
- private MetaDataMutationResult updateCache(String schemaName, String
tableName, boolean alwaysHitServer) throws
{code}
Instead just add this:
{code}
private MetaDataMutationResult updateCache(String schemaName, String tableName,
boolean alwaysHitServer) throws SQLException {
return updateCache(connection.getTenantId(), schemaName, tableName,
alwaysHitServer);
}
{code}
This is the only change that should be necessary to updateCache:
{code}
+ private MetaDataMutationResult updateCache(PName tenantId, String
schemaName, String tableName,
+ boolean alwaysHitServer) throws SQLException { // TODO: pass
byte[] herez
Long scn = connection.getSCN();
boolean systemTable = SYSTEM_CATALOG_SCHEMA.equals(schemaName);
// System tables must always have a null tenantId
- PName tenantId = systemTable ? null : connection.getTenantId();
+ tenantId = systemTable ? null : tenantId;
{code}
We need some unit tests around this that would fail if we're not getting the
physical table and/or clearing the scan range.
> Only cache guideposts on physical PTable
> ----------------------------------------
>
> Key: PHOENIX-1263
> URL: https://issues.apache.org/jira/browse/PHOENIX-1263
> Project: Phoenix
> Issue Type: Sub-task
> Reporter: James Taylor
> Assignee: ramkrishna.s.vasudevan
> Attachments: Phoenix-1263_1.patch, Phoenix-1263_6.patch
>
>
> Rather than caching the guideposts on all tenant-specific tables, we should
> cache them only on the physical table. On the client side, we should also
> update the cache with the latest for the base multi-tenant table when we
> update the cache for a tenant-specific table. Then when we lookup the
> guideposts, we should ensure that we're getting them from the physical table.
> Otherwise, it'll be difficult to keep the guideposts cached on the PTable in
> sync across all tenant-specific tables (not to mention using quite a bit of
> memory).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)