37
37
import org .apache .accumulo .core .data .TableId ;
38
38
import org .apache .accumulo .core .fate .zookeeper .ZooCache ;
39
39
import org .apache .accumulo .core .fate .zookeeper .ZooReaderWriter ;
40
+ import org .apache .accumulo .core .fate .zookeeper .ZooUtil ;
40
41
import org .apache .accumulo .core .fate .zookeeper .ZooUtil .NodeExistsPolicy ;
41
42
import org .apache .accumulo .core .fate .zookeeper .ZooUtil .NodeMissingPolicy ;
42
43
import org .apache .accumulo .core .manager .state .tables .TableState ;
@@ -77,7 +78,7 @@ public static void prepareNewNamespaceState(final ServerContext context, Namespa
77
78
final InstanceId instanceId = context .getInstanceID ();
78
79
log .debug ("Creating ZooKeeper entries for new namespace {} (ID: {})" , namespace , namespaceId );
79
80
context .getZooReaderWriter ().putPersistentData (
80
- Constants . ZROOT + "/" + instanceId + Constants .ZNAMESPACES + "/" + namespaceId , new byte [0 ],
81
+ context . getZooKeeperRoot () + Constants .ZNAMESPACES + "/" + namespaceId , new byte [0 ],
81
82
existsPolicy );
82
83
var propKey = NamespacePropKey .of (instanceId , namespaceId );
83
84
if (!propStore .exists (propKey )) {
@@ -94,7 +95,7 @@ public static void prepareNewTableState(ZooReaderWriter zoo, PropStore propStore
94
95
tableName , tableId , namespaceId );
95
96
Pair <String ,String > qualifiedTableName = TableNameUtil .qualify (tableName );
96
97
tableName = qualifiedTableName .getSecond ();
97
- String zTablePath = Constants . ZROOT + "/" + instanceId + Constants .ZTABLES + "/" + tableId ;
98
+ String zTablePath = ZooUtil . getRoot ( instanceId ) + Constants .ZTABLES + "/" + tableId ;
98
99
zoo .putPersistentData (zTablePath , new byte [0 ], existsPolicy );
99
100
zoo .putPersistentData (zTablePath + Constants .ZTABLE_NAMESPACE ,
100
101
namespaceId .canonical ().getBytes (UTF_8 ), existsPolicy );
@@ -220,10 +221,10 @@ public void cloneTable(TableId srcTableId, TableId tableId, String tableName,
220
221
prepareNewTableState (zoo , context .getPropStore (), instanceID , tableId , namespaceId , tableName ,
221
222
TableState .NEW , NodeExistsPolicy .OVERWRITE );
222
223
223
- String srcTablePath = Constants . ZROOT + "/" + instanceID + Constants . ZTABLES + "/" + srcTableId
224
- + Constants .ZCONFIG ;
224
+ String srcTablePath =
225
+ context . getZooKeeperRoot () + Constants . ZTABLES + "/" + srcTableId + Constants .ZCONFIG ;
225
226
String newTablePath =
226
- Constants . ZROOT + "/" + instanceID + Constants .ZTABLES + "/" + tableId + Constants .ZCONFIG ;
227
+ context . getZooKeeperRoot () + Constants .ZTABLES + "/" + tableId + Constants .ZCONFIG ;
227
228
zoo .recursiveCopyPersistentOverwrite (srcTablePath , newTablePath );
228
229
229
230
PropUtil .setProperties (context , TablePropKey .of (context , tableId ), propertiesToSet );
0 commit comments