# Timeout compacting table

**URL:** <https://forum.yugabyte.com/t/timeout-compacting-table/1378>\
**Category:** General\
**Created:** [January 5, 2022, 2:32pm UTC](https://forum.yugabyte.com/t/timeout-compacting-table/1378 "2022-01-05T14:32:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![crabhi](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/crabhi/32/438_2.png) [@crabhi](https://forum.yugabyte.com/u/crabhi)\
**Post date:** [January 5, 2022, 2:32pm UTC](https://forum.yugabyte.com/t/timeout-compacting-table/1378/1 "2022-01-05T14:32:08Z")

</div>

Hi, I have a 3 server cluster. I imported some data but I noticed it uses more disk space than I expected. However, compacting table manually times out.

```auto
admin@yb-0:~$ yb-admin -master_addresses $MASTER_ADDRS compact_table ysql.yugabyte xyz
Error running compact_table: Timed out (yb/client/client-internal.cc:146): Unable to compact table yugabyte.xyz: Timed out waiting for FlushTables

```

Each server is doing about 800 IOPS and uses ~2 CPU cores at the moment, although the `/tasks` view doesn’t show any active task.

What is the DB doing? 🙂

---

<div class="post-metadata">

**Author:** ![crabhi](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/crabhi/32/438_2.png) [@crabhi](https://forum.yugabyte.com/u/crabhi)\
**Post date:** [January 5, 2022, 2:41pm UTC](https://forum.yugabyte.com/t/timeout-compacting-table/1378/2 "2022-01-05T14:41:08Z")

</div>

In the logs, I see lines like this:

```auto
W0105 14:39:06.360100 147224 async_rpc_tasks.cc:283] e731da422cc349e3b6f9cdeb7e019763 Flush Tablets RPC (task=0x000000000459d6d0, state=kRunning): TS e731da422cc349e3b6f9cdeb7e019763: Flush Tablets RPC failed for tablet : Timed out (yb/rpc/outbound_call.cc:503): FlushTablets RPC (request call id 2147) to 172.31.32.32:9100 timed out after 30.000s
W0105 14:39:06.360199 147224 async_rpc_tasks.cc:327] e731da422cc349e3b6f9cdeb7e019763 Flush Tablets RPC (task=0x000000000459d6d0, state=kRunning): Aborted (yb/master/async_rpc_tasks.cc:326): Reached maximum number of retries (0) for request e731da422cc349e3b6f9cdeb7e019763 Flush Tablets RPC, task=0x459d6d0 state=kRunning

```

---

<div class="post-metadata">

**Author:** ![crabhi](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/crabhi/32/438_2.png) [@crabhi](https://forum.yugabyte.com/u/crabhi)\
**Post date:** [January 5, 2022, 2:45pm UTC](https://forum.yugabyte.com/t/timeout-compacting-table/1378/3 "2022-01-05T14:45:16Z")

</div>

For reference - I imported around 19 GB and 5 GB (uncompressed) into two tables. There are 7 indexes including the primary keys.

The CPU and IOPS load might be caused by the compaction command actually. It disappears after a few minutes and appears again if I try `yb-admin compact_table` again.

---

<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:** [January 6, 2022, 9:15am UTC](https://forum.yugabyte.com/t/timeout-compacting-table/1378/4 "2022-01-06T09:15:55Z")

</div>

Hi @crabhi

> [@crabhi](#):
>
> What is the DB doing? 🙂

It’s doing a major compaction, compacting the whole table into a single sstable.

> [@crabhi](#):
>
> The CPU and IOPS load might be caused by the compaction command actually.

Yes, because it’s a heavy operation.

> [@crabhi](#):
>
> It disappears after a few minutes and appears again if I try `yb-admin compact_table` again.

Because it forces a major compaction even if it’s not necessary.

> [@crabhi](#):
>
> However, compacting table manually times out.

The task continues even if it timed out. You can increase the timeout with `--timeout_in_seconds=20`.

> [@crabhi](#):
>
> although the `/tasks` view doesn’t show any active task.

I don’t believe it’s supposed to show in `/tasks`.

---

<div class="post-metadata">

**Author:** ![crabhi](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/crabhi/32/438_2.png) [@crabhi](https://forum.yugabyte.com/u/crabhi)\
**Post date:** [January 6, 2022, 9:24am UTC](https://forum.yugabyte.com/t/timeout-compacting-table/1378/5 "2022-01-06T09:24:00Z")

</div>

In the /tasks list, there are the “flush” tasks for the three tablets. But they show as failed after the 30s timeout. So it means the operation succeeded but the success just wasn’t reported. Thank you for the explanation.
