manticoresoftware / manticoresearch

Easy to use open source fast database for search | Good alternative to Elasticsearch now | Drop-in replacement for E in the ELK soon
https://manticoresearch.com
GNU General Public License v3.0
9.07k stars 509 forks source link

SELECT uuid_short() for ID generation #2752

Closed donhardman closed 1 week ago

donhardman commented 1 week ago

Proposal:

We need a method to generate and return IDs in the same way Manticore Search does it currently.

The following query:

SELECT uuid_short()

Should return the next ID to insert, similar to how we do it with an INSERT statement in an atomic way.

Checklist:

To be completed by the assignee. Check off tasks that have been completed or are not applicable.

- [x] Implementation completed - [x] Tests developed - [x] Documentation updated - [x] Documentation reviewed - [x] [Changelog](https://docs.google.com/spreadsheets/d/1mz_3dRWKs86FjRF7EIZUziUDK_2Hvhd97G0pLpxo05s/edit?pli=1&gid=1102439133#gid=1102439133) updated - [x] OpenAPI YAML updated and issue created to rebuild clients
tomatolog commented 1 week ago

not quite clear - should the call to SELECT uuid_short() increase the id for auto-id ?

ie select list expression uuid_short should use the same generator auto-id uses or should use its own independent generator?

sanikolaev commented 1 week ago

should the call to SELECT uuid_short() increase the id for auto-id ?

Yes.

tomatolog commented 1 week ago

added uuid_short to select list expression at https://github.com/manticoresoftware/manticoresearch/commit/e2c80bb93e45a9f9f5ff30dc37b8d0cec3af43ed

at the dev discussion decided to not document it

sanikolaev commented 1 week ago

Documented in 287c5ef8fbc02a121840e1873ac6e955aa62f6b5