imay closed pull request #489: Fix bug that schema change on restored table 
will lose data
URL: https://github.com/apache/incubator-doris/pull/489
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/fe/src/main/java/org/apache/doris/backup/RestoreJob.java 
b/fe/src/main/java/org/apache/doris/backup/RestoreJob.java
index cb793ad9..2aadf74a 100644
--- a/fe/src/main/java/org/apache/doris/backup/RestoreJob.java
+++ b/fe/src/main/java/org/apache/doris/backup/RestoreJob.java
@@ -615,9 +615,9 @@ private void checkAndPrepareMeta() {
                     int schemaHash = 
localTbl.getSchemaHashByIndexId(restoredIdx.getId());
                     KeysType keysType = localTbl.getKeysType();
                     List<Column> columns = 
localTbl.getSchemaByIndexId(restoredIdx.getId());
+                    TabletMeta tabletMeta = new TabletMeta(db.getId(), 
localTbl.getId(), restorePart.getId(),
+                            restoredIdx.getId(), schemaHash);
                     for (Tablet restoreTablet : restoredIdx.getTablets()) {
-                        TabletMeta tabletMeta = new TabletMeta(db.getId(), 
localTbl.getId(),
-                                restorePart.getId(), restoredIdx.getId(), 
schemaHash);
                         
Catalog.getCurrentInvertedIndex().addTablet(restoreTablet.getId(), tabletMeta);
                         for (Replica restoreReplica : 
restoreTablet.getReplicas()) {
                             
Catalog.getCurrentInvertedIndex().addReplica(restoreTablet.getId(), 
restoreReplica);
@@ -650,9 +650,9 @@ private void checkAndPrepareMeta() {
                         int schemaHash = 
restoreTbl.getSchemaHashByIndexId(index.getId());
                         KeysType keysType = restoreTbl.getKeysType();
                         List<Column> columns = 
restoreTbl.getSchemaByIndexId(index.getId());
+                        TabletMeta tabletMeta = new TabletMeta(db.getId(), 
restoreTbl.getId(), restorePart.getId(),
+                                index.getId(), schemaHash);
                         for (Tablet tablet : index.getTablets()) {
-                            TabletMeta tabletMeta = new TabletMeta(db.getId(), 
restoreTbl.getId(),
-                                    restorePart.getId(), index.getId(), 
schemaHash);
                             
Catalog.getCurrentInvertedIndex().addTablet(tablet.getId(), tabletMeta);
                             for (Replica replica : tablet.getReplicas()) {
                                 
Catalog.getCurrentInvertedIndex().addReplica(tablet.getId(), replica);
@@ -926,9 +926,9 @@ private void replayCheckAndPrepareMeta() {
                 // modify tablet inverted index
                 for (MaterializedIndex restoreIdx : 
restorePart.getMaterializedIndices()) {
                     int schemaHash = 
localTbl.getSchemaHashByIndexId(restoreIdx.getId());
+                    TabletMeta tabletMeta = new TabletMeta(db.getId(), 
localTbl.getId(), restorePart.getId(),
+                            restoreIdx.getId(), schemaHash);
                     for (Tablet restoreTablet : restoreIdx.getTablets()) {
-                        TabletMeta tabletMeta = new TabletMeta(db.getId(), 
localTbl.getId(),
-                                restorePart.getId(), restoreIdx.getId(), 
schemaHash);
                         
Catalog.getCurrentInvertedIndex().addTablet(restoreTablet.getId(), tabletMeta);
                         for (Replica restoreReplica : 
restoreTablet.getReplicas()) {
                             
Catalog.getCurrentInvertedIndex().addReplica(restoreTablet.getId(), 
restoreReplica);
@@ -944,9 +944,9 @@ private void replayCheckAndPrepareMeta() {
                 for (Partition restorePart : restoreTbl.getPartitions()) {
                     for (MaterializedIndex restoreIdx : 
restorePart.getMaterializedIndices()) {
                         int schemaHash = 
restoreTbl.getSchemaHashByIndexId(restoreIdx.getId());
+                        TabletMeta tabletMeta = new TabletMeta(db.getId(), 
restoreTbl.getId(), restorePart.getId(),
+                                restoreIdx.getId(), schemaHash);
                         for (Tablet restoreTablet : restoreIdx.getTablets()) {
-                            TabletMeta tabletMeta = new TabletMeta(db.getId(), 
restoreTbl.getId(),
-                                    restorePart.getId(), restoreIdx.getId(), 
schemaHash);
                             
Catalog.getCurrentInvertedIndex().addTablet(restoreTablet.getId(), tabletMeta);
                             for (Replica restoreReplica : 
restoreTablet.getReplicas()) {
                                 
Catalog.getCurrentInvertedIndex().addReplica(restoreTablet.getId(), 
restoreReplica);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to