Package org.apache.cassandra.db.compaction

Examples of org.apache.cassandra.db.compaction.CompactionManagerMBean


    private void describeKeySpace(String keySpaceName, KsDef metadata) throws TException
    {
        NodeProbe probe = sessionState.getNodeProbe();

        // getting compaction manager MBean to displaying index building information
        CompactionManagerMBean compactionManagerMBean = (probe == null) ? null : probe.getCompactionManagerProxy();

        // Describe and display
        sessionState.out.println("Keyspace: " + keySpaceName + ":");
        try
        {
            KsDef ks_def;
            ks_def = metadata == null ? thriftClient.describe_keyspace(keySpaceName) : metadata;
            sessionState.out.println("  Replication Strategy: " + ks_def.strategy_class);

            sessionState.out.println("  Durable Writes: " + ks_def.durable_writes);

            Map<String, String> options = ks_def.strategy_options;
            sessionState.out.println("    Options: [" + ((options == null) ? "" : FBUtilities.toString(options)) + "]");

            sessionState.out.println("  Column Families:");

            boolean isSuper;

            Collections.sort(ks_def.cf_defs, new CfDefNamesComparator());
            for (CfDef cf_def : ks_def.cf_defs)
            {
                // fetching bean for current column family store
                ColumnFamilyStoreMBean cfMBean = (probe == null) ? null : probe.getCfsProxy(ks_def.getName(), cf_def.getName());

                isSuper = cf_def.column_type.equals("Super");
                sessionState.out.printf("    ColumnFamily: %s%s%n", cf_def.name, isSuper ? " (Super)" : "");

                if (cf_def.comment != null && !cf_def.comment.isEmpty())
                {
                    sessionState.out.printf("    \"%s\"%n", cf_def.comment);
                }
                if (cf_def.key_validation_class != null)
                    sessionState.out.printf("      Key Validation Class: %s%n", cf_def.key_validation_class);
                if (cf_def.default_validation_class != null)
                    sessionState.out.printf("      Default column value validator: %s%n", cf_def.default_validation_class);
                sessionState.out.printf("      Columns sorted by: %s%s%n", cf_def.comparator_type, cf_def.column_type.equals("Super") ? "/" + cf_def.subcomparator_type : "");
                sessionState.out.printf("      Row cache size / save period in seconds: %s/%s%n", cf_def.row_cache_size, cf_def.row_cache_save_period_in_seconds);
                sessionState.out.printf("      Key cache size / save period in seconds: %s/%s%n", cf_def.key_cache_size, cf_def.key_cache_save_period_in_seconds);
                sessionState.out.printf("      Memtable thresholds: %s/%s/%s (millions of ops/MB/minutes)%n",
                                cf_def.memtable_operations_in_millions, cf_def.memtable_flush_after_mins, cf_def.memtable_throughput_in_mb);
                sessionState.out.printf("      GC grace seconds: %s%n", cf_def.gc_grace_seconds);
                sessionState.out.printf("      Compaction min/max thresholds: %s/%s%n", cf_def.min_compaction_threshold, cf_def.max_compaction_threshold);
                sessionState.out.printf("      Read repair chance: %s%n", cf_def.read_repair_chance);
                sessionState.out.printf("      Replicate on write: %s%n", cf_def.replicate_on_write);

                // if we have connection to the cfMBean established
                if (cfMBean != null)
                {
                    sessionState.out.printf("      Built indexes: %s%n", cfMBean.getBuiltIndexes());
                }

                if (cf_def.getColumn_metadataSize() != 0)
                {
                    String leftSpace = "      ";
                    String columnLeftSpace = leftSpace + "    ";

                    String compareWith = isSuper ? cf_def.subcomparator_type
                                                                                      : cf_def.comparator_type;
                    AbstractType columnNameValidator = getFormatType(compareWith);

                    sessionState.out.println(leftSpace + "Column Metadata:");
                    for (ColumnDef columnDef : cf_def.getColumn_metadata())
                    {
                        String columnName = columnNameValidator.getString(columnDef.name);
                        if (columnNameValidator instanceof BytesType)
                        {
                            try
                            {
                                String columnString = UTF8Type.instance.getString(columnDef.name);
                                columnName = columnString + " (" + columnName + ")";
                            }
                            catch (MarshalException e)
                            {
                                // guess it wasn't a utf8 column name after all
                            }
                        }

                        sessionState.out.println(leftSpace + "  Column Name: " + columnName);
                        sessionState.out.println(columnLeftSpace + "Validation Class: " + columnDef.getValidation_class());

                        if (columnDef.isSetIndex_name())
                        {
                            sessionState.out.println(columnLeftSpace + "Index Name: " + columnDef.getIndex_name());
                        }

                        if (columnDef.isSetIndex_type())
                        {
                            sessionState.out.println(columnLeftSpace + "Index Type: " + columnDef.getIndex_type().name());
                        }
                    }
                }
            }

            // compaction manager information
            if (compactionManagerMBean != null)
            {
                for (CompactionInfo info : compactionManagerMBean.getCompactions())
                {
                    // if ongoing compaction type is index build
                    if (info.getTaskType() != CompactionType.INDEX_BUILD)
                        continue;
                    sessionState.out.printf("%nCurrently building index %s, completed %d of %d bytes.%n",
View Full Code Here


    private void describeKeySpace(String keySpaceName, KsDef metadata) throws TException
    {
        NodeProbe probe = sessionState.getNodeProbe();

        // getting compaction manager MBean to displaying index building information
        CompactionManagerMBean compactionManagerMBean = (probe == null) ? null : probe.getCompactionManagerProxy();

        // Describe and display
        sessionState.out.println("Keyspace: " + keySpaceName + ":");
        try
        {
            KsDef ks_def;
            ks_def = metadata == null ? thriftClient.describe_keyspace(keySpaceName) : metadata;
            sessionState.out.println("  Replication Strategy: " + ks_def.strategy_class);

            sessionState.out.println("  Durable Writes: " + ks_def.durable_writes);

            Map<String, String> options = ks_def.strategy_options;
            sessionState.out.println("    Options: [" + ((options == null) ? "" : FBUtilities.toString(options)) + "]");

            sessionState.out.println("  Column Families:");

            Collections.sort(ks_def.cf_defs, new CfDefNamesComparator());

            for (CfDef cf_def : ks_def.cf_defs)
                describeColumnFamily(ks_def, cf_def, probe);

            // compaction manager information
            if (compactionManagerMBean != null)
            {
                for (Map<String, String> info : compactionManagerMBean.getCompactions())
                {
                    // if ongoing compaction type is index build
                    if (info.get("taskType").equals(OperationType.INDEX_BUILD.toString()))
                        continue;
                    sessionState.out.printf("%nCurrently building index %s, completed %d of %d bytes.%n",
View Full Code Here

    private void describeKeySpace(String keySpaceName, KsDef metadata) throws TException
    {
        NodeProbe probe = sessionState.getNodeProbe();

        // getting compaction manager MBean to displaying index building information
        CompactionManagerMBean compactionManagerMBean = (probe == null) ? null : probe.getCompactionManagerProxy();

        // Describe and display
        sessionState.out.println("Keyspace: " + keySpaceName + ":");
        try
        {
            KsDef ks_def;
            ks_def = metadata == null ? thriftClient.describe_keyspace(keySpaceName) : metadata;
            sessionState.out.println("  Replication Strategy: " + ks_def.strategy_class);

            sessionState.out.println("  Durable Writes: " + ks_def.durable_writes);

            Map<String, String> options = ks_def.strategy_options;
            sessionState.out.println("    Options: [" + ((options == null) ? "" : FBUtilities.toString(options)) + "]");

            sessionState.out.println("  Column Families:");

            Collections.sort(ks_def.cf_defs, new CfDefNamesComparator());

            for (CfDef cf_def : ks_def.cf_defs)
                describeColumnFamily(ks_def, cf_def, probe);

            // compaction manager information
            if (compactionManagerMBean != null)
            {
                for (Map<String, String> info : compactionManagerMBean.getCompactions())
                {
                    // if ongoing compaction type is index build
                    if (info.get("taskType").equals(OperationType.INDEX_BUILD.toString()))
                        continue;
                    sessionState.out.printf("%nCurrently building index %s, completed %d of %d bytes.%n",
View Full Code Here

        outs.printf("%-25s%10s%10s%15s%n", "Responses", "n/a", pending, completed);
    }

    public void printCompactionStats(PrintStream outs)
    {
        CompactionManagerMBean cm = probe.getCompactionManagerProxy();
        outs.println("pending tasks: " + cm.getPendingTasks());
        if (cm.getCompactions().size() > 0)
            outs.printf("%25s%16s%16s%16s%16s%10s%n", "compaction type", "keyspace", "column family", "bytes compacted", "bytes total", "progress");
        for (Map<String, String> c : cm.getCompactions())
        {
            String percentComplete = new Long(c.get("totalBytes")) == 0
                                   ? "n/a"
                                   : new DecimalFormat("0.00").format((double) new Long(c.get("bytesComplete")) / new Long(c.get("totalBytes")) * 100) + "%";
            outs.printf("%25s%16s%16s%16s%16s%10s%n", c.get("taskType"), c.get("keyspace"), c.get("columnfamily"), c.get("bytesComplete"), c.get("totalBytes"), percentComplete);
View Full Code Here

    private void describeKeySpace(String keySpaceName, KsDef metadata) throws TException
    {
        NodeProbe probe = sessionState.getNodeProbe();

        // getting compaction manager MBean to displaying index building information
        CompactionManagerMBean compactionManagerMBean = (probe == null) ? null : probe.getCompactionManagerProxy();

        // Describe and display
        sessionState.out.println("Keyspace: " + keySpaceName + ":");
        try
        {
            KsDef ks_def;
            ks_def = metadata == null ? thriftClient.describe_keyspace(keySpaceName) : metadata;
            sessionState.out.println("  Replication Strategy: " + ks_def.strategy_class);

            sessionState.out.println("  Durable Writes: " + ks_def.durable_writes);

            Map<String, String> options = ks_def.strategy_options;
            sessionState.out.println("    Options: [" + ((options == null) ? "" : FBUtilities.toString(options)) + "]");

            sessionState.out.println("  Column Families:");

            Collections.sort(ks_def.cf_defs, new CfDefNamesComparator());

            for (CfDef cf_def : ks_def.cf_defs)
                describeColumnFamily(ks_def, cf_def, probe);

            // compaction manager information
            if (compactionManagerMBean != null)
            {
                for (Map<String, String> info : compactionManagerMBean.getCompactions())
                {
                    // if ongoing compaction type is index build
                    if (info.get("taskType").equals(OperationType.INDEX_BUILD.toString()))
                        continue;
                    sessionState.out.printf("%nCurrently building index %s, completed %d of %d bytes.%n",
View Full Code Here

        outs.printf("%-25s%10s%10s%15s%n", "Responses", "n/a", pending, completed);
    }

    public void printCompactionStats(PrintStream outs)
    {
        CompactionManagerMBean cm = probe.getCompactionManagerProxy();
        outs.println("pending tasks: " + cm.getPendingTasks());
        if (cm.getCompactions().size() > 0)
            outs.printf("%25s%16s%16s%16s%16s%10s%n", "compaction type", "keyspace", "column family", "bytes compacted", "bytes total", "progress");
        for (CompactionInfo c : cm.getCompactions())
        {
            String percentComplete = c.getTotalBytes() == 0
                                   ? "n/a"
                                   : new DecimalFormat("0.00").format((double) c.getBytesComplete() / c.getTotalBytes() * 100) + "%";
            outs.printf("%25s%16s%16s%16s%16s%10s%n", c.getTaskType(), c.getKeyspace(), c.getColumnFamily(), c.getBytesComplete(), c.getTotalBytes(), percentComplete);
View Full Code Here

    private void describeKeySpace(String keySpaceName, KsDef metadata) throws TException
    {
        NodeProbe probe = sessionState.getNodeProbe();

        // getting compaction manager MBean to displaying index building information
        CompactionManagerMBean compactionManagerMBean = (probe == null) ? null : probe.getCompactionManagerProxy();

        // Describe and display
        sessionState.out.println("Keyspace: " + keySpaceName + ":");
        try
        {
            KsDef ks_def;
            ks_def = metadata == null ? thriftClient.describe_keyspace(keySpaceName) : metadata;
            sessionState.out.println("  Replication Strategy: " + ks_def.strategy_class);

            sessionState.out.println("  Durable Writes: " + ks_def.durable_writes);

            Map<String, String> options = ks_def.strategy_options;
            sessionState.out.println("    Options: [" + ((options == null) ? "" : FBUtilities.toString(options)) + "]");

            sessionState.out.println("  Column Families:");

            Collections.sort(ks_def.cf_defs, new CfDefNamesComparator());

            for (CfDef cf_def : ks_def.cf_defs)
                describeColumnFamily(ks_def, cf_def, probe);

            // compaction manager information
            if (compactionManagerMBean != null)
            {
                for (Map<String, String> info : compactionManagerMBean.getCompactions())
                {
                    // if ongoing compaction type is index build
                    if (info.get("taskType").equals(OperationType.INDEX_BUILD.toString()))
                        continue;
                    sessionState.out.printf("%nCurrently building index %s, completed %d of %d bytes.%n",
View Full Code Here

    }

    public void printCompactionStats(PrintStream outs)
    {
        int compactionThroughput = probe.getCompactionThroughput();
        CompactionManagerMBean cm = probe.getCompactionManagerProxy();
        outs.println("pending tasks: " + cm.getPendingTasks());
        if (cm.getCompactions().size() > 0)
            outs.printf("%25s%16s%16s%16s%16s%10s%10s%n", "compaction type", "keyspace", "column family", "completed", "total", "unit", "progress");
        long remainingBytes = 0;
        for (Map<String, String> c : cm.getCompactions())
        {
            String percentComplete = new Long(c.get("total")) == 0
                                   ? "n/a"
                                   : new DecimalFormat("0.00").format((double) new Long(c.get("completed")) / new Long(c.get("total")) * 100) + "%";
            outs.printf("%25s%16s%16s%16s%16s%10s%10s%n", c.get("taskType"), c.get("keyspace"), c.get("columnfamily"), c.get("completed"), c.get("total"), c.get("unit"), percentComplete);
View Full Code Here

    private void describeKeySpace(String keySpaceName, KsDef metadata) throws TException
    {
        NodeProbe probe = sessionState.getNodeProbe();

        // getting compaction manager MBean to displaying index building information
        CompactionManagerMBean compactionManagerMBean = (probe == null) ? null : probe.getCompactionManagerProxy();

        // Describe and display
        sessionState.out.println("Keyspace: " + keySpaceName + ":");
        try
        {
            KsDef ks_def;
            ks_def = metadata == null ? thriftClient.describe_keyspace(keySpaceName) : metadata;
            sessionState.out.println("  Replication Strategy: " + ks_def.strategy_class);

            sessionState.out.println("  Durable Writes: " + ks_def.durable_writes);

            Map<String, String> options = ks_def.strategy_options;
            sessionState.out.println("    Options: [" + ((options == null) ? "" : FBUtilities.toString(options)) + "]");

            sessionState.out.println("  Column Families:");

            Collections.sort(ks_def.cf_defs, new CfDefNamesComparator());

            for (CfDef cf_def : ks_def.cf_defs)
                describeColumnFamily(ks_def, cf_def, probe);

            // compaction manager information
            if (compactionManagerMBean != null)
            {
                for (Map<String, String> info : compactionManagerMBean.getCompactions())
                {
                    // if ongoing compaction type is index build
                    if (info.get("taskType").equals(OperationType.INDEX_BUILD.toString()))
                        continue;
                    sessionState.out.printf("%nCurrently building index %s, completed %d of %d bytes.%n",
View Full Code Here

    }

    public void printCompactionStats(PrintStream outs)
    {
        int compactionThroughput = probe.getCompactionThroughput();
        CompactionManagerMBean cm = probe.getCompactionManagerProxy();
        outs.println("pending tasks: " + cm.getPendingTasks());
        if (cm.getCompactions().size() > 0)
            outs.printf("%25s%16s%16s%16s%16s%10s%10s%n", "compaction type", "keyspace", "column family", "completed", "total", "unit", "progress");
        long remainingBytes = 0;
        for (Map<String, String> c : cm.getCompactions())
        {
            String percentComplete = new Long(c.get("total")) == 0
                                   ? "n/a"
                                   : new DecimalFormat("0.00").format((double) new Long(c.get("completed")) / new Long(c.get("total")) * 100) + "%";
            outs.printf("%25s%16s%16s%16s%16s%10s%10s%n", c.get("taskType"), c.get("keyspace"), c.get("columnfamily"), c.get("completed"), c.get("total"), c.get("unit"), percentComplete);
View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.compaction.CompactionManagerMBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.