mirror of https://github.com/apache/cassandra
Fix failing select on system_views.settings for non-string keys
patch by JwahoonKim; reviewed by Jyothsna Konisa, Dmitry Konstantinov, Stefan Miklosovic for CASSANDRA-21348
This commit is contained in:
parent
8093c3c9ce
commit
1c718ab40f
|
|
@ -1,4 +1,5 @@
|
|||
5.0.9
|
||||
* Fix failing select on system_views.settings for non-string keys (CASSANDRA-21348)
|
||||
* Ensure SAI sends range tombstones to the coordinator for queries on static columns (CASSANDRA-21332)
|
||||
Merged from 4.1:
|
||||
* Add Paxos v2 option and informatin in cassandra.yaml (CASSANDRA-21316)
|
||||
|
|
|
|||
|
|
@ -111,15 +111,16 @@ public final class SettingsTable extends AbstractVirtualTable
|
|||
else if (value instanceof Map)
|
||||
{
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
for (Map.Entry<String, Object> entry : ((Map<String, Object>) value).entrySet())
|
||||
for (Map.Entry<?, ?> entry : ((Map<?, ?>) value).entrySet())
|
||||
{
|
||||
String key = String.valueOf(entry.getKey());
|
||||
// this is done on best-effort basis as we do not have names in parameters
|
||||
// inherently under control as this is what a user is responsible for
|
||||
// when dealing with custom implementations
|
||||
if (entry.getKey().endsWith("_password") || entry.getKey().equals("password"))
|
||||
map.put(entry.getKey(), Redacted.REDACTED_STRING);
|
||||
if (key.endsWith("_password") || key.equals("password"))
|
||||
map.put(key, Redacted.REDACTED_STRING);
|
||||
else
|
||||
map.put(entry.getKey(), entry.getValue());
|
||||
map.put(key, entry.getValue());
|
||||
}
|
||||
|
||||
return tryConstructJson(map);
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ import org.apache.cassandra.config.TransparentDataEncryptionOptions;
|
|||
import org.apache.cassandra.cql3.CQLTester;
|
||||
import org.apache.cassandra.distributed.shared.WithProperties;
|
||||
import org.apache.cassandra.security.SSLFactory;
|
||||
import org.apache.cassandra.service.StartupChecks.StartupCheckType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yaml.snakeyaml.introspector.Property;
|
||||
|
|
@ -135,6 +136,17 @@ public class SettingsTableTest extends CQLTester
|
|||
assertRowsNet(executeNet(q));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartupChecksWithEnumKeys() throws Throwable
|
||||
{
|
||||
Map<String, Object> checkDataResurrection = new LinkedHashMap<>();
|
||||
checkDataResurrection.put("enabled", true);
|
||||
config.startup_checks.put(StartupCheckType.check_data_resurrection, checkDataResurrection);
|
||||
|
||||
check("startup_checks", "{check_data_resurrection={enabled=true}}");
|
||||
Assert.assertFalse(executeNet("SELECT * FROM vts.settings").all().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectOverride() throws Throwable
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue