ACCUMULO-2092 Make client view of table existence consistent Clear the cache after exceptions, instead of just successful fate operations. This ensures that a failure as the result of a TableNotFoundException or TableExistsException will be consistent with the client's view, if they check it right after the failure.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b0b2c499 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b0b2c499 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b0b2c499 Branch: refs/heads/master Commit: b0b2c49925735ca02019773e31c0ebee0e4a4260 Parents: a8f154e Author: Christopher Tubbs <ctubb...@apache.org> Authored: Wed Feb 5 19:14:06 2014 -0500 Committer: Christopher Tubbs <ctubb...@apache.org> Committed: Wed Feb 5 19:14:06 2014 -0500 ---------------------------------------------------------------------- .../core/client/admin/TableOperationsImpl.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0b2c499/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java index f459275..0245ef1 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java @@ -309,7 +309,6 @@ public class TableOperationsImpl extends TableOperationsHelper { return null; } String ret = waitForFateOperation(opid); - Tables.clearCache(instance); return ret; } catch (ThriftSecurityException e) { String tableName = ByteBufferUtil.toString(args.get(0)); @@ -340,6 +339,7 @@ public class TableOperationsImpl extends TableOperationsHelper { } catch (Exception e) { throw new AccumuloException(e.getMessage(), e); } finally { + Tables.clearCache(instance); // always finish table op, even when exception if (opid != null) try { @@ -528,8 +528,8 @@ public class TableOperationsImpl extends TableOperationsHelper { ArgumentChecker.notNull(tableName); ByteBuffer EMPTY = ByteBuffer.allocate(0); - List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(Constants.UTF8)), start == null ? EMPTY : TextUtil.getByteBuffer(start), end == null ? EMPTY - : TextUtil.getByteBuffer(end)); + List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(Constants.UTF8)), start == null ? EMPTY : TextUtil.getByteBuffer(start), + end == null ? EMPTY : TextUtil.getByteBuffer(end)); Map<String,String> opts = new HashMap<String,String>(); try { doTableFateOperation(tableName, TableNotFoundException.class, FateOperation.TABLE_MERGE, args, opts); @@ -544,8 +544,8 @@ public class TableOperationsImpl extends TableOperationsHelper { ArgumentChecker.notNull(tableName); ByteBuffer EMPTY = ByteBuffer.allocate(0); - List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(Constants.UTF8)), start == null ? EMPTY : TextUtil.getByteBuffer(start), end == null ? EMPTY - : TextUtil.getByteBuffer(end)); + List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(Constants.UTF8)), start == null ? EMPTY : TextUtil.getByteBuffer(start), + end == null ? EMPTY : TextUtil.getByteBuffer(end)); Map<String,String> opts = new HashMap<String,String>(); try { doTableFateOperation(tableName, TableNotFoundException.class, FateOperation.TABLE_DELETE_RANGE, args, opts); @@ -787,8 +787,8 @@ public class TableOperationsImpl extends TableOperationsHelper { if (flush) _flush(tableId, start, end, true); - List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes(Constants.UTF8)), start == null ? EMPTY : TextUtil.getByteBuffer(start), end == null ? EMPTY - : TextUtil.getByteBuffer(end), ByteBuffer.wrap(IteratorUtil.encodeIteratorSettings(iterators))); + List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes(Constants.UTF8)), start == null ? EMPTY : TextUtil.getByteBuffer(start), + end == null ? EMPTY : TextUtil.getByteBuffer(end), ByteBuffer.wrap(IteratorUtil.encodeIteratorSettings(iterators))); Map<String,String> opts = new HashMap<String,String>(); try {