[jira] [Updated] (CASSANDRA-16228) TableMetrics are exposed before ColumnFamilyStore is fully initialized

2020-11-10 Thread Benjamin Lerer (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-16228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benjamin Lerer updated CASSANDRA-16228:
---
  Fix Version/s: (was: 4.0-beta)
 (was: 3.11.x)
 (was: 3.0.x)
 3.11.10
 3.0.24
 4.0-beta4
  Since Version: 3.0.0
Source Control Link: 
https://github.com/apache/cassandra/commit/548ef438568fe3216e39235fc054202709c542ca
 Resolution: Fixed
 Status: Resolved  (was: Ready to Commit)

Patch committed into cassandra-3.0 at 548ef438568fe3216e39235fc054202709c542ca 
and merged into cassandra-3.11 and trunk.

The patch for the metric reported issue was merged into trunk at 
32874dd04ae6c8dc9cc98d63717b8f94f4485378

> TableMetrics are exposed before ColumnFamilyStore is fully initialized
> --
>
> Key: CASSANDRA-16228
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16228
> Project: Cassandra
>  Issue Type: Bug
>  Components: Observability/Metrics
>Reporter: Ekaterina Dimitrova
>Assignee: Ekaterina Dimitrova
>Priority: Normal
> Fix For: 4.0-beta4, 3.0.24, 3.11.10
>
>
> The {{ColumnFamilyStore}} exposes the {{TableMetrics}} before it is fully 
> initialized, due to that it is possible to perform a call via the metrics 
> that access uninitialized part of the {{ColumnFamilyStore}}. 
> The following test can be added to ColumnFamilyMetricTest to show the issue:
> {code:java}
> @Test
> public void testStartupRaceConditionOnMetricListeners()
> {
>  // Since the ColumnFamilyStore instance reference escapes during the 
> construction
>  // we have a race condition and listeners can see an instance that is in an 
> unknown state.
>  // This test just check that all callbacks can access the data without 
> throwing any exception.
>  registerMetricListener();
>  SchemaLoader.createKeyspace("Keyspace2",
>  KeyspaceParams.simple(1),
>  SchemaLoader.standardCFMD("Keyspace2", "Standard2"));
> }
> private void registerMetricListener()
> {
>  CassandraMetricsRegistry.Metrics.addListener(new 
> MetricRegistryListener.Base()
>  {
>  @Override
>  public void onGaugeAdded(String name, Gauge gauge)
>  {
>  gauge.getValue();
>  }
>  @Override
>  public void onGaugeRemoved(String name)
>  {
>  }
>  @Override
>  public void onCounterAdded(String name, Counter counter)
>  {
>  counter.getCount();
>  }
>  @Override
>  public void onCounterRemoved(String name)
>  {
>  }
>  @Override
>  public void onHistogramAdded(String name, Histogram histogram)
>  {
>  histogram.getCount();
>  }
>  @Override
>  public void onHistogramRemoved(String name)
>  {
>  }
>  @Override
>  public void onMeterAdded(String name, Meter meter)
>  {
>  meter.getCount();
>  }
>  @Override
>  public void onMeterRemoved(String name)
>  {
>  }
>  @Override
>  public void onTimerAdded(String name, Timer timer)
>  {
>  timer.getCount();
>  }
>  @Override
>  public void onTimerRemoved(String name)
>  {
>  }
>  });{code}
> While looking into that ticket we also discovered a problem with the used of 
> {{Metered}} in {{CacheMetrics}}.
> Metrics reporter looks for metrics classes that are instance of the standard 
> codahale classes. Due to that, other Metered implementations are not be 
> exposed through the reporter. This ticket will also address that issue.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-16228) TableMetrics are exposed before ColumnFamilyStore is fully initialized

2020-11-10 Thread Benjamin Lerer (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-16228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benjamin Lerer updated CASSANDRA-16228:
---
Status: Ready to Commit  (was: Review In Progress)

> TableMetrics are exposed before ColumnFamilyStore is fully initialized
> --
>
> Key: CASSANDRA-16228
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16228
> Project: Cassandra
>  Issue Type: Bug
>  Components: Observability/Metrics
>Reporter: Ekaterina Dimitrova
>Assignee: Ekaterina Dimitrova
>Priority: Normal
> Fix For: 3.0.x, 3.11.x, 4.0-beta
>
>
> The {{ColumnFamilyStore}} exposes the {{TableMetrics}} before it is fully 
> initialized, due to that it is possible to perform a call via the metrics 
> that access uninitialized part of the {{ColumnFamilyStore}}. 
> The following test can be added to ColumnFamilyMetricTest to show the issue:
> {code:java}
> @Test
> public void testStartupRaceConditionOnMetricListeners()
> {
>  // Since the ColumnFamilyStore instance reference escapes during the 
> construction
>  // we have a race condition and listeners can see an instance that is in an 
> unknown state.
>  // This test just check that all callbacks can access the data without 
> throwing any exception.
>  registerMetricListener();
>  SchemaLoader.createKeyspace("Keyspace2",
>  KeyspaceParams.simple(1),
>  SchemaLoader.standardCFMD("Keyspace2", "Standard2"));
> }
> private void registerMetricListener()
> {
>  CassandraMetricsRegistry.Metrics.addListener(new 
> MetricRegistryListener.Base()
>  {
>  @Override
>  public void onGaugeAdded(String name, Gauge gauge)
>  {
>  gauge.getValue();
>  }
>  @Override
>  public void onGaugeRemoved(String name)
>  {
>  }
>  @Override
>  public void onCounterAdded(String name, Counter counter)
>  {
>  counter.getCount();
>  }
>  @Override
>  public void onCounterRemoved(String name)
>  {
>  }
>  @Override
>  public void onHistogramAdded(String name, Histogram histogram)
>  {
>  histogram.getCount();
>  }
>  @Override
>  public void onHistogramRemoved(String name)
>  {
>  }
>  @Override
>  public void onMeterAdded(String name, Meter meter)
>  {
>  meter.getCount();
>  }
>  @Override
>  public void onMeterRemoved(String name)
>  {
>  }
>  @Override
>  public void onTimerAdded(String name, Timer timer)
>  {
>  timer.getCount();
>  }
>  @Override
>  public void onTimerRemoved(String name)
>  {
>  }
>  });{code}
> While looking into that ticket we also discovered a problem with the used of 
> {{Metered}} in {{CacheMetrics}}.
> Metrics reporter looks for metrics classes that are instance of the standard 
> codahale classes. Due to that, other Metered implementations are not be 
> exposed through the reporter. This ticket will also address that issue.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-16228) TableMetrics are exposed before ColumnFamilyStore is fully initialized

2020-11-04 Thread Benjamin Lerer (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-16228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benjamin Lerer updated CASSANDRA-16228:
---
Reviewers: Benjamin Lerer, Benjamin Lerer  (was: Benjamin Lerer)
   Benjamin Lerer, Benjamin Lerer  (was: Benjamin Lerer)
   Status: Review In Progress  (was: Patch Available)

> TableMetrics are exposed before ColumnFamilyStore is fully initialized
> --
>
> Key: CASSANDRA-16228
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16228
> Project: Cassandra
>  Issue Type: Bug
>  Components: Observability/Metrics
>Reporter: Ekaterina Dimitrova
>Assignee: Ekaterina Dimitrova
>Priority: Normal
> Fix For: 3.0.x, 3.11.x, 4.0-beta
>
>
> The {{ColumnFamilyStore}} exposes the {{TableMetrics}} before it is fully 
> initialized, due to that it is possible to perform a call via the metrics 
> that access uninitialized part of the {{ColumnFamilyStore}}. 
> The following test can be added to ColumnFamilyMetricTest to show the issue:
> {code:java}
> @Test
> public void testStartupRaceConditionOnMetricListeners()
> {
>  // Since the ColumnFamilyStore instance reference escapes during the 
> construction
>  // we have a race condition and listeners can see an instance that is in an 
> unknown state.
>  // This test just check that all callbacks can access the data without 
> throwing any exception.
>  registerMetricListener();
>  SchemaLoader.createKeyspace("Keyspace2",
>  KeyspaceParams.simple(1),
>  SchemaLoader.standardCFMD("Keyspace2", "Standard2"));
> }
> private void registerMetricListener()
> {
>  CassandraMetricsRegistry.Metrics.addListener(new 
> MetricRegistryListener.Base()
>  {
>  @Override
>  public void onGaugeAdded(String name, Gauge gauge)
>  {
>  gauge.getValue();
>  }
>  @Override
>  public void onGaugeRemoved(String name)
>  {
>  }
>  @Override
>  public void onCounterAdded(String name, Counter counter)
>  {
>  counter.getCount();
>  }
>  @Override
>  public void onCounterRemoved(String name)
>  {
>  }
>  @Override
>  public void onHistogramAdded(String name, Histogram histogram)
>  {
>  histogram.getCount();
>  }
>  @Override
>  public void onHistogramRemoved(String name)
>  {
>  }
>  @Override
>  public void onMeterAdded(String name, Meter meter)
>  {
>  meter.getCount();
>  }
>  @Override
>  public void onMeterRemoved(String name)
>  {
>  }
>  @Override
>  public void onTimerAdded(String name, Timer timer)
>  {
>  timer.getCount();
>  }
>  @Override
>  public void onTimerRemoved(String name)
>  {
>  }
>  });{code}
> While looking into that ticket we also discovered a problem with the used of 
> {{Metered}} in {{CacheMetrics}}.
> Metrics reporter looks for metrics classes that are instance of the standard 
> codahale classes. Due to that, other Metered implementations are not be 
> exposed through the reporter. This ticket will also address that issue.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-16228) TableMetrics are exposed before ColumnFamilyStore is fully initialized

2020-11-04 Thread Benjamin Lerer (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-16228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benjamin Lerer updated CASSANDRA-16228:
---
Description: 
The {{ColumnFamilyStore}} exposes the {{TableMetrics}} before it is fully 
initialized, due to that it is possible to perform a call via the metrics that 
access uninitialized part of the {{ColumnFamilyStore}}. 

The following test can be added to ColumnFamilyMetricTest to show the issue:
{code:java}
@Test
public void testStartupRaceConditionOnMetricListeners()
{
 // Since the ColumnFamilyStore instance reference escapes during the 
construction
 // we have a race condition and listeners can see an instance that is in an 
unknown state.
 // This test just check that all callbacks can access the data without 
throwing any exception.
 registerMetricListener();
 SchemaLoader.createKeyspace("Keyspace2",
 KeyspaceParams.simple(1),
 SchemaLoader.standardCFMD("Keyspace2", "Standard2"));
}

private void registerMetricListener()
{
 CassandraMetricsRegistry.Metrics.addListener(new MetricRegistryListener.Base()
 {
 @Override
 public void onGaugeAdded(String name, Gauge gauge)
 {
 gauge.getValue();
 }

 @Override
 public void onGaugeRemoved(String name)
 {

 }

 @Override
 public void onCounterAdded(String name, Counter counter)
 {
 counter.getCount();
 }

 @Override
 public void onCounterRemoved(String name)
 {

 }

 @Override
 public void onHistogramAdded(String name, Histogram histogram)
 {
 histogram.getCount();
 }

 @Override
 public void onHistogramRemoved(String name)
 {

 }

 @Override
 public void onMeterAdded(String name, Meter meter)
 {
 meter.getCount();
 }

 @Override
 public void onMeterRemoved(String name)
 {

 }

 @Override
 public void onTimerAdded(String name, Timer timer)
 {
 timer.getCount();
 }

 @Override
 public void onTimerRemoved(String name)
 {

 }
 });{code}

While looking into that ticket we also discovered a problem with the used of 
{{Metered}} in {{CacheMetrics}}.
Metrics reporter looks for metrics classes that are instance of the standard 
codahale classes. Due to that, other Metered implementations are not be exposed 
through the reporter. This ticket will also address that issue.

  was:
The {{ColumnFamilyStore}} exposes the {{TableMetrics}} before it is fully 
initialized, due to that it is possible to perform a call via the metrics that 
access uninitialized part of the {{ColumnFamilyStore}}. 

The following test can be added to ColumnFamilyMetricTest to show the issue:
{code:java}
@Test
public void testStartupRaceConditionOnMetricListeners()
{
 // Since the ColumnFamilyStore instance reference escapes during the 
construction
 // we have a race condition and listeners can see an instance that is in an 
unknown state.
 // This test just check that all callbacks can access the data without 
throwing any exception.
 registerMetricListener();
 SchemaLoader.createKeyspace("Keyspace2",
 KeyspaceParams.simple(1),
 SchemaLoader.standardCFMD("Keyspace2", "Standard2"));
}

private void registerMetricListener()
{
 CassandraMetricsRegistry.Metrics.addListener(new MetricRegistryListener.Base()
 {
 @Override
 public void onGaugeAdded(String name, Gauge gauge)
 {
 gauge.getValue();
 }

 @Override
 public void onGaugeRemoved(String name)
 {

 }

 @Override
 public void onCounterAdded(String name, Counter counter)
 {
 counter.getCount();
 }

 @Override
 public void onCounterRemoved(String name)
 {

 }

 @Override
 public void onHistogramAdded(String name, Histogram histogram)
 {
 histogram.getCount();
 }

 @Override
 public void onHistogramRemoved(String name)
 {

 }

 @Override
 public void onMeterAdded(String name, Meter meter)
 {
 meter.getCount();
 }

 @Override
 public void onMeterRemoved(String name)
 {

 }

 @Override
 public void onTimerAdded(String name, Timer timer)
 {
 timer.getCount();
 }

 @Override
 public void onTimerRemoved(String name)
 {

 }
 });{code}
*NOTE:* In order to be able to run the test in 4.0 and use 
registerMetricListener() method a small modification to requests in 
CacheMetrics is needed. This will be submitted and further explained with a 
coming patch.


> TableMetrics are exposed before ColumnFamilyStore is fully initialized
> --
>
> Key: CASSANDRA-16228
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16228
> Project: Cassandra
>  Issue Type: Bug
>  Components: Observability/Metrics
>Reporter: Ekaterina Dimitrova
>Assignee: Ekaterina Dimitrova
>Priority: Normal
> Fix For: 3.0.x, 3.11.x, 4.0-beta
>
>
> The {{ColumnFamilyStore}} exposes the {{TableMetrics}} before it is fully 
> initialized, due to that it is possible to perform a call via the metrics 
> that access uninitialized part of the {{ColumnFamilyStore}}. 
> The following test can be added to 

[jira] [Updated] (CASSANDRA-16228) TableMetrics are exposed before ColumnFamilyStore is fully initialized

2020-11-04 Thread Benjamin Lerer (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-16228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benjamin Lerer updated CASSANDRA-16228:
---
Description: 
The {{ColumnFamilyStore}} exposes the {{TableMetrics}} before it is fully 
initialized, due to that it is possible to perform a call via the metrics that 
access uninitialized part of the {{ColumnFamilyStore}}. 

The following test can be added to ColumnFamilyMetricTest to show the issue:
{code:java}
@Test
public void testStartupRaceConditionOnMetricListeners()
{
 // Since the ColumnFamilyStore instance reference escapes during the 
construction
 // we have a race condition and listeners can see an instance that is in an 
unknown state.
 // This test just check that all callbacks can access the data without 
throwing any exception.
 registerMetricListener();
 SchemaLoader.createKeyspace("Keyspace2",
 KeyspaceParams.simple(1),
 SchemaLoader.standardCFMD("Keyspace2", "Standard2"));
}

private void registerMetricListener()
{
 CassandraMetricsRegistry.Metrics.addListener(new MetricRegistryListener.Base()
 {
 @Override
 public void onGaugeAdded(String name, Gauge gauge)
 {
 gauge.getValue();
 }

 @Override
 public void onGaugeRemoved(String name)
 {

 }

 @Override
 public void onCounterAdded(String name, Counter counter)
 {
 counter.getCount();
 }

 @Override
 public void onCounterRemoved(String name)
 {

 }

 @Override
 public void onHistogramAdded(String name, Histogram histogram)
 {
 histogram.getCount();
 }

 @Override
 public void onHistogramRemoved(String name)
 {

 }

 @Override
 public void onMeterAdded(String name, Meter meter)
 {
 meter.getCount();
 }

 @Override
 public void onMeterRemoved(String name)
 {

 }

 @Override
 public void onTimerAdded(String name, Timer timer)
 {
 timer.getCount();
 }

 @Override
 public void onTimerRemoved(String name)
 {

 }
 });{code}
*NOTE:* In order to be able to run the test in 4.0 and use 
registerMetricListener() method a small modification to requests in 
CacheMetrics is needed. This will be submitted and further explained with a 
coming patch.

  was:
There is a dependency between TableMetrics, SecondaryIndexManager and Tracker 
which requires certain order of the operations in ColumnFamilyStore 
constructor. 

The following test will be added to ColumnFamilyMetricTest to show the issue:
{code:java}
@Test
public void testStartupRaceConditionOnMetricListeners()
{
 // Since the ColumnFamilyStore instance reference escapes during the 
construction
 // we have a race condition and listeners can see an instance that is in an 
unknown state.
 // This test just check that all callbacks can access the data without 
throwing any exception.
 registerMetricListener();
 SchemaLoader.createKeyspace("Keyspace2",
 KeyspaceParams.simple(1),
 SchemaLoader.standardCFMD("Keyspace2", "Standard2"));
}

private void registerMetricListener()
{
 CassandraMetricsRegistry.Metrics.addListener(new MetricRegistryListener.Base()
 {
 @Override
 public void onGaugeAdded(String name, Gauge gauge)
 {
 gauge.getValue();
 }

 @Override
 public void onGaugeRemoved(String name)
 {

 }

 @Override
 public void onCounterAdded(String name, Counter counter)
 {
 counter.getCount();
 }

 @Override
 public void onCounterRemoved(String name)
 {

 }

 @Override
 public void onHistogramAdded(String name, Histogram histogram)
 {
 histogram.getCount();
 }

 @Override
 public void onHistogramRemoved(String name)
 {

 }

 @Override
 public void onMeterAdded(String name, Meter meter)
 {
 meter.getCount();
 }

 @Override
 public void onMeterRemoved(String name)
 {

 }

 @Override
 public void onTimerAdded(String name, Timer timer)
 {
 timer.getCount();
 }

 @Override
 public void onTimerRemoved(String name)
 {

 }
 });{code}
*NOTE:* In order to be able to run the test in 4.0 and use 
registerMetricListener() method a small modification to requests in 
CacheMetrics is needed. This will be submitted and further explained with a 
coming patch.


> TableMetrics are exposed before ColumnFamilyStore is fully initialized
> --
>
> Key: CASSANDRA-16228
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16228
> Project: Cassandra
>  Issue Type: Bug
>  Components: Observability/Metrics
>Reporter: Ekaterina Dimitrova
>Assignee: Ekaterina Dimitrova
>Priority: Normal
> Fix For: 3.0.x, 3.11.x, 4.0-beta
>
>
> The {{ColumnFamilyStore}} exposes the {{TableMetrics}} before it is fully 
> initialized, due to that it is possible to perform a call via the metrics 
> that access uninitialized part of the {{ColumnFamilyStore}}. 
> The following test can be added to ColumnFamilyMetricTest to show the issue:
> {code:java}
> @Test
> public void testStartupRaceConditionOnMetricListeners()
> {
>  // Since the ColumnFamilyStore instance 

[jira] [Updated] (CASSANDRA-16228) TableMetrics are exposed before ColumnFamilyStore is fully initialized

2020-11-04 Thread Benjamin Lerer (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-16228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benjamin Lerer updated CASSANDRA-16228:
---
Summary: TableMetrics are exposed before ColumnFamilyStore is fully 
initialized  (was: Fix race condition on ColumnFamilyStore and TableMetrics 
initialization that makes MetricListener to see an instance in an unknown state)

> TableMetrics are exposed before ColumnFamilyStore is fully initialized
> --
>
> Key: CASSANDRA-16228
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16228
> Project: Cassandra
>  Issue Type: Bug
>  Components: Observability/Metrics
>Reporter: Ekaterina Dimitrova
>Assignee: Ekaterina Dimitrova
>Priority: Normal
> Fix For: 3.0.x, 3.11.x, 4.0-beta
>
>
> There is a dependency between TableMetrics, SecondaryIndexManager and Tracker 
> which requires certain order of the operations in ColumnFamilyStore 
> constructor. 
> The following test will be added to ColumnFamilyMetricTest to show the issue:
> {code:java}
> @Test
> public void testStartupRaceConditionOnMetricListeners()
> {
>  // Since the ColumnFamilyStore instance reference escapes during the 
> construction
>  // we have a race condition and listeners can see an instance that is in an 
> unknown state.
>  // This test just check that all callbacks can access the data without 
> throwing any exception.
>  registerMetricListener();
>  SchemaLoader.createKeyspace("Keyspace2",
>  KeyspaceParams.simple(1),
>  SchemaLoader.standardCFMD("Keyspace2", "Standard2"));
> }
> private void registerMetricListener()
> {
>  CassandraMetricsRegistry.Metrics.addListener(new 
> MetricRegistryListener.Base()
>  {
>  @Override
>  public void onGaugeAdded(String name, Gauge gauge)
>  {
>  gauge.getValue();
>  }
>  @Override
>  public void onGaugeRemoved(String name)
>  {
>  }
>  @Override
>  public void onCounterAdded(String name, Counter counter)
>  {
>  counter.getCount();
>  }
>  @Override
>  public void onCounterRemoved(String name)
>  {
>  }
>  @Override
>  public void onHistogramAdded(String name, Histogram histogram)
>  {
>  histogram.getCount();
>  }
>  @Override
>  public void onHistogramRemoved(String name)
>  {
>  }
>  @Override
>  public void onMeterAdded(String name, Meter meter)
>  {
>  meter.getCount();
>  }
>  @Override
>  public void onMeterRemoved(String name)
>  {
>  }
>  @Override
>  public void onTimerAdded(String name, Timer timer)
>  {
>  timer.getCount();
>  }
>  @Override
>  public void onTimerRemoved(String name)
>  {
>  }
>  });{code}
> *NOTE:* In order to be able to run the test in 4.0 and use 
> registerMetricListener() method a small modification to requests in 
> CacheMetrics is needed. This will be submitted and further explained with a 
> coming patch.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org