Bucket creation.

Jeremiah Peschka jeremiah.peschka at gmail.com
Wed Feb 6 10:06:53 EST 2013


The NullReferenceException is painful, I agree. I've filed an bug report on
GitHub (https://github.com/DistributedNonsense/CorrugatedIron/issues/71) so
you can track the progress of a fix. IIRC, Riak actually sends a 404 back
to the client but we're not catching it for some reason. (I could be wrong,
I was watching Downton Abbey at the time.)

As far as reserved characters, I'm going to punt that back to the Basho
folks. Not out of spite, but just out of being busy.

---
Jeremiah Peschka - Founder, Brent Ozar Unlimited
MCITP: SQL Server 2008, MVP
Cloudera Certified Developer for Apache Hadoop


On Wed, Feb 6, 2013 at 6:54 AM, Kevin Burton <rkevinburton at charter.net>wrote:

> Thank you.****
>
> ** **
>
> As a slight suggestion. It would be helpful if the illegal characters were
> documented someplace and in which situations they are illegal. Along the
> lines of SQL and special characters it is well documented when there is a
> requirement to use square brackets. Here getting a NullReferenceException
> does not help in diagnosing that the problem is with special characters.**
> **
>
> ** **
>
> ** **
>
> *From:* riak-users [mailto:riak-users-bounces at lists.basho.com] *On Behalf
> Of *Jeremiah Peschka
> *Sent:* Wednesday, February 06, 2013 8:45 AM
> *To:* riak-users at lists.basho.com
> *Subject:* Re: Bucket creation.****
>
> ** **
>
> Kevin - in this specific case, Riak itself will accept a slash in the key
> name. It will not, however, accept a slash through the HTTP interface. See
> http://riak.markmail.org/search/?q=slash#query:slash+page:1+mid:5j5jb4maepr3epc3+state:resultsThe short version is that there's no sane way we can safely check strings
> for validity since all bucket and key names are valid, but they're
> different values of valid depending on the API you're using at the time.**
> **
>
> ** **
>
> As best as I can tell, there's no restriction on the riak KV side about
> how a bucket or key is named. As far as Erlang is concerned it's just a
> bunch of bytes masquerading as a string. If you do anything goofy and want
> that goofy/unexpected name to work everywhere you need to properly escape
> your bucket name. This is similar to how SQL Server requires square
> brackets around reserved keywords or database objects with special
> characters in their name (e.g. CREATE TABLE [i like data] ( id INT ); ). As
> long as names are correctly escaped, you won't run into any problems.****
>
> ** **
>
> Continuing the same analogy, CorrugatedIron is a lot like ADO.NET. If I
> create a SqlCommand with CommandText of "OMGWTFBBQ", The SqlCommand object
> doesn't care trying to do or that what I passed in probably isn't valid
> T-SQL, it only knows that I've given it a command that needs to be sent to
> a SQL Server.****
>
> ** **
>
> OJ and I have debated how much smarts CorrugatedIron should have. Our
> ultimate decision is that it should have just enough smarts to get the job
> done and not a speck more. It's a relatively low level client (along the
> lines of ADO.NET), but we do what we can to hide a lot of the nastiness
> and idiosyncrasies of Riak from the user in places where it might get
> confusing. One of the things we hide is the dual nature of Riak's API.
> Almost all operations are supported via ProtocolBuffers (which doesn't care
> about names) but a few are only supported through HTTP.****
>
> ** **
>
> I hope this helps clear up some of your questions.****
>
>
> ****
>
> ---****
>
> Jeremiah Peschka - Founder, Brent Ozar Unlimited****
>
> MCITP: SQL Server 2008, MVP****
>
> Cloudera Certified Developer for Apache Hadoop****
>
> ** **
>
> On Wed, Feb 6, 2013 at 5:32 AM, OJ Reeves <oj at buffered.io> wrote:****
>
> I am not aware of the rules in bucket naming, I don't even know if there
> are any or if they're documented anywhere. All I can say is that I wouldn't
> personally use a forward-slash because it's an obvious conflict with other
> areas of the system.****
>
> ** **
>
> OJ****
>
> On Wed, Feb 6, 2013 at 10:44 PM, Kevin Burton <rkevinburton at charter.net>
> wrote:****
>
> The set properties method returns without error on the "illegally named"
> bucket as do all of the put operations. It is just the get properties
> operation that returns an error. If the bucket is indeed improperly named
> then the bug is in the  operations that allow the bucket name. Right?****
>
>
> On Feb 5, 2013, at 10:44 PM, Alexander Moore <moore.alex at gmail.com> wrote:
> ****
>
> I think the problem you are having here is that you are using an invalid
> bucket name.****
>
> ** **
>
> "buyseasons/products" would actually refer to a bucket/key pair.  Riak
> doesn't have nested buckets.   ****
>
> ** **
>
> If you change your bucket name to "buyseasons-products" or
> "buyseasons%20products" it should work.****
>
> ** **
>
> As for the weird/misleading exception, I'll report it to CorrugatedIron. *
> ***
>
> ** **
>
> Thanks,****
>
> Alex Moore****
>
> ** **
>
> I still have a question. Based on your input I modified the code slightly
> as follows:****
>
>  ****
>
>             RiakBucketProperties bucketProperties = new
> RiakBucketProperties();****
>
>             bucketProperties.SetNVal(4);****
>
>             bucketProperties.SetSearch(true);****
>
>             bucketProperties.SetAllowMultiple(true);****
>
>             bucketProperties.SetWVal("all");****
>
>             bucketProperties.SetRVal("quorum");****
>
>             if (!client.SetBucketProperties("buyseasons/products",
> bucketProperties).IsSuccess)****
>
>             {****
>
>                 Console.WriteLine("Setting bucket properties failed");****
>
>             }****
>
>             RiakResult<RiakBucketProperties> riakBuckpropertiesResult =
> client.GetBucketProperties("buyseasons/products", true);****
>
>  ****
>
> But I get a NullReferenceException****
>
>  ****
>
>   at CorrugatedIron.Models.RiakBucketProperties.ReadQuorum(JObject props,
> String key, Action`1 setter)****
>
>    at CorrugatedIron.Models.RiakBucketProperties..ctor(RiakRestResponse
> response)****
>
>    at CorrugatedIron.RiakClient.GetBucketProperties(String bucket, Boolean
> extended)****
>
> . . . . .****
>
>  ****
>
> So the bucket should have been created when I set the properties. But then
> I tried to read the properties back and I get the exception.****
>
>  ****
>
> *From:* Alexander Sicular [mailto:siculars at gmail.com <siculars at gmail.com>]
>
> *Sent:* Tuesday, February 05, 2013 5:17 PM
> *To:* Kevin Burton
> *Cc:* riak-users
> *Subject:* Re: Bucket creation.****
>
>  ****
>
> "buckets" are a virtual concept. you dont need to "create" them. just
> write a key to any bucket. also by modifying the default bucket parameters,
> by adding the search hook on a bucket, let's say, you are also "creating"
> the bucket.****
>
>  ****
>
> -alexander****
>
>  ****
>
> On Tue, Feb 5, 2013 at 6:09 PM, Kevin Burton <rkevinburton at charter.net>
> wrote:****
>
>  ****
>
> I have filed to find code that would create a bucket. It must be in the
> past I have just put objects into a bucket and Riak must construct the
> bucket if it does not exist. Now I would like to create the bucket and set
> some properties on that bucket. But I don’t know how to create the bucket.
> ****
>
>  ****
>
> So I have code like:****
>
>  ****
>
>                             BuildProduct(source, destination);****
>
>                             RiakObject value = new RiakObject("products",
> keySku, JsonConvert.SerializeObject(destination))****
>
>                                 {****
>
>                                     ContentType = "application/json"****
>
>                                 };****
>
>  ****
>
>                             RiakResult<RiakObject> response =
> client.Put(value, new RiakPutOptions { W = 2 });****
>
>  ****
>
> But I would like to create the bucket and set properties on the bucket
> before I put things into the bucket. Like:****
>
>  ****
>
>             RiakResult<RiakBucketProperties> riakBuckpropertiesResult =
> client.GetBucketProperties("products", true);****
>
>             if (riakBuckpropertiesResult.IsSuccess)****
>
>             {****
>
>                 riakBuckpropertiesResult.Value****
>
> ** **
>
> ** **
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com****
>
>
>
> ****
>
> ** **
>
> --
>
> OJ Reeves****
>
> +61 431 952 586
> http://buffered.io/****
>
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com****
>
> ** **
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20130206/ba7ceb92/attachment.html>


More information about the riak-users mailing list