Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lastAccessTable in WARcLastAccessExpiryPolicy can get out of synch with WACache tables during WACache>>gemstoneReap #68

Open
dalehenrich opened this issue Apr 6, 2015 · 0 comments

Comments

@dalehenrich
Copy link
Member

Here's a link to the characterization of the bug and here's my proposed bugfixes.

WARcLastAccessExpiryPolicy>>isExpired:key:

isExpired: anObject key: aString
  | entry |
  entry := lastAccessTable at: aString ifAbsent: [^true ].
  ^ entry isExpired: self timeout

WARcLastAccessExpiryPolicy>>isExpiredUpdating:key:

isExpiredUpdating: anObject key: aString
  | entry |
  entry := lastAccessTable at: aString ifAbsent: [ ^true ].
  ^ entry isExpiredUpdating: self timeout

WACache>>gemstoneReap

gemstoneReap
  "Iterate through the cache and remove objects that have expired."

  "In GemStone, this method is performed by a separate maintenance VM, 
     so we are already in transaction (assumed to be running in #autoBegin 
     transactionMode) and do not have to worry about acquiring the TransactionMutex.
    Since we are using reducedConflict dictionaries in the first place, we will remove the keys
    and values from the existing dictionaries without using the mutex."

  | expired count platform |
  expired := OrderedCollection new.
  objectsByKey
    associationsDo: [ :assoc | 
      (self expiryPolicy isExpiredUpdating: assoc value key: assoc key)
        ifTrue: [ 
          expired add: assoc ] ].
  count := 0.
  platform := GRPlatform current.
  expired
    do: [ :assoc | 
      count := count + 1.
      self notifyRemoved: assoc value key: assoc key.
      objectsByKey removeKey: assoc key.
      keysByObject removeKey: assoc value ifAbsent: [  ].
      count \\ 100 == 0
        ifTrue: [ platform doCommitTransaction ] ].
  count ~~ 0
    ifTrue: [ platform doCommitTransaction ].
  ^ expired size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant