[CDAP-8229] UpgradeTool assume default namespace exists Created: 26/Jan/17  Updated: 24/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: CDAP
Component/s: None
Affects Version/s: 4.1.0, 4.0.1, 3.5.3
Fix Version/s: 4.1.0, 3.5.4, 4.0.2

Type: Bug Priority: Critical
Reporter: Terence Yim Assignee: Ali Anwar
Resolution: Fixed Votes: 0
Labels: TR, zen

Release Notes: Fix the CDAP UpgradeTool to not rely on the existence of a 'default' namespace.
Rank: 1|hzztfb:

 Description   

The UpgradeTool fails with exception like this if default namespace doesn't exist:

2017-01-25 16:48:05,183 - ERROR [main:c.c.c.d.t.UpgradeTool@428] - Failed to upgrade ...
java.util.concurrent.ExecutionException: co.cask.cdap.api.dataset.DatasetManagementException: Cannot retrieve all dataset instances, details: Response code: 404, message: 'Not Found', body: ''namespace:default' was not found.'
	at co.cask.cdap.common.utils.Tasks.waitFor(Tasks.java:63) ~[co.cask.cdap.cdap-common-3.5.3.jar:na]
	at co.cask.cdap.common.utils.Tasks.waitFor(Tasks.java:91) ~[co.cask.cdap.cdap-common-3.5.3.jar:na]
	at co.cask.cdap.data.tools.UpgradeDatasetServiceManager.startUp(UpgradeDatasetServiceManager.java:115) ~[co.cask.cdap.cdap-master-3.5.3.jar:na]
	at co.cask.cdap.data.tools.UpgradeTool.performUpgrade(UpgradeTool.java:393) ~[co.cask.cdap.cdap-master-3.5.3.jar:na]
	at co.cask.cdap.data.tools.UpgradeTool.doMain(UpgradeTool.java:317) ~[co.cask.cdap.cdap-master-3.5.3.jar:na]
	at co.cask.cdap.data.tools.UpgradeTool.main(UpgradeTool.java:426) ~[co.cask.cdap.cdap-master-3.5.3.jar:na]
Caused by: co.cask.cdap.api.dataset.DatasetManagementException: Cannot retrieve all dataset instances, details: Response code: 404, message: 'Not Found', body: ''namespace:default' was not found.'
	at co.cask.cdap.data2.datafabric.dataset.DatasetServiceClient.getAllInstances(DatasetServiceClient.java:154) ~[co.cask.cdap.cdap-data-fabric-3.5.3.jar:na]
	at co.cask.cdap.data2.datafabric.dataset.RemoteDatasetFramework.getInstances(RemoteDatasetFramework.java:154) ~[co.cask.cdap.cdap-data-fabric-3.5.3.jar:na]
	at co.cask.cdap.data2.dataset2.ForwardingDatasetFramework.getInstances(ForwardingDatasetFramework.java:85) ~[co.cask.cdap.cdap-data-fabric-3.5.3.jar:na]
	at co.cask.cdap.data.tools.UpgradeDatasetServiceManager$1.call(UpgradeDatasetServiceManager.java:119) ~[co.cask.cdap.cdap-master-3.5.3.jar:na]
	at co.cask.cdap.data.tools.UpgradeDatasetServiceManager$1.call(UpgradeDatasetServiceManager.java:115) ~[co.cask.cdap.cdap-master-3.5.3.jar:na]
	at co.cask.cdap.common.utils.Tasks.waitFor(Tasks.java:58) ~[co.cask.cdap.cdap-common-3.5.3.jar:na]
	... 5 common frames omitted


 Comments   
Comment by Poorna Chandra [ 26/Jan/17 ]

As part of this effort we should also scan all usages of NamespaceId.DEFAULT to evaluate if it is really required or not.

Comment by Terence Yim [ 26/Jan/17 ]

Ideally the `NamespaceId.DEFAULT` should only be used in the `DefaultNamespaceEnsurer` and unit tests.

Comment by Ali Anwar [ 08/Feb/17 ]

Avoid depending on default namespace in UpgradeTool:
against release/3.5 for 3.5.4: https://github.com/caskdata/cdap/pull/7870
release/4.0: https://github.com/caskdata/cdap/pull/7924
Changes were brought into release/4.1 by a merge from release/4.0: https://github.com/caskdata/cdap/pull/7938

Comment by Leonid Fedotov [ 10/Feb/17 ]

Looking to upgrade to 4.1 very soon.
This needs to be fixed.

Generated at Mon Dec 17 05:15:55 UTC 2018 using Jira 7.13.0#713000-sha1:fbf406879436de2f3fb1cfa09c7fa556fb79615a.