incubator-accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Newton <eric.new...@gmail.com>
Subject Re: MockInstance usage not working...?
Date Tue, 28 Feb 2012 13:22:09 GMT
I just dropped this file into to my accumulo1.4/src/core maven module and
ran it in eclipse and from the command line. No errors.

$ ./bin/accumulo accumulo.Mock
Ingesting data ...
Reading data ...
row_0 cf_0:cq_1 [] 1330435169481 false val_1
...
row_999 cf_999:cq_1 [] 1330435169614 false val_1
Done


-Eric

On Mon, Feb 27, 2012 at 5:19 PM, Jason Trost <jason.trost@gmail.com> wrote:

> Any idea why this doesn't work (see code and stack trace below)?  I am
> using accumulo trunk.  This problem only occurs when I use a Scanner
> or BatchScanner.  If I comment out the scanning section there are no
> errors.
>
> Thanks,
>
> --Jason
>
> Java code (https://gist.github.com/1927202)
>
> package accumulo;
>
> import java.util.Map.Entry;
>
> import org.apache.accumulo.core.client.BatchWriter;
> import org.apache.accumulo.core.client.Connector;
> import org.apache.accumulo.core.client.Instance;
> import org.apache.accumulo.core.client.Scanner;
> import org.apache.accumulo.core.client.mock.MockInstance;
> import org.apache.accumulo.core.data.Key;
> import org.apache.accumulo.core.data.Mutation;
> import org.apache.accumulo.core.data.Value;
> import org.apache.accumulo.core.security.Authorizations;
>
> public class Mock {
>
>        public static void main(String[] args) throws Exception {
>                String table = "data";
>                String user = "root";
>                Instance inst = new MockInstance("inst");
>                Connector conn = inst.getConnector(user, "secret");
>                conn.securityOperations().changeUserAuthorizations(user, new
> Authorizations("auth"));
>                Authorizations auths =
> conn.securityOperations().getUserAuthorizations(user);
>                conn.tableOperations().create(table);
>
>                System.out.println("Ingesting data ...");
>                BatchWriter wr = conn.createBatchWriter(table, 10000000,
> 10000, 5);
>                for(int i = 0; i < 1000; ++i)
>                {
>                        Mutation m = new Mutation("row_"+i);
>                        m.put("cf_"+i, "cq_"+1, "val_"+1);
>                        wr.addMutation(m);
>                }
>                wr.close();
>
>                System.out.println("Reading data ...");
>                Scanner s = conn.createScanner(table, auths);
>                for(Entry<Key, Value> e : s)
>                {
>                        System.out.println(e);
>                }
>                System.out.println("Done");
>        }
> }
>
> stack trace (https://gist.github.com/1927225)
>
> Ingesting data ...
> Reading data ...
> Exception in thread
> "org.apache.accumulo.start.classloader.AccumuloFilesystemAlterationMonitor"
> java.lang.NullPointerException
>        at
> org.apache.commons.jci.monitor.FilesystemAlterationObserverImpl$MonitorFileImpl.listFiles(FilesystemAlterationObserverImpl.java:64)
>        at
> org.apache.commons.jci.monitor.FilesystemAlterationObserverImpl$Entry.compareChilds(FilesystemAlterationObserverImpl.java:119)
>        at
> org.apache.commons.jci.monitor.FilesystemAlterationObserverImpl$Entry.needsToBeDeleted(FilesystemAlterationObserverImpl.java:203)
>        at
> org.apache.commons.jci.monitor.FilesystemAlterationObserverImpl$Entry.compareChilds(FilesystemAlterationObserverImpl.java:137)
>        at
> org.apache.commons.jci.monitor.FilesystemAlterationObserverImpl$Entry.needsToBeDeleted(FilesystemAlterationObserverImpl.java:203)
>        at
> org.apache.commons.jci.monitor.FilesystemAlterationObserverImpl$Entry.compareChilds(FilesystemAlterationObserverImpl.java:137)
>        at
> org.apache.commons.jci.monitor.FilesystemAlterationObserverImpl$Entry.needsToBeDeleted(FilesystemAlterationObserverImpl.java:203)
>        at
> org.apache.commons.jci.monitor.FilesystemAlterationObserverImpl$Entry.compareChilds(FilesystemAlterationObserverImpl.java:137)
>        at
> org.apache.commons.jci.monitor.FilesystemAlterationObserverImpl$Entry.needsToBeDeleted(FilesystemAlterationObserverImpl.java:203)
>        at
> org.apache.commons.jci.monitor.FilesystemAlterationObserverImpl.checkEntries(FilesystemAlterationObserverImpl.java:317)
>        at
> org.apache.commons.jci.monitor.FilesystemAlterationObserverImpl.checkAndNotify(FilesystemAlterationObserverImpl.java:331)
>        at
> org.apache.accumulo.start.classloader.AccumuloFilesystemAlterationMonitor.run(AccumuloFilesystemAlterationMonitor.java:121)
>        at java.lang.Thread.run(Thread.java:722)
>

Mime
View raw message