示例#1
0
        private long CommitTimestampUsage()
        {
            LocalTransaction       st = (LocalTransaction)_db.SystemTransaction();
            CommitTimestampSupport commitTimestampSupport = st.CommitTimestampSupport();

            if (commitTimestampSupport == null)
            {
                return(0);
            }
            BTree idToTimestampBtree     = commitTimestampSupport.IdToTimestamp();
            long  idToTimestampBTreeSize = idToTimestampBtree == null ? 0 : BTreeUsage(idToTimestampBtree
                                                                                       );
            BTree timestampToIdBtree     = commitTimestampSupport.TimestampToId();
            long  timestampToIdBTreeSize = timestampToIdBtree == null ? 0 : BTreeUsage(timestampToIdBtree
                                                                                       );

            return(idToTimestampBTreeSize + timestampToIdBTreeSize);
        }
示例#2
0
        public virtual void DefragIdToTimestampBtree()
        {
            if (_sourceDb.SystemData().IdToTimestampIndexId() == 0)
            {
                return;
            }
            LocalTransaction targetTransaction = (LocalTransaction)_targetDb.SystemTransaction
                                                     ();
            LocalTransaction sourceTransaction = (LocalTransaction)_sourceDb.SystemTransaction
                                                     ();
            CommitTimestampSupport target = targetTransaction.CommitTimestampSupport();
            CommitTimestampSupport source = sourceTransaction.CommitTimestampSupport();

            if (source.IdToTimestamp() == null)
            {
                return;
            }
            source.IdToTimestamp().TraverseKeys(sourceTransaction, new _IVisitor4_336(this, target
                                                                                      , targetTransaction));
        }
示例#3
0
        protected virtual void RebuildIndexForWriter(LocalObjectContainer container, StatefulBuffer
                                                     buffer, int objectId)
        {
            ObjectHeader        objectHeader = new ObjectHeader(container, buffer);
            ObjectIdContextImpl context      = new ObjectIdContextImpl(container.SystemTransaction
                                                                           (), buffer, objectHeader, objectId);
            ClassMetadata classMetadata = context.ClassMetadata();

            if (classMetadata.IsStruct())
            {
                // We don't keep version information for structs.
                return;
            }
            if (classMetadata.SeekToField(container.SystemTransaction(), buffer, versionFieldMetadata
                                          ) != HandlerVersion.Invalid)
            {
                long version = ((long)versionFieldMetadata.Read(context));
                if (version != 0)
                {
                    LocalTransaction t = (LocalTransaction)container.SystemTransaction();
                    t.CommitTimestampSupport().Put(container.SystemTransaction(), objectId, version);
                }
            }
        }