yinhm / friendfeed

A FriendFeed Clone
26 stars 7 forks source link

BackwardFetchFeed not working as expected #1

Open yinhm opened 9 years ago

yinhm commented 9 years ago

rocksdb default to prefixed seek:

The docs[2] says: "If there is one or more keys in the database matching prefix of lookup_key, RocksDB will place the iterator to the key equal or larger than lookup_key of the same prefix, as for total ordering mode."

So we manually place a fixed max key for each use entry index:

       MaxFlakeId = flake.Id{
               0xFF, 0xFF, 0xFF, 0xFF,
               0xFF, 0xFF, 0xFF, 0xFF,
               0xFF, 0xFF, 0xFF, 0xFF,
               0xFF, 0xFF, 0xFF, 0xFF,
       }

Unfortunately this does not work as expected, so we build another Index: TableReverseEntryIndex, which just use a fixed MaxFlakeTime subtract current time as reversed time. Then use forward seek, this does work.

Remove TableEntryIndex and BackwardFetchFeed until this resolved.

Refs issues : https://github.com/tecbot/gorocksdb/issues/24 https://github.com/facebook/rocksdb/issues/548