[ 
https://issues.apache.org/jira/browse/SAMZA-402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14135743#comment-14135743
 ] 

Chris Riccomini commented on SAMZA-402:
---------------------------------------

bq. Do we plan to provide an mechanism to really guarantee "read-only"? 

I don't think so. I was thinking we'd just have the read-only store not have a 
put() method (i.e. it wouldn't be a KeyValueStore, it'd be a 
ReadOnlyKeyValueStore, or something).

bq. Since the state stream actually can be updated even by the same Samza job. 
It's more like "write" is discouraged. It maybe related to what Martin brings 
up in Samza-300 , some lock-like stuff.

You're correct. It's more like "write is discouraged". There's really no good 
way for us to prevent writes to the changelog (that I can think of). 
Personally, I think this is OK.

bq. How do we localize the "global state"? Not sure if we leave this to the 
users or we do this job.

This was discussed a bit in SAMZA-353. In the current proposal, the 
SamzaContainer will be responsible for localizing the global state (not hte 
StreamTask). The StreamTask will get the global state store using the 
TaskContext, as with any other store, and will call .get() on it, as usual 
(assuming it's a KeyValueStore).

bq. Putting the global state to the local state store seems better than putting 
to HashMap.

Agreed. The current proposal is to have the SamzaContainer put the global state 
into a local state store (shared among StreamTasks, one per-container).

bq. But then it will requires the "global key" to be different from any 
"local-key". Otherwise, it will be occasionally overridden by local operations.

I think we'd just have two stores in this scenario:

{code}
def init(...) {
  val localStore = 
context.getStore("my-local-store").asInstanceOf[KeyValueStore]
  val globalStore = 
context.getStore("my-global-store").asInstanceOf[ReadOnlyKeyValueStore]
}
{code}

> Provide a "shared state" store among StreamTasks
> ------------------------------------------------
>
>                 Key: SAMZA-402
>                 URL: https://issues.apache.org/jira/browse/SAMZA-402
>             Project: Samza
>          Issue Type: Bug
>          Components: container, kv
>    Affects Versions: 0.8.0
>            Reporter: Chris Riccomini
>              Labels: design, project
>         Attachments: DESIGN-SAMZA-402-0.md, DESIGN-SAMZA-402-0.pdf, 
> DESIGN-SAMZA-402-1.md, DESIGN-SAMZA-402-1.pdf
>
>
> There has been a lot of discussion about shared state stores in SAMZA-353. 
> Initially, it seemed as though we might implement them through SAMZA-353, but 
> now it seems more preferable to implement them separately. As such, this 
> ticket is to discuss global state/shared state (terms that are being used 
> interchangeably) between StreamTasks.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to