Github user keith-turner commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/204#discussion_r98457211
--- Diff:
core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
---
@@ -1208,11 +1207,20 @@ public void online(String tableName) throws
AccumuloSecurityException, AccumuloE
@Override
public void online(String tableName, boolean wait) throws
AccumuloSecurityException, AccumuloException, TableNotFoundException {
checkArgument(tableName != null, "tableName is null");
+
+ long cacheResetCount = Tables.getCacheResetCount();
+
String tableId = Tables.getTableId(context.getInstance(), tableName);
/**
* ACCUMULO-4574 if table is already online return without executing
fate operation.
*/
+
+ // getTableId may have side effect of clearing zookeeper cache - no
need to clear again.
+ if (cacheResetCount == Tables.getCacheResetCount()) {
+ Tables.clearCacheByPath(context.getInstance(), Constants.ZTABLES +
"/" + tableId + Constants.ZTABLE_STATE);
--- End diff --
Might be nice to centralize the zookeeper path construction in Tables
class. Instead of constructing the path here, could have a method called
`Tables.clearCachedTableState(String tableId)`. Alternatively, could add a
boolean to indicates if cache should be used`Tables.getTableState(String
tableId, boolean useCache)`. Structuring the code this way makes it easier to
use this functionality elsewhere. If I wanted to use what you have here
elsewhere, I would probably copy and paste the path construction code you have
here.
I think I like adding the boolean to `getTableState` because that makes it
easy to change the implementation in the future to not even use zoocache (just
go straight to zookeeper) when the boolean is false.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---