page-break-inside: avoid protects HTML element from being split.

It forces a page break before table2 if there is a chance to keep table2 not broken. If table2 height is higher than page height – it does not force a page break, as the table will be broken in any case. If also does not force a page break if table2 fits the remaining space on a page.

So if I understand you correctly, it works on your side as it should do.

If you need to force a page break, you may use tag or page-break-before: always CSS style applied to a block element.