Undefined method `analyze_interval' for Gitlab::Database::Partitioning::IntRangeStrategy

Summary

After we updated GitLab on our self-hosted GitLab instance, I've been seeing the following error every 6 hours in /var/log/gitlab/gitlab-rails/application_json.log:

Failed to create / detach partition(s)

undefined method `analyze_interval' for #<Gitlab::Database::Partitioning::IntRangeStrategy:0x00007fff87214678 @model=#<Class:0x00007fff87216c20>(authored_date: datetime, committed_date: datetime, sha: binary, message: text, trailers: jsonb, commit_author_id: integer, committer_id: integer, merge_request_diff_id: integer, relative_order: integer), @partitioning_key=:merge_request_diff_id, @partition_size=200000000>

          model.partitioning_strategy.analyze_interval
                                     ^^^^^^^^^^^^^^^^^

Steps to reproduce

n/a — this is an automatic background process

Example Project

n/a — not project-specific

What is the current bug behavior?

Background partitioning fails and logs an error.

What is the expected correct behavior?

Background partitioning process completes successfully without logging errors.

Relevant logs and/or screenshots

See above.

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:
Proxy:          no
Current User:   git
Using RVM:      no
Ruby Version:   3.1.4p223
Gem Version:    3.5.6
Bundler Version:2.5.6
Rake Version:   13.0.6
Redis Version:  7.0.15
Sidekiq Version:7.1.6
Go Version:     unknown

GitLab information
Version:        16.10.2-ee
Revision:       0be71eb07ff
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     PostgreSQL
DB Version:     13.14
URL:            https://redacted
HTTP Clone URL: https://redacted/some-group/some-project.git
SSH Clone URL:  git@redacted:some-group/some-project.git
Elasticsearch:  yes
Geo:            no
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers: openid_connect

GitLab Shell
Version:        14.34.0
Repository storages:
- default:      unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:              /opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address:      unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version:      16.10.2
- default Git Version:  2.43.0

Results of GitLab application Check

Expand for output related to the GitLab application check
root@gitlab-lx 2 ~ -> gitlab-rake gitlab:check SANITIZE=true
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 14.34.0 ? ... OK (14.34.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Checking Reply by email ...

IMAP server credentials are correct? ... Checking gitlabincoming yes Mailroom enabled? ... skipped MailRoom running? ... skipped

Checking Reply by email ... Finished

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Database config exists? ... yes Tables are truncated? ... skipped All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Cable config exists? ... yes Resque config exists? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units) Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units) Projects have namespace: ... 62/538 ... yes 77/1262 ... yes 77/1263 ... yes 77/1264 ... yes 77/1265 ... yes 77/1266 ... yes 77/1267 ... yes 43/1268 ... yes 43/1269 ... yes 43/1270 ... yes 446/1271 ... yes 43/1273 ... yes 43/1274 ... yes 109/1275 ... yes 43/1276 ... yes 43/1277 ... yes 46/1278 ... yes 46/1279 ... yes 46/1280 ... yes 46/1281 ... yes 46/1282 ... yes 43/1283 ... yes 43/1284 ... yes 47/1285 ... yes 47/1286 ... yes 47/1287 ... yes 79/1288 ... yes 79/1289 ... yes 79/1290 ... yes 79/1291 ... yes 99/1292 ... yes 43/1293 ... yes 43/1294 ... yes 43/1295 ... yes 50/1296 ... yes 50/1297 ... yes 50/1298 ... yes 50/1299 ... yes 50/1300 ... yes 50/1301 ... yes 50/1302 ... yes 50/1303 ... yes 50/1304 ... yes 50/1305 ... yes 43/1306 ... yes 43/1307 ... yes 43/1308 ... yes 43/1309 ... yes 43/1310 ... yes 87/1311 ... yes 87/1312 ... yes 43/1313 ... yes 43/1314 ... yes 52/1315 ... yes 52/1316 ... yes 52/1317 ... yes 52/1318 ... yes 53/1319 ... yes 53/1320 ... yes 53/1321 ... yes 54/1322 ... yes 54/1323 ... yes 54/1324 ... yes 54/1325 ... yes 54/1326 ... yes 54/1327 ... yes 43/1328 ... yes 43/1329 ... yes 43/1330 ... yes 43/1331 ... yes 43/1332 ... yes 43/1333 ... yes 55/1334 ... yes 55/1335 ... yes 55/1336 ... yes 55/1337 ... yes 55/1338 ... yes 55/1339 ... yes 55/1340 ... yes 43/1341 ... yes 43/1342 ... yes 56/1344 ... yes 43/1345 ... yes 43/1346 ... yes 43/1347 ... yes 43/1348 ... yes 43/1349 ... yes 43/1350 ... yes 43/1351 ... yes 78/1352 ... yes 57/1353 ... yes 57/1354 ... yes 57/1355 ... yes 57/1356 ... yes 57/1357 ... yes 57/1358 ... yes 43/1359 ... yes 43/1360 ... yes 43/1361 ... yes 43/1362 ... yes 43/1363 ... yes 43/1364 ... yes 43/1365 ... yes 43/1366 ... yes 43/1367 ... yes 43/1368 ... yes 43/1369 ... yes 43/1370 ... yes 43/1371 ... yes 43/1372 ... yes 43/1373 ... yes 43/1374 ... yes 42/1375 ... yes 61/1376 ... yes 61/1377 ... yes 61/1378 ... yes 61/1379 ... yes 80/1380 ... yes 80/1381 ... yes 83/1382 ... yes 83/1383 ... yes 85/1384 ... yes 42/1385 ... yes 42/1386 ... yes 42/1387 ... yes 42/1388 ... yes 42/1389 ... yes 42/1390 ... yes 42/1391 ... yes 42/1392 ... yes 42/1393 ... yes 42/1394 ... yes 42/1395 ... yes 42/1396 ... yes 42/1397 ... yes 42/1398 ... yes 42/1399 ... yes 42/1400 ... yes 42/1401 ... yes 42/1402 ... yes 42/1403 ... yes 42/1404 ... yes 42/1405 ... yes 42/1406 ... yes 42/1407 ... yes 42/1408 ... yes 42/1409 ... yes 62/1410 ... yes 81/1411 ... yes 81/1412 ... yes 81/1413 ... yes 81/1414 ... yes 82/1415 ... yes 82/1416 ... yes 62/1417 ... yes 62/1418 ... yes 62/1419 ... yes 62/1420 ... yes 62/1421 ... yes 62/1422 ... yes 62/1423 ... yes 62/1424 ... yes 62/1425 ... yes 62/1426 ... yes 62/1427 ... yes 62/1428 ... yes 62/1429 ... yes 43/1430 ... yes 88/1431 ... yes 88/1432 ... yes 88/1433 ... yes 88/1434 ... yes 88/1435 ... yes 88/1436 ... yes 69/1437 ... yes 69/1438 ... yes 69/1439 ... yes 69/1440 ... yes 69/1441 ... yes 4/1442 ... yes 4/1443 ... yes 4/1444 ... yes 4/1445 ... yes 4/1446 ... yes 74/1447 ... yes 75/1448 ... yes 75/1449 ... yes 75/1450 ... yes 75/1451 ... yes 75/1452 ... yes 75/1453 ... yes 64/1454 ... yes 64/1455 ... yes 64/1456 ... yes 64/1457 ... yes 64/1458 ... yes 84/1459 ... yes 84/1460 ... yes 84/1461 ... yes 43/1462 ... yes 56/1463 ... yes 64/1464 ... yes 4/1465 ... yes 85/1466 ... yes 57/1467 ... yes 57/1468 ... yes 57/1469 ... yes 84/1470 ... yes 84/1471 ... yes 84/1472 ... yes 84/1473 ... yes 84/1474 ... yes 84/1475 ... yes 84/1476 ... yes 84/1477 ... yes 84/1478 ... yes 84/1479 ... yes 84/1480 ... yes 84/1481 ... yes 84/1482 ... yes 84/1483 ... yes 84/1484 ... yes 84/1485 ... yes 84/1486 ... yes 84/1487 ... yes 84/1488 ... yes 84/1489 ... yes 84/1490 ... yes 84/1491 ... yes 84/1492 ... yes 84/1493 ... yes 84/1494 ... yes 84/1495 ... yes 84/1496 ... yes 94/1497 ... yes 94/1498 ... yes 94/1499 ... yes 94/1500 ... yes 103/1502 ... yes 103/1503 ... yes 103/1504 ... yes 103/1505 ... yes 103/1506 ... yes 103/1507 ... yes 103/1508 ... yes 103/1509 ... yes 103/1510 ... yes 103/1511 ... yes 103/1512 ... yes 103/1513 ... yes 103/1514 ... yes 103/1515 ... yes 103/1516 ... yes 103/1517 ... yes 103/1518 ... yes 103/1519 ... yes 103/1520 ... yes 103/1521 ... yes 103/1522 ... yes 103/1523 ... yes 103/1524 ... yes 103/1526 ... yes 103/1527 ... yes 103/1530 ... yes 103/1531 ... yes 103/1532 ... yes 103/1533 ... yes 103/1534 ... yes 103/1535 ... yes 103/1536 ... yes 103/1537 ... yes 103/1538 ... yes 103/1539 ... yes 103/1540 ... yes 103/1541 ... yes 103/1542 ... yes 103/1543 ... yes 103/1544 ... yes 103/1545 ... yes 7/1547 ... yes 99/1549 ... yes 101/1550 ... yes 106/1552 ... yes 103/1553 ... yes 43/1554 ... yes 106/1555 ... yes 107/1556 ... yes 103/1557 ... yes 94/1558 ... yes 94/1559 ... yes 108/1560 ... yes 109/1561 ... yes 106/1562 ... yes 109/1563 ... yes 101/1564 ... yes 62/1565 ... yes 103/1566 ... yes 4/1567 ... yes 62/1568 ... yes 50/1569 ... yes 50/1570 ... yes 99/1571 ... yes 99/1572 ... yes 57/1573 ... yes 417/1574 ... yes 103/1575 ... yes 62/1576 ... yes 57/1577 ... yes 422/1578 ... yes 7/1579 ... yes 84/1580 ... yes 84/1581 ... yes 84/1582 ... yes 84/1583 ... yes 103/1584 ... yes 57/1585 ... yes 62/1586 ... yes 434/1587 ... yes 436/1588 ... yes 436/1589 ... yes 439/1590 ... yes 56/1591 ... yes 42/1592 ... yes 69/1593 ... yes 446/1594 ... yes 84/1595 ... yes 6/1596 ... yes 444/1597 ... yes 444/1598 ... yes 454/1599 ... yes Redis version >= 6.2.14? ... yes Ruby version >= 3.0.6 ? ... yes (3.1.4) Git user has default SSH configuration? ... yes Active users: ... 9 Is authorized keys file accessible? ... skipped (authorized keys not enabled) GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x-8.x or OpenSearch version 1.x ... yes (elasticsearch 8.12.1) All migrations must be finished before doing a major upgrade ... yes

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

In https://gitlab.com/gitlab-org/gitlab/-/tree/master/lib/gitlab/database/partitioning, it looks like some of the strategies have a analyze_interval property but others don't. I think either IntRangeStrategy will need to add this property, or the caller (https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/database/partitioning/partition_manager.rb) will need to check whether the object has that property before trying to access it.