microsoft / VSLinux

VS extension for C++ Linux development
205 stars 34 forks source link

Replication of Prepared Transactions in TransactionDB WriteCommitted #352

Closed phoenixchinar closed 6 years ago

phoenixchinar commented 6 years ago

I am using rocksdb::TransactionDB with WRITE_COMMITTED policy for my datastore. I am using GetUpdatesSince API for replication between a master and slave. What it looks like is that transactions that are not yet committed, the information is not getting returned using GetUpdatesSince. Due to this even though a transaction has been prepared, it cannot be seen on the slave.

This creates challenges when the DB is being used in a 2 phase commit. The master acknowledges back to the transaction coordinator during the prepare phase (after ensuring that slave(s) is/are also up to date with the latest sequence so far). However, the commit cannot go ahead anymore if for any reason master crashes and a slave is promoted to master. The expectation would have been that Slave would have the same state as the Master, and the commit would then go ahead on the Slave (which would have assumed the role of the master).

Is there an option that I am missing or is this use case not supported.

    rocksdb::Options options;
    options.create_if_missing = true;
    options.allow_2pc = true;
    options.two_write_queues = true;
    options.WAL_ttl_seconds = 86400;
    options.table_factory.reset(rocksdb::NewBlockBasedTableFactory(blockBasedTableOptions));
    rocksdb::TransactionDBOptions tOptions;
    tOptions.write_policy = rocksdb::TxnDBWritePolicy::WRITE_COMMITTED;
    auto status = rocksdb::TransactionDB::Open(options, tOptions, path, &db);
    CHECK(status.ok());
phoenixchinar commented 6 years ago

Incorrectly opened the issue against Microsoft/VSLinux. Closing the issue here.

itodirel commented 4 years ago

We retired this issue list, here on Github. We now adopted and using the Developer Community (https://developercommunity.visualstudio.com/spaces/62/index.html), for Cross Plat and Linux experiences (and C++ all up generally), which we are actively monitoring. Please use the Developer Community, to report issues or suggestions for bugs or new experiences. Further discussions on this thread here on Github might be unmonitored. If there is further comments or context in this current issue, please create a new issue on the Developer Community and mention it there.