Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi backend not returning "indexes_not_supported" when expected [JIRA: RIAK-2360] #1329

Closed
lukebakken opened this issue Jan 22, 2016 · 8 comments

Comments

@lukebakken
Copy link
Contributor

Riak 2.1.3 devrel, built with Erlang basho/otp OTP_R16B02_basho10rc2

Following the examples here: http://docs.basho.com/riak/latest/dev/using/2i/#Examples

Reproduction script is attached: test-2i.txt

Please create a bucket type named people using the leveldb backend (or use leveldb as the default Riak backend)

Output:

$ ./test-2i
SHOULD ONLY RETURN LARRY:
{"keys":["veronica","curly","larry","moe"]}
SHOULD ONLY RETURN VERONICA:
{"keys":["veronica","moe","curly","larry"]}

Output when using a bucket type configured to use the memory backend:

$ ./test-2i.txt
SHOULD ONLY RETURN LARRY:
{"keys":["larry"]}
SHOULD ONLY RETURN VERONICA:
{"keys":["veronica"]}
@lukebakken lukebakken added the Bug label Jan 22, 2016
@Basho-JIRA Basho-JIRA changed the title Exact match 2i query is not working Exact match 2i query is not working [JIRA: RIAK-2360] Jan 22, 2016
@lukebakken
Copy link
Contributor Author

@JeetKunDoug @jonmeredith - This only happens when typed buckets are used. I just added basho/riak_test#981 to begin adding tests. I added a test that does not use types, and will add typed tests going forward.

@hazen
Copy link

hazen commented Jan 26, 2016

@lukebakken I'm assuming this problem exists back in 2.0, right? I assume we'll want this for the next 2.0 release then, too, @JeetKunDoug? Just making sure the fix lands in the right place.

@lukebakken
Copy link
Contributor Author

@JeetKunDoug @javajolt - this gets even more interesting. I just ran test-2i against the devrel set up via riak_test and the script ran fine. The default backend for the devrel was eleveldb, as opposed to the multi backend I have been using. I am going to set up 2.1.3 with eleveldb as the default to see what happens.

@JeetKunDoug
Copy link
Contributor

Hrm - so perhaps the multi-backend is the real culprit... interesting. Thank you for continuing to try to figure this out.

@lukebakken
Copy link
Contributor Author

OK it gets even better.

  • Originally, I used this script to set up bucket types for the Riak Docs code examples I was working on.
  • While working on this code example I noticed that I would get multiple keys back, which prompted me to write the test-2i script I have attached here.
  • When I set up riak_test to run the 2i and bucket_type tests, I configured Riak to use eleveldb as the default backend, and everything works, even test-2i
  • I just now set up my 2.1.3 cluster to use eleveldb as the default backend, and test-2i runs successfully.
  • You'll notice in the setup-examples script that the indexes type is not set to use eleveldb as the backend. AHA, that oversight is what lead to this entire thing. BUT, when you try to index an object via a backend that does not support it, you are supposed to get an error from Riak. In my case, the objects saved to the indexes type just fine with secondary index metadata. There is still something going on, but not as serious as I thought.

@lukebakken
Copy link
Contributor Author

If I have my cluster set to use bitcask as the default backend, and try to store an object with index data, I get this error, which is expected:

RiakError|0|{error,{indexes_not_supported,riak_kv_bitcask_backend}}

If I use multi backend with bitcask as the default, and save the same objects with index data to a type that is using the default backend, I do not get the same error.

@lukebakken lukebakken changed the title Exact match 2i query is not working [JIRA: RIAK-2360] Multi backend not returning "indexes_not_supported" when expected [JIRA: RIAK-2360] Jan 27, 2016
@lukebakken lukebakken closed this as not planned Won't fix, can't repro, duplicate, stale Feb 23, 2023
@ngthtuyen9823
Copy link

Screenshot 2024-05-10 115752
I got this error when I run this code:
import riak
import time

start_time = time.time()

client = riak.RiakClient(protocol='http', host='192.168.222.101', http_port=8098)
bucket = client.bucket('posts')

resultsAll = client.index('posts', 'all_int', 1).run()

results = client.index('posts', 'friends_count_int', 400, 250).run()

count = 0
for key in results:
count += 1
print(bucket.get(key).data["user_name"])

print(".........................................................................")
print("Total:" + str(len(resultsAll)))
print("Match: " + str(len(results)))
print("Time: " + str((time.time() - start_time)))

from https://github.com/MuhtasimTanmoy/Riak-Twitter-Dataset-Benchmark/tree/master
Can someone help me with the explanation? I'm completely new to Riak, and I have to work with Riak for my final assignment at university.

@martinsumner
Copy link
Contributor

Riak supports multiple backends, some of which support indexes, some don't. The (default) bitcask backend doesn't support indexes. If you want to support indexes, you should start Riak with the leveled or eleveldb backends using the storage_backend setting in riak.conf.

The old documentation gives some further advice (https://docs.riak.com/riak/kv/2.2.3/setup/planning/backend.1.html), though the docs don't cover the leveled backend which was implemented more recently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants