MySQL can not compete with the likes of Cassandra or MongoDB for speed of writes and there might be a lot of votes... David's idea is to make the vote storage pluggable. I agree. Accidentally, the API documentation happens to contain a sneak preview of the upcoming mongodb_votingapi project ;)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

+1 for the concept. Code looks clean too. Ideally we have one alternate implementation at time of commit but thats not strictly needed.

chx’s picture

Title: Make the vote storage pluggable » Make the vote storage pluggable, fix the test, generate more, foo and bar
FileSize
14.61 KB

Note: tests pass w mongodb and mysql both. Just sayin'

chx’s picture

Ps. do I get the kitten killer award of the month?

David Strauss’s picture

+1 on this to make my Cassandra-based backend easier to integrate.

chx’s picture

The test fixes should be committed separately.

http://www.math.bas.bg/bantchev/place/rpn/rpn.php.html and http://www.math.bas.bg/bantchev/place/rpn/rpn.javascript.html are implementations of a very simple RPN notation in JS and PHP. This means that we could say, supply your ranking algorithm in RPN, the default implementation will iterate over votes and run your algo in PHP and most NoSQL can take the same RPN and run it in their DB w JS. How about that?

chx’s picture

For example, IMDB:

array(
  'reduce' => array('$SUM' => '$SUM this.value +', '$COUNT' => '$COUNT 1 +'),
  'finalize' => '$SUM C M * + $COUNT M + /';
);

Reduce is executed for every vote, finalize at the end.

eaton’s picture

This patch has languished for a while, but with the conversations about Vote module and some of the Butler discussions, I'm cracking my knuckles and revisiting it. Just committed it to the local repo along with the test fixes (because the tests work, yo), and will be pushing it to d.o for a release soon. This pluggable storage will go into the 2.x branch and will probably be the last major feature before cracking open the 3.x branch, which may end up using the Butler project for its storage, vote types, and recalculation mechanisms.

eaton’s picture

Status: Needs review » Fixed

Also, rolling a release.

grendzy’s picture

Status: Fixed » Needs review
FileSize
7.36 KB

This follow-up patch removes tests/votingapi.test.orig.

chx’s picture

If there's interest I would still be glad to code that RPN thingie.

chx’s picture

Assigned: chx » Unassigned
Issue summary: View changes

  • eaton committed ba33c6b on 8.x-3.x
    #803812 by chx - make the VotingAPI vote storage system pluggable. Long...
SocialNicheGuru’s picture

will this be ported to Drupal 7?
The patch in 2 doesn't seem to apply: https://www.drupal.org/node/803812#comment-2995352

pifagor’s picture

The last submitted patch, 2: pluggable_storage.patch, failed testing. View results

  • pifagor committed 8f6a648 on 7.x-2.x
    Issue #803812 by chx, grendzy, eaton, SocialNicheGuru, pifagor, moshe...
pifagor’s picture

Status: Needs review » Fixed

current module version contains the given code

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.