This repository contains an implementation of Epoxy (VLDB 23), a protocol for providing transactions across heterogeneous data stores. We use Epoxy to allow Apiary functions to transactionally call functions accessing data stores.
For example, the first function performs a write in Postgres, then transactionally calls another function performing a write in Mongo, executing both writes in the same transaction:
public class PostgresAddHotel extends PostgresFunction {
private static final String insert = "INSERT INTO HotelsTable(HotelID, HotelName, AvailableRooms) VALUES (?, ?, ?);";
public static int PostgresAddHotel(PostgresContext ctxt, int hotelID, String hotelName, int numRooms, int longitude, int latitude)throws Exception {
ctxt.executeUpdate(insert, hotelID, hotelName, numRooms);
ctxt.apiaryCallFunction("MongoAddHotel", hotelID, longitude, latitude);
return hotelID;
}
}
public class MongoAddHotel extends MongoFunction {
public int runFunction(MongoContext context, int hotelID, int longitude, int latitude) throws PSQLException {
Document hotel = new Document("hotelID", hotelID).append("point", new Point(new Position(longitude, latitude)));
context.insertOne("hotels", hotel, Integer.toString(hotelID));
return hotelID;
}
}
Source code for the transaction coordinator (using Postgres as the primary database) is here and here. Source code for the shims is here for GCS, here for MongoDB, here for Elasticsearch, and here for MySQL.
Experiments for the paper were run in this branch. Code for the benchmarks can be found here. The procedures called by the benchmarks are here.