Uploaded image for project: 'CDAP'
  1. CDAP
  2. CDAP-6846

Custom mapped namespace delete fails if custom hdfs directory name is not same as namespace id

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.5.0
    • Fix Version/s: 3.5.0
    • Component/s: Namespaces
    • Labels:
    • Rank:
      1|hzzilj:

      Description

      Create a custom mapped namespace with custom location on HDFS. Make sure to give a different name to the namespace dir than the namespace.

      For example namespace id: cust_ns
      HDFS dir should be anything except this like my_cust_ns

      Deploy purchase app in it and write something to flow to make sure that stream files are created on the filesystem.

      Now deleting this namespace will fail. This is because namespace delete calls StreamAdmin to delete all streams which then calls https://github.com/caskdata/cdap/blob/release/3.5/cdap-data-fabric/src/main/java/co/cask/cdap/data/stream/StreamUtils.java#L448

      Here we are recreate namespace id from the namespace dir name. Now the namespace id which we will get from here will be hdfs dir name and not the actual namespace id and later we lookup location using this which fails. Please see the stack trace below.

      2016-07-29 23:08:33,309 - WARN  [netty-executor-83:c.c.c.i.a.n.DefaultNamespaceAdmin@237] - Error while deleting namespace namespace:newns2
      java.lang.RuntimeException: java.io.IOException: Failed to get namespace meta for namespace namespace:ns3
              at com.google.common.base.Throwables.propagate(Throwables.java:160) ~[com.google.guava.guava-13.0.1.jar:na]
              at co.cask.cdap.data2.transaction.stream.FileStreamAdmin$15.run(FileStreamAdmin.java:659) ~[co.cask.cdap.cdap-data-fabric-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.data.stream.AbstractStreamCoordinatorClient.deleteStream(AbstractStreamCoordinatorClient.java:121) ~[co.cask.cdap.cdap-data-fabric-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.data2.transaction.stream.FileStreamAdmin.doDrop(FileStreamAdmin.java:611) ~[co.cask.cdap.cdap-data-fabric-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.data2.transaction.stream.FileStreamAdmin.dropAllInNamespace(FileStreamAdmin.java:187) ~[co.cask.cdap.cdap-data-fabric-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.internal.app.namespace.DefaultNamespaceAdmin.delete(DefaultNamespaceAdmin.java:209) ~[co.cask.cdap.cdap-app-fabric-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.gateway.handlers.NamespaceHttpHandler.delete(NamespaceHttpHandler.java:129) [co.cask.cdap.cdap-app-fabric-3.5.0-SNAPSHOT.jar:na]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_75]
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_75]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_75]
              at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_75]
              at co.cask.http.HttpMethodInfo.invoke(HttpMethodInfo.java:80) [co.cask.http.netty-http-0.14.0.jar:na]
              at co.cask.http.HttpDispatcher.messageReceived(HttpDispatcher.java:38) [co.cask.http.netty-http-0.14.0.jar:na]
              at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) [io.netty.netty-3.6.6.Final.jar:na]
              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) [io.netty.netty-3.6.6.Final.jar:na]
              at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) [io.netty.netty-3.6.6.Final.jar:na]
              at org.jboss.netty.channel.SimpleChannelUpstreamHandler.messageReceived(SimpleChannelUpstreamHandler.java:124) [io.netty.netty-3.6.6.Final.jar:na]
              at co.cask.cdap.common.http.AuthenticationChannelHandler.messageReceived(AuthenticationChannelHandler.java:64) [co.cask.cdap.cdap-common-3.5.0-SNAPSHOT.jar:na]
              at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) [io.netty.netty-3.6.6.Final.jar:na]
              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) [io.netty.netty-3.6.6.Final.jar:na]
              at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) [io.netty.netty-3.6.6.Final.jar:na]
              at org.jboss.netty.handler.execution.ChannelUpstreamEventRunnable.doRun(ChannelUpstreamEventRunnable.java:43) [io.netty.netty-3.6.6.Final.jar:na]
              at org.jboss.netty.handler.execution.ChannelEventRunnable.run(ChannelEventRunnable.java:67) [io.netty.netty-3.6.6.Final.jar:na]
              at org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor$ChildExecutor.run(OrderedMemoryAwareThreadPoolExecutor.java:314) [io.netty.netty-3.6.6.Final.jar:na]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_75]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_75]
              at java.lang.Thread.run(Thread.java:745) [na:1.7.0_75]
      Caused by: java.io.IOException: Failed to get namespace meta for namespace namespace:ns3
              at co.cask.cdap.common.namespace.DefaultNamespacedLocationFactory.get(DefaultNamespacedLocationFactory.java:90) ~[co.cask.cdap.cdap-common-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.common.namespace.DefaultNamespacedLocationFactory.get(DefaultNamespacedLocationFactory.java:58) ~[co.cask.cdap.cdap-common-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.data2.transaction.stream.FileStreamAdmin.getStreamBaseLocation(FileStreamAdmin.java:592) ~[co.cask.cdap.cdap-data-fabric-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.data2.transaction.stream.FileStreamAdmin.getStreamLocation(FileStreamAdmin.java:585) ~[co.cask.cdap.cdap-data-fabric-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.data2.transaction.stream.FileStreamAdmin.getConfigLocation(FileStreamAdmin.java:578) ~[co.cask.cdap.cdap-data-fabric-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.data2.transaction.stream.FileStreamAdmin.access$200(FileStreamAdmin.java:93) ~[co.cask.cdap.cdap-data-fabric-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.data2.transaction.stream.FileStreamAdmin$15$1.call(FileStreamAdmin.java:618) ~[co.cask.cdap.cdap-data-fabric-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.data2.transaction.stream.FileStreamAdmin$15$1.call(FileStreamAdmin.java:615) ~[co.cask.cdap.cdap-data-fabric-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.data2.security.ImpersonationUtils$1.run(ImpersonationUtils.java:46) ~[co.cask.cdap.cdap-data-fabric-3.5.0-SNAPSHOT.jar:na]
              at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_75]
              at javax.security.auth.Subject.doAs(Subject.java:415) ~[na:1.7.0_75]
              at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657) ~[hadoop-common-2.7.1.2.3.4.7-4.jar:na]
              at co.cask.cdap.data2.security.ImpersonationUtils.doAs(ImpersonationUtils.java:43) ~[co.cask.cdap.cdap-data-fabric-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.data2.transaction.stream.FileStreamAdmin$15.run(FileStreamAdmin.java:615) ~[co.cask.cdap.cdap-data-fabric-3.5.0-SNAPSHOT.jar:na]
              ... 25 common frames omitted
      Caused by: co.cask.cdap.common.NamespaceNotFoundException: 'namespace:ns3' was not found.
              at co.cask.cdap.internal.app.namespace.DefaultNamespaceQueryAdmin.get(DefaultNamespaceQueryAdmin.java:88) ~[co.cask.cdap.cdap-app-fabric-3.5.0-SNAPSHOT.jar:na]
              at co.cask.cdap.common.namespace.DefaultNamespacedLocationFactory.get(DefaultNamespacedLocationFactory.java:88) ~[co.cask.cdap.cdap-common-3.5.0-SNAPSHOT.jar:na]
              ... 38 common frames omitted
      

        Attachments

          Activity

            People

            • Assignee:
              rsinha Rohit Sinha
              Reporter:
              rsinha Rohit Sinha
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: