allocate_ids() problem

Asked by David Shifflett

I am trying to use db.allocate_ids(key, count) in my app.

I am seeing two problems:
1. The tuple returned always has start and end equal
2. The allocation doesn't work correctly for 'count' values above 10,
   it never allocates more than 10 (ID_BLOCK value in zktransaction.py)

Digging a little deeper I see some comments in allocate_ids_request()
that mention 'assigning just one key'.
By 'key' does this really mean ID?

Why does allocate_ids_request() treat the 'size' in the request
as a 'highest_key'?

Are the lines:
> response.set_start(uid)
> response.set_end(uid)
intentional (see problem 1 above)

Thanks for any light you can shed on this function / feature / bug.

dave

Question information

Language:
English Edit question
Status:
Solved
For:
AppScale Edit question
Assignee:
No assignee Edit question
Solved by:
David Shifflett
Solved:
Last query:
Last reply:
Revision history for this message
Navraj Chohan (nchohan) said :
#1

Hi David,
The allocate_ids function was written to only allocate one id at a time. It's a limitation that I'm addressing in the next version of the database server, but for now it only returns one id at a time. One possible fix is to make the ID_BLOCK larger, but we still need to handle the case where you may request a number of ids that spans multiple ID_BLOCK sizes.

Revision history for this message
David Shifflett (shifflettd) said :
#2

Thanks for the info.
For now I won't rely on more than 1 ID at a time being allocated.