UtfCube / buddy-plugin-update-text

pluggin for update full-text fields in update query
GNU General Public License v2.0
0 stars 1 forks source link

Testing the initial version #1

Open sanikolaev opened 1 year ago

sanikolaev commented 1 year ago

update t set f='def' where id = 1 fails like this:

MySQL [(none)]> drop table if exists t; create table t(f text); insert into t values(1, 'abc'); select * from t; update t set f='def' where id = 1; select * from t;
--------------
drop table if exists t
--------------

Query OK, 0 rows affected (0.03 sec)

--------------
create table t(f text)
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
insert into t values(1, 'abc')
--------------

Query OK, 1 row affected (0.01 sec)

--------------
select * from t
--------------

+------+------+
| id   | f    |
+------+------+
|    1 | abc  |
+------+------+
1 row in set (0.00 sec)

--------------
update t set f='def' where id = 1
--------------

ERROR 1064 (42000): parallel\Runtime\Type\Unavailable::Manticoresearch\Buddy\Plugin\UpdateText\{closure}(): Argument #1 ($handler) must be of type Manticoresearch\Buddy\Plugin\UpdateText\Payload, parallel\Runtime\Type\Unavailable given, called in /usr/share/manticore/modules/manticore-buddy/vendor/manticoresoftware/buddy-core/src/Task/Task.php on line 231

How to reproduce:

Install the plugin:

[root@7374ff4bb9f4 /]# mysql -P9306 -h0 -v
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 50
Server version: 6.0.5 52403c899@230529 dev (columnar 2.0.5 d593e0d@230529) (secondary 2.0.5 d593e0d@230529) git branch HEAD (no branch)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Reading history-file /root/.mysql_history
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> create plugin utfcube/buddy-plugin-update-text type 'buddy' version 'dev-main';

Make sure the plugin is installed:

MySQL [(none)]> show buddy plugins;
--------------
show buddy plugins
--------------

+------------------------------------------------+-----------------+----------+----------+
| Package                                        | Plugin          | Version  | Type     |
+------------------------------------------------+-----------------+----------+----------+
| manticoresoftware/buddy-plugin-empty-string    | empty-string    | dev-main | core     |
| manticoresoftware/buddy-plugin-backup          | backup          | dev-main | core     |
| manticoresoftware/buddy-plugin-emulate-elastic | emulate-elastic | dev-main | core     |
| manticoresoftware/buddy-plugin-insert          | insert          | dev-main | core     |
| manticoresoftware/buddy-plugin-lock-tables     | lock-tables     | dev-main | core     |
| manticoresoftware/buddy-plugin-unlock-tables   | unlock-tables   | dev-main | core     |
| manticoresoftware/buddy-plugin-select          | select          | dev-main | core     |
| manticoresoftware/buddy-plugin-show            | show            | dev-main | core     |
| manticoresoftware/buddy-plugin-cli-table       | cli-table       | dev-main | core     |
| manticoresoftware/buddy-plugin-plugin          | plugin          | dev-main | core     |
| manticoresoftware/buddy-plugin-test            | test            | dev-main | core     |
| manticoresoftware/buddy-plugin-insert-mva      | insert-mva      | dev-main | core     |
| utfcube/buddy-plugin-update-text               | update-text     | dev-main | external |
+------------------------------------------------+-----------------+----------+----------+
13 rows in set (0.01 sec)

Then execute the above.

UtfCube commented 1 year ago

@sanikolaev I reproduced it, but if I install plugin locally from source, it works, can you help me find the problem? I don't know what happens after installing the plugin via

create plugin utfcube/buddy-plugin-update-text type 'buddy' version 'dev-main';

In buddy logs I got

[BUDDY] New connection from tcp://127.0.0.1:60356
[BUDDY] [8_2270883554] request data: {"type":"unknown sql request","error":"P01: syntax error, unexpected identifier, expecting VARIABLES near 'buddy plugins'","version":1,"user":"root","message":{"path_query":"","body":"show buddy plugins"}}
[BUDDY] [8_2270883554] Plugin: Plugin
[BUDDY] metric: add ["plugin",1]
[BUDDY] [8_2270883554] Plugin payload: 
[BUDDY] [8_2270883554]  response data: {"version":1,"type":"sql response","message":[{"total":13,"error":"","warning":"","columns":[{"Package":{"type":"string"}},{"Plugin":{"type":"string"}},{"Version":{"type":"string"}},{"Type":{"type":"string"}}],"data":[{"Package":"manticoresoftware\/buddy-plugin-empty-string","Plugin":"empty-string","Version":"dev-main","Type":"core"},{"Package":"manticoresoftware\/buddy-plugin-backup","Plugin":"backup","Version":"dev-main","Type":"core"},{"Package":"manticoresoftware\/buddy-plugin-emulate-elastic","Plugin":"emulate-elastic","Version":"dev-main","Type":"core"},{"Package":"manticoresoftware\/buddy-plugin-insert","Plugin":"insert","Version":"dev-main","Type":"core"},{"Package":"manticoresoftware\/buddy-plugin-lock-tables","Plugin":"lock-tables","Version":"dev-main","Type":"core"},{"Package":"manticoresoftware\/buddy-plugin-unlock-tables","Plugin":"unlock-tables","Version":"dev-main","Type":"core"},{"Package":"manticoresoftware\/budd
[BUDDY] [8_2270883554] process time: 13082µs
UtfCube commented 1 year ago

btw how can I delete plugin after install it via CREATE command? This doesn't work:

DROP PLUGIN utfcube/buddy-plugin-update-text type 'buddy';
sanikolaev commented 1 year ago

if I install plugin locally from source, it works, can you help me find the problem?

Calling @donhardman

sanikolaev commented 1 year ago

btw how can I delete plugin after install it via CREATE command? This doesn't work:

Please try this:

https://manual.manticoresearch.com/dev/Extensions/UDFs_and_Plugins/Plugins/Deleting_a_plugin#DELETE-BUDDY-PLUGIN

UtfCube commented 1 year ago

btw how can I delete plugin after install it via CREATE command? This doesn't work:

Please try this:

https://manual.manticoresearch.com/dev/Extensions/UDFs_and_Plugins/Plugins/Deleting_a_plugin#DELETE-BUDDY-PLUGIN

it works, thanks

donhardman commented 1 year ago

We have special bin tools that are already available in this GitHub repository. I highly recommend using them to validate the code.

  1. bin/codestyle – Validates adherence to our style guide; for external plugins, it's optional but recommended.
  2. bin/codeanalyze – An important validator that uses PHPStan to check for various errors (I manually checked the code, and this tool will likely show things that are crucial to fix first).
  3. bin/codestyle-fix – A small helper to fix issues from 1.

It's also possible to install all of these on git commit as a hook by using pre-commit install.

All these tools are installed into CI, so you can view the results of their executions here – https://github.com/UtfCube/buddy-plugin-update-text/actions

The most important one is codeanalyze, which can show critical errors in the code.

sanikolaev commented 1 year ago

if I install plugin locally from source, it works, can you help me find the problem?

Perhaps caused by a dependency in the plugin and may be an issue in Buddy itself. We'll look into that.

UtfCube commented 1 year ago

@sanikolaev did something clear up?

if I install plugin locally from source, it works, can you help me find the problem?

Perhaps caused by a dependency in the plugin and may be an issue in Buddy itself. We'll look into that.

sanikolaev commented 1 year ago

@UtfCube we are still working on improving it.

UtfCube commented 1 year ago

@UtfCube we are still working on improving it.

Thanks, i really appreciate it

donhardman commented 1 year ago

Hello.

We have resolved the issue in the latest version, and it is available to try from the repositories. You can find the pull request here: https://github.com/manticoresoftware/manticoresearch-buddy/pull/142

We are currently working on the final touches, and it will likely be merged into the main branch soon.

Please test this version of the code and let us know if it works or not.

sanikolaev commented 1 year ago

I can't reproduce the issue with the new version anymore.

sanikolaev commented 1 year ago

@UtfCube Hi

Please test this version of the code and let us know if it works or not

Is there any news on this?