forked from apache/pinot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce Disk Footprint for Segment Processor Framework to Avoid Out of…
… Disk Issues (apache#12220) * modularized map, reduce and segment generation phase. * added interfaces and classes * added staetefulrecordreaderfileconfig instead of recordreaderfileconfig * save Progress * major changes, working tests. * more changes * made the number of bytes to be configurable * added global sequence id to segments since it is modularised out, made the intermediate file size configurable through segmentsConfig. * remove logic for global segment IDs. * used recordreaderconfig instead of statefulrecordreaderconfig, changed looping conditions, made recordreader of recordreaderfileconfig modifiable. * added proper sequence ids for segments. * ingestion working without errors. Should be good in sunny day scenarios. * remove typo from testing * replace _partitionToFilemanagerMap with local variable asthe mapping is happening in multiple iterations. Change exception handling for mapper. * added precondition check for intermediateFileSizeThresholdInBytes and inferred observer from segmentsConfig * fix typo and add comment. * removed redundant method. * config related changes, fix unit tests. * remove redundant flag. * replaced size based constraint checker with size based constraint writer. * consolidated all the constraint checks into one place. * add test to validate segmentprocessorframework * decoupled recordreader closing logic from segment mapper * addressing comments related to segmentprocessorframework. * delegated initialisation and check for recordreader being done with all the records to recordreaderfileconfig. * simplify logic for termination of map phase. * change variable names for better readability. * Added tests and minor changes in logic - Added further tests for SegmentProcessorFramework. - Removed redundant checks for SegmentProcessorFramework. - Detected an edge case and added an additional statement in SegmentMapper. * isolated the termination logs to mapAndTransformRow. * Keep SegmentMapper public interface unchanged - Pass the total count of RecordReaders through SegmentMapper Constructor instead of map() arguments. * addressing review comments. * cleaned up logging logic. * Channged Logs * kept the logging for default scenario same as before * conditionally logged the progress between iterations in case the feature is enabled. * modify tests - PR apache#12290 touched dimBaseballTeams.csv on which the tests depends on. Modified the test to reflect that. - Changed import statements (addressed comment).
- Loading branch information
Showing
12 changed files
with
561 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...n/java/org/apache/pinot/core/segment/processing/genericrow/AdaptiveConstraintsWriter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.pinot.core.segment.processing.genericrow; | ||
|
||
import java.io.IOException; | ||
|
||
|
||
/** | ||
* Interface for a writer which can track constraints. This will be used by SegmentProcessorFramework. | ||
* */ | ||
|
||
public interface AdaptiveConstraintsWriter<W, D> { | ||
boolean canWrite(); | ||
|
||
void write(W writer, D dataUnit) | ||
throws IOException; | ||
} |
51 changes: 51 additions & 0 deletions
51
...ain/java/org/apache/pinot/core/segment/processing/genericrow/AdaptiveSizeBasedWriter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.pinot.core.segment.processing.genericrow; | ||
|
||
import java.io.IOException; | ||
import org.apache.pinot.spi.data.readers.GenericRow; | ||
|
||
|
||
public class AdaptiveSizeBasedWriter implements AdaptiveConstraintsWriter<GenericRowFileWriter, GenericRow> { | ||
|
||
private final long _bytesLimit; | ||
private long _numBytesWritten; | ||
|
||
public AdaptiveSizeBasedWriter(long bytesLimit) { | ||
_bytesLimit = bytesLimit; | ||
_numBytesWritten = 0; | ||
} | ||
|
||
public long getBytesLimit() { | ||
return _bytesLimit; | ||
} | ||
public long getNumBytesWritten() { | ||
return _numBytesWritten; | ||
} | ||
|
||
@Override | ||
public boolean canWrite() { | ||
return _numBytesWritten < _bytesLimit; | ||
} | ||
|
||
@Override | ||
public void write(GenericRowFileWriter writer, GenericRow row) throws IOException { | ||
_numBytesWritten += writer.writeData(row); | ||
} | ||
} |
Oops, something went wrong.