lwhay / asterixdb

Automatically exported from code.google.com/p/asterixdb
0 stars 0 forks source link

Need a better error message for duplicate functions error instead of TreeIndexDuplicateKeyException #799

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
While testing the persistence of metadata entries for datasets, datatypes, 
functions, indexes, etc, that were created, the following error message 
appeared when a function was declared twice, each time in a different tab 
within the same web browser:

Failed to insert key since key already exists. [TreeIndexDuplicateKeyException]

Rather than returning an exception, an error message saying that a function of 
the same name/signature already exists should be sufficient. Please note that 
the TreeIndexDuplicateKeyException also occurs when a function is defined twice 
within the same tab in the same browser.

Steps to recreate the issue:
1. Open two tabs in your web browser, each loaded to the AsterixDB Web 
Interface.
2. Execute the following create function statement in the first tab then again 
in the second:
create function multiply($a,$b){
$a * $b
};
3. In the first tab the query should succeed and in the second tab the 
exception should be returned.

An alternate way to recreate the issue would be to have just one Web Interface 
tab open and executing the following:
create function multiply($a,$b){
$a * $b
};

create function multiply($a,$b){
$a * $b
};

In the stack trace, there already appears to be an error message that makes 
more sense to the reader than the TreeIndexDuplicateKeyException: "A function 
with this name multiply and arity 2 already exists in dataverse 'metatestcase'."

Aug 20, 2014 8:02:16 PM edu.uci.ics.asterix.api.http.servlet.APIServlet doPost
SEVERE: A function with this name multiply and arity 2 already exists in 
dataverse 'metatestcase'.
edu.uci.ics.asterix.metadata.MetadataException: A function with this name 
multiply and arity 2 already exists in dataverse 'metatestcase'.
    at edu.uci.ics.asterix.metadata.MetadataNode.addFunction(MetadataNode.java:270)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
    at sun.rmi.transport.Transport$1.run(Transport.java:178)
    at sun.rmi.transport.Transport$1.run(Transport.java:175)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:174)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:557)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:812)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:671)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:276)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:253)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:162)
    at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
    at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
    at com.sun.proxy.$Proxy11.addFunction(Unknown Source)
    at edu.uci.ics.asterix.metadata.MetadataManager.addFunction(MetadataManager.java:546)
    at edu.uci.ics.asterix.aql.translator.AqlTranslator.handleCreateFunctionStatement(AqlTranslator.java:1268)
    at edu.uci.ics.asterix.aql.translator.AqlTranslator.compileAndExecute(AqlTranslator.java:257)
    at edu.uci.ics.asterix.api.http.servlet.APIServlet.doPost(APIServlet.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:546)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:483)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:970)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:411)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:904)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
    at org.eclipse.jetty.server.Server.handle(Server.java:347)
    at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:439)
    at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:924)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:781)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:43)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:545)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:43)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
    at java.lang.Thread.run(Thread.java:745)
Caused by: 
edu.uci.ics.hyracks.storage.am.common.exceptions.TreeIndexDuplicateKeyException:
 Failed to insert key since key already exists.
    at edu.uci.ics.hyracks.storage.am.lsm.btree.impls.LSMBTree.insert(LSMBTree.java:313)
    at edu.uci.ics.hyracks.storage.am.lsm.btree.impls.LSMBTree.modify(LSMBTree.java:289)
    at edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMHarness.modify(LSMHarness.java:226)
    at edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMHarness.forceModify(LSMHarness.java:210)
    at edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMTreeIndexAccessor.forceInsert(LSMTreeIndexAccessor.java:145)
    at edu.uci.ics.asterix.metadata.MetadataNode.insertTupleIntoIndex(MetadataNode.java:301)
    at edu.uci.ics.asterix.metadata.MetadataNode.addFunction(MetadataNode.java:267)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
    at sun.rmi.transport.Transport$1.run(Transport.java:178)
    at sun.rmi.transport.Transport$1.run(Transport.java:175)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:174)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:557)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:812)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:671)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    ... 1 more

edu.uci.ics.hyracks.storage.am.common.exceptions.TreeIndexDuplicateKeyException
Aug 20, 2014 8:02:20 PM 
edu.uci.ics.hyracks.control.common.dataset.ResultStateSweeper sweep
INFO: Result state cleanup instance successfully completed.

Original issue reported on code.google.com by franc...@uci.edu on 23 Aug 2014 at 6:24

GoogleCodeExporter commented 9 years ago
I have been told this should be assigned to Raman so I am doing so :) 

Original comment by ima...@uci.edu on 23 Aug 2014 at 6:48

GoogleCodeExporter commented 9 years ago
fixed in branch

Original comment by RamanGro...@gmail.com on 18 Nov 2014 at 5:32