simonbence commented on a change in pull request #4883:
URL: https://github.com/apache/nifi/pull/4883#discussion_r592153610
##########
File path:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/history/EmbeddedQuestDbRolloverHandlerTest.java
##########
@@ -75,68 +95,146 @@ public void tearDown() throws Exception {
}
@Test
- public void testRollOverWhenWithEmptyDatabase() throws Exception {
+ public void testNoOffsetTimeZoneWhenPartitionNeedsToBeRolled() throws
Exception {
+ // given
+ givenTableIsCreated(dbContext);
+ givenTableIsPopulated(UTC_MAR_5_1200, UTC_MAR_6_1200, UTC_MAR_7_1200,
UTC_MAR_8_1200);
+
+ // when
+ whenRollOverIsExecuted(UTC_MAR_8_1700);
+
+ // then
+ thenTheRemainingPartitionsAre("2021-03-06", "2021-03-07",
"2021-03-08");
+ }
+
+ @Test
+ // This scenario might occur when the NiFi was stopped and the persistent
storage remains in place
+ public void testNoOffsetTimeZoneAndNonConsecutive() throws Exception {
+ // given
+ givenTableIsCreated(dbContext);
+ givenTableIsPopulated(UTC_MAR_1_1200, UTC_MAR_2_1200, UTC_MAR_7_1200,
UTC_MAR_8_1200);
+
+ // when
+ whenRollOverIsExecuted(UTC_MAR_8_1700);
+
+ // then
+ thenTheRemainingPartitionsAre("2021-03-07", "2021-03-08");
+ }
+
+ @Test
+ public void testNoOffsetTimeWhenNoPartitionsNeedToBeDropped() throws
Exception {
+ // given
+ givenTableIsCreated(dbContext);
+ givenTableIsPopulated(UTC_MAR_6_1200, UTC_MAR_7_1200, UTC_MAR_8_1200);
+
+ // when
+ whenRollOverIsExecuted(UTC_MAR_8_1700);
+
+ // then
+ thenTheRemainingPartitionsAre("2021-03-06", "2021-03-07",
"2021-03-08");
+ }
+
+ @Test
+ public void testNoOffsetTimeZoneAndLessPartitionThanNeeded() throws
Exception {
+ // given
+ givenTableIsCreated(dbContext);
+ givenTableIsPopulated(UTC_MAR_7_1200, UTC_MAR_8_1200);
+
+ // when
+ whenRollOverIsExecuted(UTC_MAR_8_1700);
+
+ // then
+ thenTheRemainingPartitionsAre("2021-03-07", "2021-03-08");
+ }
+
+ @Test
+ public void testNoOffsetTimeZoneAndOldPartitionsOnly() throws Exception {
// given
givenTableIsCreated(dbContext);
+ givenTableIsPopulated(UTC_MAR_1_1200, UTC_MAR_2_1200);
// when
- whenRollOverIsExecuted();
+ whenRollOverIsExecuted(UTC_MAR_8_1700);
+
+ // then - QuestDB will not remove the active partition if presents
+ thenTheRemainingPartitionsAre("2021-03-02");
Review comment:
I would believe this is such a technical detail which should not appear
in documentation and might be confusing without serious explanation. In
general, QuestDB is handled more like a blackbox for the users and I think we
should not expect much expertise on the topic from the users. Describing this
in a meaningful way would mean we would have to introduce terms like
partitioning and alike.
In the other hand, this is more like a safeguard for a corner case: this
should happen only when a NiFi instance (after running) is stopped for multiple
days. Even further: without this additional logic, the system would work
properly, but with a strange error during start. (As the partition is not
deletable) The safeguard merely prevents us from this
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]