Exemplo n.º 1
0
        private void SwitchWritePartitionTo(ITransactionContext tx, int partitionID)
        {
            var prevPartitionTx = tx.GetPartitionTx();

            tx.SetCurrentPartition(partitionID);
            tx.AddRef(partitionID);

            if (prevPartitionTx != null)
            {
                // Write append offsets in all the files.
                var pp = GetPartitionByID(tx, prevPartitionTx.PartitionID);
                pp.Commit(tx.GetPartitionTx(prevPartitionTx.PartitionID));

                var deref = tx.Partitions[prevPartitionTx.PartitionID];
                if (deref != null)
                {
                    tx.RemoveRef(prevPartitionTx.PartitionID);
                    pp.SaveConfig(tx);
                }
            }
        }