What is the meaning of the content in SSTable?

I tested writing and deleting a record normally and found that its SSTable content is as follows.
write:

[
  {
    "partition" : {
      "key" : [ "user6284781860667377211" ],
      "position" : 0
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 37,
        "clustering" : [ "hashKeyPrefix4747011" ],
        "liveness_info" : { "tstamp" : "2024-02-02T07:36:44.910271Z" },
        "deletion_info" : { "marked_deleted" : "2024-02-02T07:36:44.910270Z", "local_delete_time" : "2024-02-02T07:36:44Z" },
        "cells" : [
          { "name" : "\":attrs\"", "path" : [ "field0" ], "value" : "0x01796c6c754e4a4853704e675577744645714751496b6a6f73464d5550575a755a5543746a7a5a4b61784746777268684159495a6956704d774c76426b514f665472694d634f6d52686744654d6171437165704d73444f726769724b6a4f4d67494a576472" },
          { "name" : "\":attrs\"", "path" : [ "field1" ], "value" : "0x0165537a666f44726757736f524b6350424e4e6e4b416b7371504e4f676849706d4b574b716a534a616e4c464c7857466c674c4555666c624d496752597078736755637346744556764a624c5371515767615a496f7964656e4b76616674627775744c4a7a" },
          { "name" : "\":attrs\"", "path" : [ "field2" ], "value" : "0x016b445769477067685a674571537a467843786d437950635a794a4c6565464457764e4476494272424d6873715066555457424d434a7450416e7443726178624450534f5063456a7a6c4f72614c4262506676695a5061756d4f79616b494e6a6c4771616c" },
          { "name" : "\":attrs\"", "path" : [ "field3" ], "value" : "0x01476c42647965435979596b4d6c75736b4e74756b6967534e765267756e6b45674d675474696352785559626e7368475276436e4379656645556c6851646877556f566873564755414c6f6b6a43674b4e71594369536f614a6c795343716b746e626e7246" },
          { "name" : "\":attrs\"", "path" : [ "field4" ], "value" : "0x01514f63674167714777686a5666667361414e47424363424b434945657770486b4375526b6e715164566b786750447a567152665968516e5368766171444e554f5967547079694b6d504d66414746497a6d41626a6548676f75646e787279755348505078" }
        ]
      }
    ]
  }
]

delete:

[
  {
    "partition" : {
      "key" : [ "hashKeyPrefix4747011" ],
      "position" : 0
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 34,
        "clustering" : [ "user6284781860667377211" ],
        "deletion_info" : { "marked_deleted" : "2024-02-02T07:47:31.542677Z", "local_delete_time" : "2024-02-02T07:47:31Z" },
        "cells" : [ ]
      }
    ]
  }
]

When I do a lot of writing and deleting, I find that some properties of the records do not exist when reading data. I have found the SSTable content information for this record. There are three pieces of information in total.

  1. Write information, but no deletion_ info field.
    "rows" : [
      {
        "type" : "row",
        "position" : 406041271,
        "clustering" : [ "hashKeyPrefix47470122111" ],
        "liveness_info" : { "tstamp" : "2024-01-28T08:01:22.490042Z" },
        "cells" : [
          { "name" : "\":attrs\"", "path" : [ "field0" ], "value" : "0x01796c6c754e4a4853704e675577744645714751496b6a6f73464d5550575a755a5543746a7a5a4b61784746777268684159495a6956704d774c76426b514f665472694d634f6d52686744654d6171437165704d73444f726769724b6a4f4d67494a576472" },
          { "name" : "\":attrs\"", "path" : [ "field1" ], "value" : "0x0165537a666f44726757736f524b6350424e4e6e4b416b7371504e4f676849706d4b574b716a534a616e4c464c7857466c674c4555666c624d496752597078736755637346744556764a624c5371515767615a496f7964656e4b76616674627775744c4a7a" },
          { "name" : "\":attrs\"", "path" : [ "field2" ], "value" : "0x016b445769477067685a674571537a467843786d437950635a794a4c6565464457764e4476494272424d6873715066555457424d434a7450416e7443726178624450534f5063456a7a6c4f72614c4262506676695a5061756d4f79616b494e6a6c4771616c" },
          { "name" : "\":attrs\"", "path" : [ "field3" ], "value" : "0x01476c42647965435979596b4d6c75736b4e74756b6967534e765267756e6b45674d675474696352785559626e7368475276436e4379656645556c6851646877556f566873564755414c6f6b6a43674b4e71594369536f614a6c795343716b746e626e7246" },
          { "name" : "\":attrs\"", "path" : [ "field4" ], "value" : "0x01514f63674167714777686a5666667361414e47424363424b434945657770486b4375526b6e715164566b786750447a567152665968516e5368766171444e554f5967547079694b6d504d66414746497a6d41626a6548676f75646e787279755348505078" }
        ]
      }
    ]
  1. have liveness_info and deletion_ info field, but cells are empty.
    "rows" : [
      {
        "type" : "row",
        "position" : 49131273,
        "clustering" : [ "hashKeyPrefix47470122111" ],
        "liveness_info" : { "tstamp" : "2024-01-28T08:01:22.490042Z" },
		"deletion_info" : { "marked_deleted" : "2024-01-28T8:01:22.490041Z", "local delete time" : "2024-01-28T08:01:22z" },
        "cells" : [ ]
      }
    ]
  1. Normal deletion of records.
	"rows" : [
      {
        "type" : "row",
        "position" : 19100032,
        "clustering" : [ "hashKeyPrefix47470122111" ],
		"deletion_info" : { "marked_deleted" : "2024-01-31T11:20:22.852785Z", "local delete time" : "2024-01-31T11:20:22Z" },
        "cells" : [ ]
      }
    ]

So, what I want to ask is, should a normal write record include both liveness_info and deletion_info, and cells is not empty. Is there a problem with the first and second types of records? Seeing time happening simultaneously. Is the second type caused by data loss?
Thanks!

Before 2024-01-31, what will happen if you read this row ?
I guess there are two possibilities, one is reading 1 (containing cells data), and the other is reading 2 (not containing cells data), because the tstamp of liveness_info of 1 and 2 is exactly the same(“2024-01-28T08:01:22.490042Z”). Looks like this is a BUG?

This is C*'s sstabledump and I’m not that familiar with the output-format of this tool, but I think that liveness_info is the row_marker. The row_marker is inserted only by INSERT statements, but not UPDATE statements. A row not having this is completely fine, this is not a data loss.

For a more clear output, you can try scylla-sstable, which is our ScyllaDB-native reimplementation of sstabledump. This tool is available in 5.1 already, but best to use the latest 5.2 or 5.4 for the best experience.

1 Like

Hi!
I want to know what the second situation represents? liveness_info time is later than deletion_info time, but cells are empty. Does it mean that this record is alive but the attribute is empty? But the first type of record and the second type of record are the same record, which is a bit contradictory. Because the cells of the first type of record are not empty.

In (1) you have a row marker and the row has cells. In (2) the row has a row tombstone which covers the cells so they are removed, but it doesn’t cover the row-marker. In (3) there is a new row tombstone which now also covers the row-marker (and so the row marker is also removed).

The row marker (liveness_info) does not apply to the row’s content, only the row itself. A row with a live row marker, but no cells, will appear in CQL as an empty row, with just the clustering and static columns having any value.