better error in the case where init is called on an existing db

Ah...

Would make sense to call engine.MVCCDecodeKey on that key now that we
always encode keys.

On Tue, Dec 16, 2014 at 8:58 AM, Andrew Bonventre <notifications@github.com>
wrote:

> In storage/store.go
> <https://github.com/cockroachdb/cockroach/pull/225#discussion-diff-21913140>
> :
>
> > @@ -442,7 +442,7 @@ func (s *Store) Bootstrap(ident proto.StoreIdent) error {
> >  	if err != nil {
> >  		return util.Errorf("unable to scan engine to verify empty: %s", err)
> >  	} else if len(kvs) > 0 {
> > -		return util.Errorf("bootstrap failed; non-empty map with first key %q", kvs[0].Key)
> > +		return util.Errorf("non-empty engine %s (first key: %q)", s.engine, string(kvs[0].Key))
>
> the reason I shorted it is because the full error when realized is
>
> E1215 21:09:35.763301   62288 server.go:160] Failed to bootstrap cluster: store.go:445: non-empty engine {[ssd] }=/tmp/db (first key: "%\x80\x80\x80\x86ˑ\xca\xee\x00")
>
> So the previous error was essentially saying "failed to bootstrap cluster"
> twice in the output.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/cockroachdb/cockroach/pull/225/files#r21913140>.
>