[ 
https://issues.apache.org/jira/browse/CASSANDRA-12183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17736527#comment-17736527
 ] 

Stefan Miklosovic edited comment on CASSANDRA-12183 at 6/23/23 3:23 PM:
------------------------------------------------------------------------

for 4.1 it is the same stuff but for 4.0 and sooner it is a little bit tricky.

In 4.0, the type of id field in system.compaction_history is "uuid" (1) but it 
is inserted there as "time uuid" (2). So, if we went with passing UUID to that 
table, we would start to insert there UUIDs instead of time uuids and we are 
changing the behavior.

the original id of UUID type we want to use and pass to system table comes from 
here (3) but in 4.1 and trunk it is TimeUUID (4) and it came into existence by 
(5).

So, in a nutshell, I think we may do this for 4.1 at most and we leave older 
branches untouched.

Thoughts [~brandon.williams] [~jjirsa]

(1) 
[https://github.com/apache/cassandra/blob/cassandra-4.0/src/java/org/apache/cassandra/db/SystemKeyspace.java#L270]
(2) 
[https://github.com/apache/cassandra/blob/cassandra-4.0/src/java/org/apache/cassandra/db/SystemKeyspace.java#L568]
(3) 
[https://github.com/apache/cassandra/blob/cassandra-4.0/src/java/org/apache/cassandra/db/lifecycle/LogFile.java#L94]
(4) 
[https://github.com/apache/cassandra/blob/cassandra-4.1/src/java/org/apache/cassandra/db/lifecycle/LogFile.java#L96]
(5) [https://issues.apache.org/jira/browse/CASSANDRA-17176]


was (Author: smiklosovic):
for 4.1 it is the same stuff but for 4.0 and sooner it is a little bit tricky.

In 4.0, the type of id field in system.compaction_history is "uuid" (1) but it 
is inserted there as "time uuid" (2). So, if we went with passing UUID to that 
table, we would start to insert there UUIDs instead of time uuids and we are 
changing the behavior.

the original id of UUID type we want to use and pass to system table comes from 
here (3) but in 4.1 and trunk it is TimeUUID (4) and it came into existence by 
(5).

So, in a nutshell, I think we may do this for 4.1 at most and we leave older 
branches untouched.

Thoughts [~brandon.williams]

(1) 
[https://github.com/apache/cassandra/blob/cassandra-4.0/src/java/org/apache/cassandra/db/SystemKeyspace.java#L270]
(2) 
[https://github.com/apache/cassandra/blob/cassandra-4.0/src/java/org/apache/cassandra/db/SystemKeyspace.java#L568]
(3) 
[https://github.com/apache/cassandra/blob/cassandra-4.0/src/java/org/apache/cassandra/db/lifecycle/LogFile.java#L94]
(4) 
[https://github.com/apache/cassandra/blob/cassandra-4.1/src/java/org/apache/cassandra/db/lifecycle/LogFile.java#L96]
(5) [https://issues.apache.org/jira/browse/CASSANDRA-17176]

> compaction_history system table does not capture all historical compaction 
> sessions
> -----------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-12183
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12183
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Legacy/Observability, Local/Compaction
>            Reporter: Wei Deng
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>             Fix For: 5.x
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> It appears that some compaction sessions are not recorded in 
> system.compaction_history table after the compaction session successfully 
> finishes.
> The following is an example (test by simply running +cassandra-stress write 
> n=100000000+):
> {noformat}
> automaton@wdengdse50google-98425b985-3:~$ nodetool compactionstats
> pending tasks: 46
>                                      id   compaction type    keyspace       
> table    completed        total    unit   progress
>    fa8a4f30-4884-11e6-b916-1dbd340a212f        Compaction   keyspace1   
> standard1   4233184044   4774209875   bytes     88.67%
>    91e30d21-4887-11e6-b916-1dbd340a212f        Compaction   keyspace1   
> standard1    836983029    889773060   bytes     94.07%
> Active compaction remaining time :   0h00m35s
> automaton@wdengdse50google-98425b985-3:~$ nodetool compactionstats
> pending tasks: 47
>                                      id   compaction type    keyspace       
> table    completed        total    unit   progress
>    fa8a4f30-4884-11e6-b916-1dbd340a212f        Compaction   keyspace1   
> standard1   4353251539   4774209875   bytes     91.18%
>    28359094-4888-11e6-b916-1dbd340a212f        Compaction   keyspace1   
> standard1     49732274   4071652280   bytes      1.22%
> Active compaction remaining time :   0h04m24s
> {noformat}
> At this point you know the previous compaction session 
> 91e30d21-4887-11e6-b916-1dbd340a212f finished and confirmation can be found 
> from debug.log
> {noformat}
> automaton@wdengdse50google-98425b985-3:~$ grep 
> 91e30d21-4887-11e6-b916-1dbd340a212f /var/log/cassandra/debug.log
> DEBUG [CompactionExecutor:4] 2016-07-12 23:22:58,674  CompactionTask.java:146 
> - Compacting (91e30d21-4887-11e6-b916-1dbd340a212f) 
> [/var/lib/cassandra/data/keyspace1/standard1-9c02e9c1487c11e6b9161dbd340a212f/mb-290-big-Data.db:level=0,
>  
> /var/lib/cassandra/data/keyspace1/standard1-9c02e9c1487c11e6b9161dbd340a212f/mb-279-big-Data.db:level=0,
>  
> /var/lib/cassandra/data/keyspace1/standard1-9c02e9c1487c11e6b9161dbd340a212f/mb-281-big-Data.db:level=0,
>  
> /var/lib/cassandra/data/keyspace1/standard1-9c02e9c1487c11e6b9161dbd340a212f/mb-280-big-Data.db:level=0,
>  
> /var/lib/cassandra/data/keyspace1/standard1-9c02e9c1487c11e6b9161dbd340a212f/mb-284-big-Data.db:level=0,
>  
> /var/lib/cassandra/data/keyspace1/standard1-9c02e9c1487c11e6b9161dbd340a212f/mb-283-big-Data.db:level=0,
>  
> /var/lib/cassandra/data/keyspace1/standard1-9c02e9c1487c11e6b9161dbd340a212f/mb-287-big-Data.db:level=0,
>  
> /var/lib/cassandra/data/keyspace1/standard1-9c02e9c1487c11e6b9161dbd340a212f/mb-292-big-Data.db:level=0,
>  
> /var/lib/cassandra/data/keyspace1/standard1-9c02e9c1487c11e6b9161dbd340a212f/mb-286-big-Data.db:level=0,
>  
> /var/lib/cassandra/data/keyspace1/standard1-9c02e9c1487c11e6b9161dbd340a212f/mb-289-big-Data.db:level=0,
>  ]
> DEBUG [CompactionExecutor:4] 2016-07-12 23:26:56,054  CompactionTask.java:217 
> - Compacted (91e30d21-4887-11e6-b916-1dbd340a212f) 10 sstables to 
> [/var/lib/cassandra/data/keyspace1/standard1-9c02e9c1487c11e6b9161dbd340a212f/mb-293-big,]
>  to level=0.  889,773,060 bytes to 890,473,350 (~100% of original) in 
> 237,365ms = 3.577703MB/s.  0 total partitions merged to 3,871,921.  Partition 
> merge counts were {1:3871921, }
> {noformat}
> However, if you query system.compaction_history table or run "nodetool 
> compactionhistory | grep 91e30d21-4887-11e6-b916-1dbd340a212f" you will get 
> nothing:
> {noformat}
> automaton@wdengdse50google-98425b985-3:~$ cqlsh -u cassandra
> Password:
> Connected to dse50 at 127.0.0.1:9042.
> [cqlsh 5.0.1 | Cassandra 3.0.7.1158 | DSE 5.0.0 | CQL spec 3.4.0 | Native 
> protocol v4]
> Use HELP for help.
> cassandra@cqlsh> select * from system.compaction_history where 
> id=91e30d21-4887-11e6-b916-1dbd340a212f;
>  id | bytes_in | bytes_out | columnfamily_name | compacted_at | keyspace_name 
> | rows_merged
> ----+----------+-----------+-------------------+--------------+---------------+-------------
> (0 rows)
> automaton@wdengdse50google-98425b985-3:~$ nodetool flush system
> automaton@wdengdse50google-98425b985-3:~$ nodetool compactionhistory | grep 
> 91e30d21-4887-11e6-b916-1dbd340a212f
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to