Ndb strong consistency and frequent recordings

I am trying to achieve strong consistency with ndb using python. And it seems that I'm missing something, as my readings behave as if they do not correspond to each other.

Inquiry:

links = Link.query(ancestor=lead_key).filter(Link.last_status == 
None).fetch(keys_only=True)

if links: 
    do_action() 

Key structure:

Lead root (generic key) -> Lead -> Website (one per lead) -> Link

I have many tasks that are executed simultaneously using TaskQueue, and this query is executed at the end of each task. Sometimes I get an “too many conflicts” exception when updating a field last_status, but I communicate with it through attempts. Can it break strong coherence?

The expected behavior is caused do_action()when there are no links left with last_statusequal None. Actual behavior is inconsistent: sometimes it do_action()is called twice, and sometimes it is not called at all.

0
3

: . - . Sharding Counters . , , , - .

+1

, , .

, , , .

, , , ( , ), . too much contention , . , !

: , , GAE !

, , , . , , , do_action(), .

, , / ( ). , ( ), , . , , , . :)

+1

, , .

, do_action - Link, , last_status.

, , ( ) , Link ( , ).

, , , , . , - (, http- ), HTTP- , .

0
source

Source: https://habr.com/ru/post/1677426/


All Articles