[
https://issues.apache.org/jira/browse/ACCUMULO-2594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13955605#comment-13955605
]
Keith Turner commented on ACCUMULO-2594:
----------------------------------------
Many places that use the tablet locator do this type of checking outside of the
TabletLocator. For example in {{TabletServerBatchWriter}} there is a method
called {{binMutations}} that has the following code. If tablets were not
located it checks if the table exist. If not, it assumes it was deleted
because of checks done when the batch writer was created to ensure a table
exist.
{code:java}
locator.binMutations(credentials, tableMutations, binnedMutations,
tableFailures);
if (tableFailures.size() > 0) {
failedMutations.add(table, tableFailures);
if (tableFailures.size() == tableMutations.size())
if (!Tables.exists(instance, entry.getKey()))
throw new TableDeletedException(entry.getKey());
else if (Tables.getTableState(instance, table) ==
TableState.OFFLINE)
throw new TableOfflineException(instance, entry.getKey());
}
{code}
Maybe the checking could be centralized in the code. Would need to examine the
code that uses TabletLocator and determine what type of checks are currently
done.
> Improve TabletLocator.getInstance() to check tableId points to a table which
> exists
> -----------------------------------------------------------------------------------
>
> Key: ACCUMULO-2594
> URL: https://issues.apache.org/jira/browse/ACCUMULO-2594
> Project: Accumulo
> Issue Type: Improvement
> Components: client
> Affects Versions: 1.5.0
> Reporter: Ara Ebrahimi
> Priority: Minor
> Fix For: 1.5.2, 1.6.1
>
>
> If you pass an invalid tableId (or in my case tableName instead of tableId)
> TabletLocator won't complain.
> TabletLocator tabletLocator = TabletLocator.getInstance(instance, new
> Text(tableId));
> Next if you use the returned tabletLocator to locate a tablet it just returns
> an empty list, never complaining that the tableId was invalid:
> TabletLocator.TabletLocation tabletLocation =
> tabletLocator.locateTablet(rowKey.getText(), false, false,
> credentials.toThrift());
> Ideally TabletLocator.getInstance() should guard against invalid/non-existing
> tableIds.
--
This message was sent by Atlassian JIRA
(v6.2#6252)