forked from pingcap/tidb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Serialize Compact; Run SwitchToImportMode periodically; Log progress …
…periodically (pingcap#92) * *: run Compact, SwitchToImportMode and log a progress periodically * restore: ensure FullCompact and Level1Compact are also serial Fixed an invalid usage of metrics. * tests: fixed integration test failure caused by pingcap#91 * config, restore: fixed comments * config, restore: start compaction asap (but still in seequential order)
- Loading branch information
Showing
8 changed files
with
187 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package metric_test | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/pingcap/check" | ||
|
||
"github.com/pingcap/tidb-lightning/lightning/metric" | ||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
type testMetricSuite struct{} | ||
|
||
func (s *testMetricSuite) SetUpSuite(c *C) {} | ||
func (s *testMetricSuite) TearDownSuite(c *C) {} | ||
|
||
var _ = Suite(&testMetricSuite{}) | ||
|
||
func TestMetric(t *testing.T) { | ||
TestingT(t) | ||
} | ||
|
||
func (s *testMetricSuite) TestReadCounter(c *C) { | ||
counter := prometheus.NewCounter(prometheus.CounterOpts{}) | ||
counter.Add(1256.0) | ||
counter.Add(2214.0) | ||
c.Assert(metric.ReadCounter(counter), Equals, 3470.0) | ||
} | ||
|
||
func (s *testMetricSuite) TestReadHistogramSum(c *C) { | ||
histogram := prometheus.NewHistogram(prometheus.HistogramOpts{}) | ||
histogram.Observe(11131.5) | ||
histogram.Observe(15261.0) | ||
c.Assert(metric.ReadHistogramSum(histogram), Equals, 26392.5) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters