[ 
https://issues.apache.org/jira/browse/HBASE-29457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18017090#comment-18017090
 ] 

Kevin Geiszler edited comment on HBASE-29457 at 8/29/25 6:12 PM:
-----------------------------------------------------------------

I have run into an issue that I can't get past while trying to fix this script. 
 So far, I have changes string values to bytes, and now the script will run to 
some degree. Now, the script will fail when it gets to a part where it 
iteratively performs the same operations on a list of rows. For example, the 
script will start at Row 100, perform some mutations, and retrieve the rows.  
It will do the same with Row 99, Row 98, etc. The script is failing when trying 
to retrieve a data for a row, and it fails for a different row each time. 
Adding a sleep helps, but that usually just delays the error rather than 
prevent it. I also tried adding a retry mechanism, but that doesn't seem to do 
anything. Does anyone have any ideas about why this error is occurring?

Some info on how to reproduce the issue:

My branch is at: 
[https://github.com/kgeisz/hbase/tree/HBASE-29457-thrift1-democlient-py]

Here is a diff of the commits I have so far (including debug messages): 
[https://github.com/apache/hbase/compare/master...kgeisz:hbase:HBASE-29457-thrift1-democlient-py]
 

My debug messages have "kevin:..."

To run the script, first start hbase and thrift:
{code:java}
cd hbase
bin/start-hbase.sh
bin/hbase thrift start {code}
In another window, create a python environment, install thrift, and run the 
script with the default host and port for thrift:
{code:java}
cd hbase
python -m venv py-env
source py-env/bin/activate
pip3 install thrift
python3 hbase-examples/src/main/python/thrift1/DemoClient.py localhost 9090 
{code}
I have attached the script's output and the thrift output. I reproduced this 
error with Python 3.11.12.


was (Author: JIRAUSER302671):
I have run into an issue that I can't get past while trying to fix this script. 
 So far, I have changes string values to bytes, and now the script will run to 
some degree. Now, the script will fail when it gets to a part where it 
iteratively performs the same operations on a list of rows. For example, the 
script will start at Row 100, perform some mutations, and retrieve the rows.  
It will do the same with Row 99, Row 98, etc. The script is failing when trying 
to retrieve a data for a row, and it fails for a different row each time. 
Adding a sleep helps, but that usually just delays the error rather than 
prevent it. I also tried adding a retry mechanism, but that doesn't seem to do 
anything. Does anyone have any ideas about why this error is occurring?

Some info on how to reproduce the issue:

My branch is at: 
[https://github.com/kgeisz/hbase/tree/HBASE-29457-thrift1-democlient-py]

Here is a diff of the commits I have so far (including debug messages): 
[https://github.com/apache/hbase/compare/master...kgeisz:hbase:HBASE-29457-thrift1-democlient-py]
 

My debug messages have "kevin:..."

To run the script, first start hbase and thrift:
{code:java}
cd hbase
bin/start-hbase.sh
bin/hbase thrift start {code}
In another window, create a python environment, install thrift, and run the 
script with the default host and port for thrift:
{code:java}
cd hbase
python -m venv py-env
source py-env/bin/activate
pip3 install thrift
python3 hbase-examples/src/main/python/thrift1/DemoClient.py localhost 9090 
{code}
I have attached the script's output and the thrift output. 

> thrift1/DemoClient.py is not running
> ------------------------------------
>
>                 Key: HBASE-29457
>                 URL: https://issues.apache.org/jira/browse/HBASE-29457
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Kevin Geiszler
>            Assignee: Kevin Geiszler
>            Priority: Minor
>         Attachments: democlient-output.txt, thrift-output.txt
>
>
> HBASE-29454 converts the following scripts from Python 2 to Python 3 and 
> fixes some import errors:
> {code:java}
> hbase-examples/src/main/python/thrift1/DemoClient.py
> hbase-examples/src/main/python/thrift1/demo_hbase_thrift_over_http_tls.py
> hbase-examples/src/main/python/thrift2/DemoClient.py
> {code}
> After these changes, the thrift1/DemoClient.py script gets the following 
> error when trying to run it:
> {code:java}
> % bin/start-hbase.sh
> % bin/hbase thrift start
> # Separate Terminal window
> % python3 hbase-examples/src/main/python/thrift1/DemoClient.py localhost 9090
> scanning tables...
>   found: b'kg_table'
>   found: b'kg_table2'
>   found: b'kg_table3'
>   found: b't1'
>   found: b'test'
> creating table: demo_table
> Traceback (most recent call last):
>   File 
> "/Users/kgeiszler/projects/hbase/hbase-examples/src/main/python/thrift1/DemoClient.py",
>  line 212, in <module>
>     demo_client(host, port, is_framed_transport)
>   File 
> "/Users/kgeiszler/projects/hbase/hbase-examples/src/main/python/thrift1/DemoClient.py",
>  line 92, in demo_client
>     client.createTable(t, columns)
>   File 
> "/Users/kgeiszler/projects/hbase/hbase-examples/src/main/python/thrift1/gen_py/hbase/Hbase.py",
>  line 988, in createTable
>     self.send_createTable(tableName, columnFamilies)
>   File 
> "/Users/kgeiszler/projects/hbase/hbase-examples/src/main/python/thrift1/gen_py/hbase/Hbase.py",
>  line 996, in send_createTable
>     args.write(self._oprot)
>   File 
> "/Users/kgeiszler/projects/hbase/hbase-examples/src/main/python/thrift1/gen_py/hbase/Hbase.py",
>  line 4973, in write
>     oprot.writeBinary(self.tableName)
>   File 
> "/Users/kgeiszler/projects/hbase/py-env/lib/python3.11/site-packages/thrift/protocol/TBinaryProtocol.py",
>  line 132, in writeBinary
>     self.trans.write(str)
>   File 
> "/Users/kgeiszler/projects/hbase/py-env/lib/python3.11/site-packages/thrift/transport/TTransport.py",
>  line 174, in write
>     raise e
>   File 
> "/Users/kgeiszler/projects/hbase/py-env/lib/python3.11/site-packages/thrift/transport/TTransport.py",
>  line 170, in write
>     self.__wbuf.write(buf)
> TypeError: a bytes-like object is required, not 'str'{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to