-
Notifications
You must be signed in to change notification settings - Fork 19
Description
I got hbase.exceptions.RequestError: Failed to get region exception when tried to do get operation from the table located in the default namespace.
Here is my code:
with hbase.ConnectionPool(zk).connect() as conn:
table = conn['default']['table_name']
row = table.get('row1')
print(row)
exit()
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1664, in
main()
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1068, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/nazarii/PycharmProjects/smartness/scripts/hbase/hbase_test.py", line 25, in
main()
File "/Users/nazarii/PycharmProjects/smartness/scripts/hbase/hbase_test.py", line 17, in main
row = table.get('ts/github/82270896/1487289600000')
File "/Users/nazarii/PycharmProjects/untitled/venv/lib/python3.7/site-packages/hbase/table.py", line 117, in get
return self._client.get(self.full_name, key, columns, filter)
File "/Users/nazarii/PycharmProjects/untitled/venv/lib/python3.7/site-packages/hbase/client/client.py", line 753, in get
region = self._region_manager.get_region(table, key)
File "/Users/nazarii/PycharmProjects/untitled/venv/lib/python3.7/site-packages/hbase/client/region.py", line 202, in get_region
'Failed to get region.'
hbase.exceptions.RequestError: Failed to get region.
I did further investigation and find the reason.
When this function is called
hbase-python/hbase/client/region.py
Line 247 in 4230091
| def _region_lookup(self, meta_key): |
We have meta_key = 'default:table_name,row1,:'
Change that to the meta_key = 'table_name,row1,:' fixes the issue.
So HBase API does expect only table_name for the default namespace and default:table_name is not valid.
I would suggest fixing that. I can do that myself and open PR if you agree to change the way the meta_key is formed.