It is possible use Sphinx RT index in conjunction with Mysql innodb table for transaction support?
For example I have a table products in mysql and I build a real time index in Sphinx for full text search. When a product row is update in mysql, I want that in real time also index in Sphinx must be update,in order to have immediately full text search on update product, but all in consistency way.
If product row update fails or real time index update fails all must rollback to avoid inconsistency. It is possible? How can I obtain this?
Yes it is possible, but it has some quirks. Sphinx has support for transaction (begin / statement / (commit, rollback)) but it is limited to a single real time index. This means that, if you want to write to multiple indexes in a single transaction it won’t work.
Say you have the following mysql tables and sphinx real time indexes with a direct corespondence between them:
in mysql it’s easy to write to both tables in a single transaction:
but if you want to do the same with sphinx, it will fail:
in sphinx you can only work with a single index at a time:
And this sucks!!! It’s fine for single index application, but for other cases you have to emulate transaction with php or whatever you’r using.