Github user ravipesala commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2176#discussion_r182136198
--- Diff:
core/src/main/java/org/apache/carbondata/core/metadata/schema/table/DiskBasedDMSchemaStorageProvider.java
---
@@ -135,9 +161,49 @@ public DiskBasedDMSchemaStorageProvider(String
storePath) {
if (!FileFactory.isFileExist(schemaPath,
FileFactory.getFileType(schemaPath))) {
throw new IOException("DataMap with name " + dataMapName + " does
not exists in storage");
}
-
+ DataMapSchema dataMapSchemaToRemove = null;
+ for (DataMapSchema dataMapSchema : dataMapSchemas) {
+ if (dataMapSchema.getDataMapName().equalsIgnoreCase(dataMapName)) {
+ dataMapSchemaToRemove = dataMapSchema;
+ }
+ }
+ if (dataMapSchemaToRemove != null) {
+ dataMapSchemas.remove(dataMapSchemaToRemove);
+ }
if (!FileFactory.deleteFile(schemaPath,
FileFactory.getFileType(schemaPath))) {
throw new IOException("DataMap with name " + dataMapName + " cannot
be deleted");
+ } else {
+ touchMDTFile();
+ }
+ }
+
+ private void checkAndReloadDataMapSchemas() throws IOException {
+ if (FileFactory.isFileExist(mdtFilePath)) {
+ long lastModifiedTime =
FileFactory.getCarbonFile(mdtFilePath).getLastModifiedTime();
+ if (this.lastModifiedTime != lastModifiedTime) {
+ dataMapSchemas = retrieveAllSchemasInternal();
+ this.lastModifiedTime = lastModifiedTime;
+ }
+ } else {
+ touchMDTFile();
+ retrieveAllSchemasInternal();
--- End diff --
ok
---