static String writeIndexName(Model model, long timeBucket) {
        String tableName = IndexController.INSTANCE.getTableName(model);
        if (model.isRecord() && model.isSuperDataset()) {
            return tableName + Const.LINE + compressTimeBucket(timeBucket / 1000000, SUPER_DATASET_DAY_STEP);
        } else {
            switch (model.getDownsampling()) {
                case None:
                    return tableName;
                case Hour:
                    return tableName + Const.LINE + compressTimeBucket(timeBucket / 100, DAY_STEP);
                case Minute:
                    return tableName + Const.LINE + compressTimeBucket(timeBucket / 10000, DAY_STEP);
                case Day:
                    return tableName + Const.LINE + compressTimeBucket(timeBucket, DAY_STEP);
                case Second:
                    return tableName + Const.LINE + compressTimeBucket(timeBucket / 1000000, DAY_STEP);
                default:
                    throw new UnexpectedException("Unexpected down sampling value, " + model.getDownsampling());
            }
        }
    }
@Test
    public void testIndexRolling() {
        long secondTimeBucket = 2020_0809_1010_59L;
        long minuteTimeBucket = 2020_0809_1010L;

        Assertions.assertEquals(
            "superDatasetModel-20200809",
            writeIndexName(superDatasetModel, secondTimeBucket)
        );
        Assertions.assertEquals(
            "records-all-20200807",
            writeIndexName(normalRecordModel, secondTimeBucket)
        );
        Assertions.assertEquals(
            "metrics-all-20200807",
            writeIndexName(normalMetricsModel, minuteTimeBucket)
        );
        secondTimeBucket += 1000000;
        minuteTimeBucket += 10000;
        Assertions.assertEquals(
            "superDatasetModel-20200810",
            writeIndexName(superDatasetModel, secondTimeBucket)
        );
        Assertions.assertEquals(
            "records-all-20200810",
            writeIndexName(normalRecordModel, secondTimeBucket)
        );
        Assertions.assertEquals(
            "metrics-all-20200810",
            writeIndexName(normalMetricsModel, minuteTimeBucket)
        );
    }