# Why are there already 8 tablets in the wals sub-directory under the data directory after a database cluster is initialized?

**URL:** <https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768>\
**Category:** General\
**Created:** [July 19, 2024, 11:55am UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768 "2024-07-19T11:55:40Z")\
**Posts on this page:** 14\
**Page:** 2

<div class="post-metadata">

**Author:** ![Alan\_Caldera](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/alan_caldera/32/91_2.png) [@Alan\_Caldera](https://forum.yugabyte.com/u/Alan_Caldera)\
**Post date:** [July 22, 2024, 12:31pm UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768/21 "2024-07-22T12:31:22Z")

</div>

Zhen Nan –

So to “partially” pack a row – you can set the GFlag _ysql\_packed\_row\_size\_limit_ to be the maximum size of the the “packed” row. So once the limit has been reached, all columns after that remain in the “unpacked” format.

–Alan

---

<div class="post-metadata">

**Author:** ![ZhenNan2016](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/zhennan2016/32/623_2.png) [@ZhenNan2016](https://forum.yugabyte.com/u/ZhenNan2016)\
**Post date:** [July 22, 2024, 2:13pm UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768/22 "2024-07-22T14:13:23Z")

</div>

Hi @Alan_Caldera  
Setting the GFlag _ysql\_packed\_row\_size\_limit_ to be the maximum size of the the “packed” row，there may be no way to accomplish the following realizations：  
There are four columns A, B, C, and D. I only do packed for A, B, and C, and column D is stored separately.  
e.g.  
(hash1, [6,7], 8), system\_column\_id, T1 → [NULL]  
(hash1, [6,7], 8), v1\_column\_id, T1 → 9  
(hash1, [6,7], 8), v2\_column\_id, T1 → 10

packed row: \<(hash1, [6,7], 8), packed { [NULL]，9}\>  
and non-packed: (hash1, [6,7], 8), v2\_column\_id, T1 → 10  
Thanks a lot.

---

<div class="post-metadata">

**Author:** ![FranckPachot](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/franckpachot/32/353_2.png) [@FranckPachot](https://forum.yugabyte.com/u/FranckPachot)\
**Post date:** [July 24, 2024, 2:46am UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768/23 "2024-07-24T02:46:03Z")

</div>

Hi @ZhenNan2016 in tomorrow’s Community Open Hours (in 12 hours from now) we will explain a few questions picked from the forum.  
There are some from you, so if you want to join in the chat it would be great 🙂

[![](https://canada1.discourse-cdn.com/flex027/uploads/yugabyte/original/1X/73b4e3d09c4e3f91b21989107cf9135c3104e41a.jpeg "Community Open Hours: YugabyteDB Storage Internals in Action") ](https://www.youtube.com/watch?v=kjlBXqiHeT0)

---

<div class="post-metadata">

**Author:** ![ZhenNan2016](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/zhennan2016/32/623_2.png) [@ZhenNan2016](https://forum.yugabyte.com/u/ZhenNan2016)\
**Post date:** [July 24, 2024, 6:54am UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768/24 "2024-07-24T06:54:50Z")

</div>

> [@FranckPachot](#):
>
> There are some from you, so if you want to join in the chat it would be great

Thank you.  
But online real time communication, my English is still weak and I may not be able to keep up.

---

<div class="post-metadata">

**Author:** ![ZhenNan2016](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/zhennan2016/32/623_2.png) [@ZhenNan2016](https://forum.yugabyte.com/u/ZhenNan2016)\
**Post date:** [July 24, 2024, 3:05pm UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768/25 "2024-07-24T15:05:02Z")

</div>

> [@FranckPachot](#):
>
> There are some from you, so if you want to join in the chat it would be great

Hi @FranckPachot  
The conditions are such that we can only see the video, not the sound.  
Is there a replay video I can watch after the live stream?

---

<div class="post-metadata">

**Author:** ![FranckPachot](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/franckpachot/32/353_2.png) [@FranckPachot](https://forum.yugabyte.com/u/FranckPachot)\
**Post date:** [July 24, 2024, 5:28pm UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768/26 "2024-07-24T17:28:30Z")

</div>

Sure, it’s on Youtube: [https://www.youtube.com/watch?v=kjlBXqiHeT0&ab\_channel=Yugabyte](https://www.youtube.com/watch?v=kjlBXqiHeT0&ab_channel=Yugabyte)

---

<div class="post-metadata">

**Author:** ![ZhenNan2016](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/zhennan2016/32/623_2.png) [@ZhenNan2016](https://forum.yugabyte.com/u/ZhenNan2016)\
**Post date:** [July 30, 2024, 7:48am UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768/27 "2024-07-30T07:48:48Z")

</div>

> [@Alan\_Caldera](#):
>
> If you turn off packed rows via the GFlag (ysql\_enable\_packed\_row) , DocDB reverts to storing each column as a separate record in DocDB as the column number is part of the DocKey

Hi @dorian_yugabyte @Alan_Caldera  
Excuse me, one more question I need to check with you: when the ysql\_enable\_packed\_row is closed, all the columns of a row of data, do they all have the same key? Does the key determine if they are all stored on the same node in the cluster? Or is it possible to store them across nodes? For example, if there are four columns, A, B, C, D, do all the columns of A, B, C, D exist on one node? Or is it possible that the four columns are stored on different nodes?  
Thanks a lot.

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [July 30, 2024, 8:11am UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768/28 "2024-07-30T08:11:40Z")

</div>

> [@ZhenNan2016](#):
>
> all the columns of a row of data, do they all have the same key?

They don’t have the same key. There’s a key for each column, which includes the `column_id`. You can see the full key that ends up in rocksdb here: [DocDB data model | YugabyteDB Docs](https://docs.yugabyte.com/preview/architecture/docdb/data-model/)

> [@ZhenNan2016](#):
>
> Does the key determine if they are all stored on the same node in the cluster?

The sharding columns determine on which tablet the whole row will reside.

> [@ZhenNan2016](#):
>
> Or is it possible that the four columns are stored on different nodes?

No. All columns of a row will reside inside 1 tablet.

---

<div class="post-metadata">

**Author:** ![ZhenNan2016](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/zhennan2016/32/623_2.png) [@ZhenNan2016](https://forum.yugabyte.com/u/ZhenNan2016)\
**Post date:** [July 30, 2024, 8:59am UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768/29 "2024-07-30T08:59:47Z")

</div>

> [@dorian\_yugabyte](#):
>
> No. All columns of a row will reside inside 1 tablet.

Hi @dorian_yugabyte  
Thanks for your reply.  
Previously Alan\_Caldera mentioned: we built the packed row feature as an optimization to reduce the number of seeks and puts when reading and writing to the database.  
Well, all columns of a row will reside inside 1 tablet if turn off packed rows via the GFlag (ysql\_enable\_packed\_row). so, it’s really just an increase in seeks between multiple blocks when reading the data?

---

<div class="post-metadata">

**Author:** ![FranckPachot](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/franckpachot/32/353_2.png) [@FranckPachot](https://forum.yugabyte.com/u/FranckPachot)\
**Post date:** [July 30, 2024, 9:35am UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768/30 "2024-07-30T09:35:08Z")

</div>

> [@ZhenNan2016](#):
>
> so, it’s really just an increase in seeks between multiple blocks when reading the data?

Yes, what we call “seek” is the rocksdb seek, finding a key in the LSM Tree. It’s still within one tablet.

---

<div class="post-metadata">

**Author:** ![ZhenNan2016](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/zhennan2016/32/623_2.png) [@ZhenNan2016](https://forum.yugabyte.com/u/ZhenNan2016)\
**Post date:** [July 30, 2024, 9:51am UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768/31 "2024-07-30T09:51:22Z")

</div>

Okay, I got it now.  
Thanks a lot.

---

<div class="post-metadata">

**Author:** ![ZhenNan2016](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/zhennan2016/32/623_2.png) [@ZhenNan2016](https://forum.yugabyte.com/u/ZhenNan2016)\
**Post date:** [July 31, 2024, 10:22am UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768/32 "2024-07-31T10:22:56Z")

</div>

> [@dorian\_yugabyte](#):
>
> No. All columns of a row will reside inside 1 tablet.

Hi @dorian_yugabyte @FranckPachot  
I have a question for you, which is described below:  
The sql operation I am performing is as follows:  
bigmath=# CREATE TABLE test3(id int PRIMARY KEY,descr text, age int);  
CREATE TABLE  
bigmath=# INSERT INTO test3 VALUES (30, ‘Phone X550’, 40), (31, ‘Tablet Z220’, 80);  
INSERT 0 2  
bigmath=# select \* from test3;  
id | descr | age  
----±------------±----  
30 | Phone X550 | 40  
31 | Tablet Z220 | 80  
(2 rows)

From the above execution result, it is successful. tserver’s log message can see that the “packed row” is successful:  
T 36733a2f8a5e40fba97a8ce180ad06a7 P 7330ce09bc8546c39ebb29dce08435e1: Wrote 2 key/value pairs to kRegular RocksDB:  
T 36733a2f8a5e40fba97a8ce180ad06a7 P 7330ce09bc8546c39ebb29dce08435e1 [R]: 1. PutCF: SubDocKey(DocKey(0xa5db, [30], ), [HT{ days: 19935 time: 18:04:46.717841 }]) =\> { 11: “Phone X550” 12: 40 }  
T 36733a2f8a5e40fba97a8ce180ad06a7 P 7330ce09bc8546c39ebb29dce08435e1 [R]: 2. PutCF: SubDocKey(DocKey(0xee14, [31], ), [HT{ days: 19935 time: 18:04:46.717841 w: 1 }]) =\> { 11: “Tablet Z220” 12: 80 }

But executing the sst\_dump command didn’t parse properly from the sst file:  
./sst\_dump --output\_format=decoded\_regulardb --command=scan --file=/home/bigmath/bigmath-data/node-1/disk-1/bm-data/dbserver/data/rocksdb/table-000034a2000030008000000000004305/tablet-36733a2f8a5e40fba97a8ce180ad06a7  
from to   
Process /home/bigmath/bigmath-data/node-1/disk-1/bm-data/dbserver/data/rocksdb/table-000034a2000030008000000000004305/tablet-36733a2f8a5e40fba97a8ce180ad06a7/000010.sst  
Sst file format: block-based  
SubDocKey(DocKey(0xa5db, [30], ), [HT{ physical: 1722420286717841 }]) → Not found (kv\_debug.cc:125): No packing information available  
SubDocKey(DocKey(0xee14, [31], ), [HT{ physical: 1722420286717841 w: 1 }]) → Not found (kv\_debug.cc:125): No packing information available

May I ask, is this the wrong way to dump? Is there any other correct way?  
Thanks a lot.

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [July 31, 2024, 10:30am UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768/33 "2024-07-31T10:30:36Z")

</div>

> [@ZhenNan2016](#):
>
> No packing information available

It doesn’t know how to read the packed rows. You need to set the metadata using `--formatter_tablet_metadata=/home/bigmath/bigmath-data/node-1/disk-1/bm-data/dbserver/tablet-meta/36733a2f8a5e40fba97a8ce180ad06a7`

See [What's the equivalent of pageinspect in YugabyteDB? - DEV Community](https://dev.to/yugabyte/whats-the-equivalent-of-pageinspect-in-yugabytedb-21nh) as example

---

<div class="post-metadata">

**Author:** ![ZhenNan2016](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/zhennan2016/32/623_2.png) [@ZhenNan2016](https://forum.yugabyte.com/u/ZhenNan2016)\
**Post date:** [July 31, 2024, 11:59am UTC](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768/34 "2024-07-31T11:59:46Z")

</div>

It’s great. Thank you very much.

[Previous page](https://forum.yugabyte.com/t/why-are-there-already-8-tablets-in-the-wals-sub-directory-under-the-data-directory-after-a-database-cluster-is-initialized/2768.md?page=1)
