• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

apache / iotdb / #10018

07 Sep 2023 05:00AM UTC coverage: 47.717% (+0.03%) from 47.691%
#10018

push

travis_ci

web-flow
Pipe: Fix ConcurrentModificationException caused by concurrently iterating through CachedSchemaPatternMatcher.extractors when an PipeHeartbeatEvent is being assigned (#11074) (#11075)

* try to fix ConcurrentModificationException when assigning PipeHeartbeatEvent

* Update CachedSchemaPatternMatcher.java

---------

Co-authored-by: 马子坤 <55695098+DanielWang2035@users.noreply.github.com>
(cherry picked from commit ac0dd9d31)

1 of 1 new or added line in 1 file covered. (100.0%)

80262 of 168204 relevant lines covered (47.72%)

0.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.67
/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/TimePartitionUtils.java
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one
3
 * or more contributor license agreements.  See the NOTICE file
4
 * distributed with this work for additional information
5
 * regarding copyright ownership.  The ASF licenses this file
6
 * to you under the Apache License, Version 2.0 (the
7
 * "License"); you may not use this file except in compliance
8
 * with the License.  You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing,
13
 * software distributed under the License is distributed on an
14
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
 * KIND, either express or implied.  See the License for the
16
 * specific language governing permissions and limitations
17
 * under the License.
18
 */
19
package org.apache.iotdb.db.utils;
20

21
import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
22
import org.apache.iotdb.commons.conf.CommonDescriptor;
23
import org.apache.iotdb.commons.utils.TestOnly;
24

25
public class TimePartitionUtils {
×
26
  private static long timePartitionInterval =
1✔
27
      CommonDescriptor.getInstance().getConfig().getTimePartitionInterval();
1✔
28

29
  public static TTimePartitionSlot getTimePartitionSlot(long time) {
30
    TTimePartitionSlot timePartitionSlot = new TTimePartitionSlot();
1✔
31
    if (time > 0 || time % timePartitionInterval == 0) {
1✔
32
      timePartitionSlot.setStartTime(time / timePartitionInterval * timePartitionInterval);
1✔
33
    } else {
34
      timePartitionSlot.setStartTime((time / timePartitionInterval - 1) * timePartitionInterval);
1✔
35
    }
36
    return timePartitionSlot;
1✔
37
  }
38

39
  public static long getTimePartitionInterval() {
40
    return timePartitionInterval;
1✔
41
  }
42

43
  public static long getTimePartitionUpperBound(long time) {
44
    long upperBoundOfTimePartition;
45
    if (time > 0 || time % TimePartitionUtils.timePartitionInterval == 0) {
1✔
46
      upperBoundOfTimePartition =
1✔
47
          (time / TimePartitionUtils.timePartitionInterval + 1)
48
              * TimePartitionUtils.timePartitionInterval;
49
    } else {
50
      upperBoundOfTimePartition =
×
51
          (time / TimePartitionUtils.timePartitionInterval)
52
              * TimePartitionUtils.timePartitionInterval;
53
    }
54
    return upperBoundOfTimePartition;
1✔
55
  }
56

57
  @TestOnly
58
  public static void setTimePartitionInterval(long timePartitionInterval) {
59
    TimePartitionUtils.timePartitionInterval = timePartitionInterval;
1✔
60
  }
1✔
61
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc