knizhnik / imcs

In-Memory Columnar Store extension for PostgreSQL
Apache License 2.0
203 stars 33 forks source link

feature request: function to get the initialize state of a cs #8

Closed amutu closed 10 years ago

amutu commented 10 years ago

it is usefull when server is restart.We can tell the client there is some problems and visit later instead of let the client waiting for the autoload a long time

imcs is powerfull,though there is some tiny problems.thanks very much!

knizhnik commented 10 years ago

There is columnar_store_initialized function but it is private: it is called from XXX_load() function where XXX is name of the table. My intention was that user will call XXX_load() to load data in columnar store. If store was already initialized then load function does nothing. So it is safe to call this function multiple times. And if it is not called, then data will be automatically loaded once columnar store is accessed first time. So I wonder do you really need function just to perform checking whether columnar store was initialized or not. What you will do if you find out that it was not initialized? Load data in it? So code will look something like this:

if (not Quote_is_initialized()) then Quote_load(); end if;

But actually such check is not needed. You can just call Quote_load(). Please let me know if you really need XXX_is_inialized() function.

amutu commented 10 years ago

Thanks for your explain! My use case is: The client send queries to db,the backend must return as soon as possible,either successfuly or failed.the client have no responsibility of load data,the data is loaded by some background server.And I think it is not a good user experience for user when the cs is not initialized.

So,if we have XXX_is_inialized(),client will query the state of the cs,then judge if send the query,or tell the user come back some time later. Or we have extra argument for XXX_get(), for example ,a boolean flag to tell the XXX_get() return error immediately when the cs is not inialized.

I think it is not a good idea to mix up the user usage and system operation.

knizhnik commented 10 years ago

I have added XXX_is_loaded() function