Ejemplo n.º 1
0
 protected internal override void AddTypeSpecificDetails(StringJoiner joiner, GenericKey state)
 {
     joiner.add("long0=" + state.Long0);
     joiner.add("long1=" + state.Long1);
     joiner.add("long2=" + state.Long2);
     joiner.add("long3=" + state.Long3);
 }
Ejemplo n.º 2
0
        public override string ToString()
        {
            StringJoiner joiner = new StringJoiner(", ", "CleanupJob(", ")");

            joiner.add("file=" + _indexFile.AbsolutePath);
            joiner.add("needed=" + _needed);
            joiner.add("failure=" + (_failure == null ? null : _failure.ToString()));
            return(joiner.ToString());
        }
Ejemplo n.º 3
0
 protected internal override void AddTypeSpecificDetails(StringJoiner joiner, GenericKey state)
 {
     joiner.add("long1=" + state.Long1);
     joiner.add("long2=" + state.Long2);
     joiner.add("long3=" + state.Long3);
     joiner.add("long0Array=" + Arrays.ToString(state.Long0Array));
     joiner.add("long1Array=" + Arrays.ToString(state.Long1Array));
     base.AddTypeSpecificDetails(joiner, state);
 }
Ejemplo n.º 4
0
        public override void RecoveryCleanupFinished(File indexFile, IndexDescriptor indexDescriptor, long numberOfPagesVisited, long numberOfCleanedCrashPointers, long durationMillis)
        {
            StringJoiner joiner = new StringJoiner(", ", "Schema index cleanup job finished: " + IndexDescription(indexFile, indexDescriptor) + " ", "");

            joiner.add("Number of pages visited: " + numberOfPagesVisited);
            joiner.add("Number of cleaned crashed pointers: " + numberOfCleanedCrashPointers);
            joiner.add("Time spent: " + duration(durationMillis));
            _log.info(joiner.ToString());
        }
Ejemplo n.º 5
0
        public override void RecoveryCleanupFinished(long numberOfPagesVisited, long numberOfCleanedCrashPointers, long durationMillis)
        {
            StringJoiner joiner = new StringJoiner(", ", "Label index cleanup job finished: ", "");

            joiner.add("Number of pages visited: " + numberOfPagesVisited);
            joiner.add("Number of cleaned crashed pointers: " + numberOfCleanedCrashPointers);
            joiner.add("Time spent: " + duration(durationMillis));
            _log.info(joiner.ToString());
        }
Ejemplo n.º 6
0
        internal virtual string ToDetailedString(GenericKey state)
        {
            StringJoiner joiner = new StringJoiner(", ");

            joiner.add(ToString(state));

            // Mutable, meta-state
            joiner.add("type=" + state.TypeConflict.GetType().Name);
            joiner.add("inclusion=" + state.Inclusion);
            joiner.add("isArray=" + state.IsArray);

            AddTypeSpecificDetails(joiner, state);
            return(joiner.ToString());
        }
Ejemplo n.º 7
0
 private void ReportToJoiner(StringJoiner joiner, Counter counter)
 {
     if (counter.NbrOfReports > 0)
     {
         joiner.add(counter.ToString());
     }
 }
Ejemplo n.º 8
0
        private string IndexPattern(string label, params string[] properties)
        {
            StringJoiner pattern = new StringJoiner(",", ":" + label + "(", ")");

            foreach (string property in properties)
            {
                pattern.add(property);
            }
            return(pattern.ToString());
        }
Ejemplo n.º 9
0
        internal override string ToDetailedStringInternal()
        {
            StringJoiner joiner = new StringJoiner(",");

            foreach (GenericKey state in _states)
            {
                joiner.add(state.ToDetailedStringInternal());
            }
            return(joiner.ToString());
        }
 public override void Init()
 {
     _started = false;
     if (!_jobs.Empty)
     {
         StringJoiner joiner = new StringJoiner(string.Format("%n  "), "Did not expect there to be any cleanup jobs still here. Jobs[", "]");
         ConsumeAndCloseJobs(cj => joiner.add(_jobs.ToString()));
         throw new System.InvalidOperationException(joiner.ToString());
     }
     ScheduleJobs();
 }
Ejemplo n.º 11
0
        private string Describe(ISet <KernelTransactionHandle> allBlockers)
        {
            if (allBlockers.Count == 0)
            {
                return(StringUtils.EMPTY);
            }
            StringJoiner stringJoiner = new StringJoiner(", ", "[", "]");

            foreach (KernelTransactionHandle blocker in allBlockers)
            {
                stringJoiner.add(blocker.UserTransactionName);
            }
            return(stringJoiner.ToString());
        }
Ejemplo n.º 12
0
            internal virtual void AddToString(string name, long measurement, StringJoiner joiner, bool isTime)
            {
                string measurementString;

                if (isTime)
                {
                    long timeInNanos = TimeUnit.MILLISECONDS.toNanos(measurement);
                    measurementString = TimeUtil.nanosToString(timeInNanos);
                }
                else
                {
                    measurementString = Convert.ToString(measurement);
                }
                joiner.add(string.Format("{0}={1}", name, measurementString));
            }
Ejemplo n.º 13
0
            internal virtual string BuildProcedureQuery()
            {
                StringJoiner stringJoiner = new StringJoiner(",", "CALL " + Name + "(", ")");

                foreach (object parameter in Params)
                {
                    stringJoiner.add(parameter.ToString());
                }
                if (!string.ReferenceEquals(SetupQuery, null) && !string.ReferenceEquals(PostQuery, null))
                {
                    return(SetupQuery + " " + stringJoiner.ToString() + " " + PostQuery);
                }
                else
                {
                    return(stringJoiner.ToString());
                }
            }
        /// <summary>
        /// This test target a bug around minimal splitter in gbpTree and unique index populator. It goes like this:
        /// Given a set of updates (value,entityId):
        /// - ("A01",1), ("A90",3), ("A9",2)
        /// If ("A01",1) and ("A90",3) would cause a split to occur they would produce a minimal splitter ("A9",3).
        /// Note that the value in this minimal splitter is equal to our last update ("A9",2).
        /// When making insertions with the unique populator we don't compare entityId which would means ("A9",2)
        /// ends up to the right of ("A9",3), even though it belongs to the left because of entityId being smaller.
        /// At this point the tree is in an inconsistent (key on wrong side of splitter).
        ///
        /// To work around this problem the entityId is only kept in minimal splitter if strictly necessary to divide
        /// left from right. This means the minimal splitter between ("A01",1) and ("A90",3) is ("A9",-1) and ("A9",2)
        /// will correctly be placed on the right side of this splitter.
        ///
        /// To trigger this scenario this test first insert a bunch of values that are all unique and that will cause a
        /// split to happen. This is the firstBatch.
        /// The second batch are constructed so that at least one of them will have a value equal to the splitter key
        /// constructed during the firstBatch.
        /// It's important that the secondBatch has ids that are lower than the first batch to align with example described above.
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPopulateAndRemoveEntriesWithSimilarMinimalSplitter() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldPopulateAndRemoveEntriesWithSimilarMinimalSplitter()
        {
            string prefix     = "Work out your own salvation. Do not depend on others. ";
            int    nbrOfNodes = 200;
            long   nodeId     = 0;

            // Second batch has lower ids
            IList <NodeAndValue> secondBatch = new List <NodeAndValue>();

            for (int i = 0; i < nbrOfNodes; i++)
            {
                secondBatch.Add(new NodeAndValue(nodeId++, stringValue(prefix + i)));
            }

            // First batch has higher ids and minimal splitter among values in first batch will be found among second batch
            IList <NodeAndValue> firstBatch = new List <NodeAndValue>();

            for (int i = 0; i < nbrOfNodes; i++)
            {
                firstBatch.Add(new NodeAndValue(nodeId++, stringValue(prefix + i + " " + i)));
            }

            WithPopulator(IndexProvider.getPopulator(Descriptor, IndexSamplingConfig, heapBufferFactory(1024)), p =>
            {
                p.add(Updates(firstBatch));
                p.add(Updates(secondBatch));

                // Index should be consistent
            });

            IList <NodeAndValue> toRemove = new List <NodeAndValue>();

            ((IList <NodeAndValue>)toRemove).AddRange(firstBatch);
            ((IList <NodeAndValue>)toRemove).AddRange(secondBatch);
            Collections.shuffle(toRemove);

            // And we should be able to remove the entries in any order
            using (IndexAccessor accessor = IndexProvider.getOnlineAccessor(Descriptor, IndexSamplingConfig))
            {
                // WHEN
                using (IndexUpdater updater = accessor.NewUpdater(IndexUpdateMode.ONLINE))
                {
                    foreach (NodeAndValue nodeAndValue in toRemove)
                    {
                        updater.Process(IndexEntryUpdate.Remove(nodeAndValue.NodeId, Descriptor, nodeAndValue.Value));
                    }
                }

                // THEN
                using (IndexReader reader = new QueryResultComparingIndexReader(accessor.NewReader()))
                {
                    int propertyKeyId = Descriptor.schema().PropertyId;
                    foreach (NodeAndValue nodeAndValue in toRemove)
                    {
                        NodeValueIterator nodes = new NodeValueIterator();
                        reader.Query(nodes, IndexOrder.NONE, false, IndexQuery.exact(propertyKeyId, nodeAndValue.Value));
                        bool anyHits = false;

                        StringJoiner nodesStillLeft = new StringJoiner(", ", "[", "]");
                        while (nodes.HasNext())
                        {
                            anyHits = true;
                            nodesStillLeft.add(Convert.ToString(nodes.Next()));
                        }
                        assertFalse("Expected this query to have zero hits but found " + nodesStillLeft.ToString(), anyHits);
                    }
                }
            }
        }
Ejemplo n.º 15
0
 protected internal override void AddTypeSpecificDetails(StringJoiner joiner, GenericKey state)
 {
     joiner.add("isHighestArray=" + state.IsHighestArray);
     joiner.add("arrayLength=" + state.ArrayLength);
     joiner.add("currentArrayOffset=" + state.CurrentArrayOffset);
 }